Merge "Data/activation broadcasts use elapsed realtime"
diff --git a/Android.bp b/Android.bp
index 6b2fb0c..a667c10 100644
--- a/Android.bp
+++ b/Android.bp
@@ -194,13 +194,14 @@
":framework-core-sources",
":framework-drm-sources",
":framework-graphics-sources",
+ ":framework-jobscheduler-sources", // jobscheduler is not a module for R
":framework-keystore-sources",
":framework-location-sources",
":framework-lowpan-sources",
- ":framework-media-sources",
":framework-mca-effect-sources",
":framework-mca-filterfw-sources",
":framework-mca-filterpacks-sources",
+ ":framework-media-sources",
":framework-mime-sources",
":framework-mms-sources",
":framework-opengl-sources",
@@ -401,17 +402,8 @@
name: "framework-minus-apex",
defaults: ["framework-defaults"],
srcs: [":framework-non-updatable-sources"],
- javac_shard_size: 150,
-}
-
-java_library {
- name: "framework",
- defaults: ["framework-aidl-export-defaults"],
installable: true,
- static_libs: [
- "framework-minus-apex",
- "jobscheduler-framework",
- ],
+ javac_shard_size: 150,
required: [
"framework-platform-compat-config",
"libcore-platform-compat-config",
@@ -419,6 +411,27 @@
"media-provider-platform-compat-config",
"services-devicepolicy-platform-compat-config",
],
+ // For backwards compatibility.
+ stem: "framework",
+}
+
+// This "framework" module is NOT installed to the device. It's
+// "framework-minus-apex" that gets installed to the device. Note that
+// the filename is still framework.jar (via the stem property) for
+// compatibility reason. The purpose of this module is to provide
+// framework APIs (both public and private) for bundled apps.
+// "framework-minus-apex" can't be used for the purpose because 1)
+// many apps have already hardcoded the name "framework" and
+// 2) it lacks API symbols from updatable modules - as it's clear from
+// its suffix "-minus-apex".
+java_library {
+ name: "framework",
+ defaults: ["framework-aidl-export-defaults"],
+ installable: false, // this lib is a build-only library
+ static_libs: [
+ "framework-minus-apex",
+ // TODO(jiyong): add stubs for APEXes here
+ ],
sdk_version: "core_platform",
}
@@ -548,6 +561,12 @@
],
}
+filegroup {
+ name: "framework-tethering-shared-srcs",
+ srcs: [
+ "core/java/android/util/LocalLog.java",
+ ],
+}
// Build ext.jar
// ============================================================
java_library {
@@ -916,13 +935,15 @@
]
metalava_framework_docs_args = "--manifest $(location core/res/AndroidManifest.xml) " +
+ "--ignore-classes-on-classpath " +
"--hide-package com.android.okhttp " +
"--hide-package com.android.org.conscrypt --hide-package com.android.server " +
"--error UnhiddenSystemApi " +
"--hide RequiresPermission " +
"--hide MissingPermission --hide BroadcastBehavior " +
"--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " +
- "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo "
+ "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo " +
+ "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.*"
// http://b/129765390 Rewrite links to "platform" or "technotes" folders
// which are siblings (and thus outside of) {@docRoot}.
@@ -965,7 +986,6 @@
":updatable-media-srcs",
"test-mock/src/**/*.java",
"test-runner/src/**/*.java",
- ":jobscheduler-framework-source",
],
libs: framework_docs_only_libs,
local_sourcepaths: frameworks_base_subdirs,
@@ -1028,7 +1048,6 @@
":core-current-stubs-source",
":core_public_api_files",
":updatable-media-srcs",
- ":jobscheduler-framework-source",
],
libs: ["framework-internal-utils"],
local_sourcepaths: frameworks_base_subdirs,
@@ -1601,6 +1620,17 @@
}
filegroup {
+ name: "framework-ims-common-shared-srcs",
+ srcs: [
+ "core/java/android/os/AsyncResult.java",
+ "core/java/android/os/RegistrantList.java",
+ "core/java/android/os/Registrant.java",
+ "core/java/com/android/internal/os/SomeArgs.java",
+ "core/java/com/android/internal/util/Preconditions.java",
+ ],
+}
+
+filegroup {
name: "framework-wifistack-shared-srcs",
srcs: [
":framework-annotations",
diff --git a/apex/jobscheduler/framework/Android.bp b/apex/jobscheduler/framework/Android.bp
index 621ff9a..3902aa2 100644
--- a/apex/jobscheduler/framework/Android.bp
+++ b/apex/jobscheduler/framework/Android.bp
@@ -1,5 +1,5 @@
filegroup {
- name: "jobscheduler-framework-source",
+ name: "framework-jobscheduler-sources",
srcs: [
"java/**/*.java",
"java/android/app/job/IJobCallback.aidl",
@@ -12,13 +12,12 @@
java_library {
name: "jobscheduler-framework",
- installable: true,
+ installable: false,
+ compile_dex: true,
sdk_version: "core_platform",
-
srcs: [
- ":jobscheduler-framework-source",
+ ":framework-jobscheduler-sources",
],
-
aidl: {
export_include_dirs: [
"java",
diff --git a/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java b/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java
index c036c77..041825c 100644
--- a/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java
+++ b/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java
@@ -1,9 +1,9 @@
package com.android.server.usage;
+import android.annotation.UserIdInt;
import android.app.usage.AppStandbyInfo;
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManager.StandbyBuckets;
-import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener;
import android.content.Context;
import android.os.Looper;
@@ -33,6 +33,24 @@
}
}
+ /**
+ * Listener interface for notifications that an app's idle state changed.
+ */
+ abstract static class AppIdleStateChangeListener {
+
+ /** Callback to inform listeners that the idle state has changed to a new bucket. */
+ public abstract void onAppIdleStateChanged(String packageName, @UserIdInt int userId,
+ boolean idle, int bucket, int reason);
+
+ /**
+ * Optional callback to inform the listener that the app has transitioned into
+ * an active state due to user interaction.
+ */
+ public void onUserInteractionStarted(String packageName, @UserIdInt int userId) {
+ // No-op by default
+ }
+ }
+
void onBootPhase(int phase);
void postCheckIdleStates(int userId);
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index c3ffad6..a1734d8 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -37,7 +37,6 @@
import android.app.job.JobWorkItem;
import android.app.usage.UsageStatsManager;
import android.app.usage.UsageStatsManagerInternal;
-import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -103,6 +102,8 @@
import com.android.server.job.controllers.TimeController;
import com.android.server.job.restrictions.JobRestriction;
import com.android.server.job.restrictions.ThermalStatusRestriction;
+import com.android.server.usage.AppStandbyInternal;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import libcore.util.EmptyArray;
@@ -1295,7 +1296,9 @@
// Set up the app standby bucketing tracker
mStandbyTracker = new StandbyTracker();
mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class);
- mUsageStats.addAppIdleStateChangeListener(mStandbyTracker);
+
+ AppStandbyInternal appStandby = LocalServices.getService(AppStandbyInternal.class);
+ appStandby.addListener(mStandbyTracker);
// The job store needs to call back
publishLocalService(JobSchedulerInternal.class, new LocalService());
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java
index 14dce84..cda5244 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java
@@ -35,8 +35,6 @@
import android.app.AlarmManager;
import android.app.AppGlobals;
import android.app.IUidObserver;
-import android.app.usage.UsageStatsManagerInternal;
-import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -70,6 +68,8 @@
import com.android.server.job.JobSchedulerService;
import com.android.server.job.JobServiceContext;
import com.android.server.job.StateControllerProto;
+import com.android.server.usage.AppStandbyInternal;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import java.util.ArrayList;
import java.util.List;
@@ -574,9 +574,8 @@
mContext.registerReceiverAsUser(mPackageAddedReceiver, UserHandle.ALL, filter, null, null);
// Set up the app standby bucketing tracker
- UsageStatsManagerInternal usageStats = LocalServices.getService(
- UsageStatsManagerInternal.class);
- usageStats.addAppIdleStateChangeListener(new StandbyTracker());
+ AppStandbyInternal appStandby = LocalServices.getService(AppStandbyInternal.class);
+ appStandby.addListener(new StandbyTracker());
try {
ActivityManager.getService().registerUidObserver(mUidObserver,
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
index ecc0459..bcd8be7 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
@@ -53,7 +53,6 @@
import android.app.usage.AppStandbyInfo;
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManager.StandbyBuckets;
-import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener;
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -102,6 +101,7 @@
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.LocalServices;
import com.android.server.usage.AppIdleHistory.AppUsageHistory;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import java.io.File;
import java.io.PrintWriter;
diff --git a/apex/permission/Android.bp b/apex/permission/Android.bp
new file mode 100644
index 0000000..0274814
--- /dev/null
+++ b/apex/permission/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+apex {
+ name: "com.android.permission",
+
+ manifest: "apex_manifest.json",
+
+ key: "com.android.permission.key",
+ certificate: ":com.android.permission.certificate",
+}
+
+apex_key {
+ name: "com.android.permission.key",
+ public_key: "com.android.permission.avbpubkey",
+ private_key: "com.android.permission.pem",
+}
+
+android_app_certificate {
+ name: "com.android.permission.certificate",
+ certificate: "com.android.permission",
+}
diff --git a/apex/permission/OWNERS b/apex/permission/OWNERS
new file mode 100644
index 0000000..957e10a
--- /dev/null
+++ b/apex/permission/OWNERS
@@ -0,0 +1,6 @@
+svetoslavganov@google.com
+moltmann@google.com
+eugenesusla@google.com
+zhanghai@google.com
+evanseverson@google.com
+ntmyren@google.com
diff --git a/apex/permission/apex_manifest.json b/apex/permission/apex_manifest.json
new file mode 100644
index 0000000..2a8c4f7
--- /dev/null
+++ b/apex/permission/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.permission",
+ "version": 1
+}
diff --git a/apex/permission/com.android.permission.avbpubkey b/apex/permission/com.android.permission.avbpubkey
new file mode 100644
index 0000000..9eaf852
--- /dev/null
+++ b/apex/permission/com.android.permission.avbpubkey
Binary files differ
diff --git a/apex/permission/com.android.permission.pem b/apex/permission/com.android.permission.pem
new file mode 100644
index 0000000..3d584be
--- /dev/null
+++ b/apex/permission/com.android.permission.pem
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJKgIBAAKCAgEA6snt4eqoz85xiL9Sf6w1S1b9FgSHK05zYTh2JYPvQKQ3yeZp
+E6avJ6FN6XcbmkDzSd658BvUGDBSPhOlzuUO4BsoKBuLMxP6TxIQXFKidzDqY0vQ
+4qkS++bdIhUjwBP3OSZ3Czu0BiihK8GC75Abr//EyCyObGIGGfHEGANiOgrpP4X5
++OmLzQLCjk4iE1kg+U6cRSRI/XLaoWC0TvIIuzxznrQ6r5GmzgTOwyBWyIB+bj73
+bmsweHTU+w9Y7kGOx4hO3XCLIhoBWEw0EbuW9nZmQ4sZls5Jo/CbyJlCclF11yVo
+SCf2LG/T+9pah5NOmDQ1kPbU+0iKZIV4YFHGTIhyGDE/aPOuUT05ziCGDifgHr0u
+SG1x/RLqsVh/POvNxnvP9cQFMQ08BvbEJaTTgB785iwKsvdqCfmng/SAyxSetmzP
+StXVB3fh1OoZ8vunRbQYxnmUxycVqaA96zmBx2wLvbvzKo7pZFDE6nbhnT5+MRAM
+z/VIK89W26uB4gj8sBFslqZjT0jPqsAZuvDm7swOtMwIcEolyGJuFLqlhN7UwMz2
+9y8+IpYixR+HvD1TZI9NtmuCmv3kPrWgoMZg6yvaBayTIr8RdYzi6FO/C1lLiraz
+48dH3sXWRa8cgw6VcSUwYrEBIc3sotdsupO1iOjcFybIwaee0YTZJfjvbqkCAwEA
+AQKCAgEArRnfdpaJi1xLPGTCMDsIt9kUku0XswgN7PmxsYsKFAB+2S40/jYAIRm9
+1YjpItsMA8RgFfSOdJ77o6TctCMQyo17F8bm4+uwuic5RLfv7Cx2QmsdQF8jDfFx
+y7UGPJD7znjbf76uxXOjEB2FqZX3s9TAgkzHXIUQtoQW7RVhkCWHPjxKxgd5+NY2
+FrDoUpd9xhD9CcTsw1+wbRZdGW88nL6/B50dP2AFORM2VYo8MWr6y9FEn3YLsGOC
+uu7fxBk1aUrHyl81VRkTMMROB1zkuiUk1FtzrEm+5U15rXXBFYOVe9+qeLhtuOlh
+wueDoz0pzvF/JLe24uTik6YL0Ae6SD0pFXQ2KDrdH3cUHLok3r76/yGzaDNTFjS2
+2WbQ8dEJV8veNHk8gjGpFTJIsBUlcZpmUCDHlfvVMb3+2ahQ+28piQUt5t3zqJdZ
+NDqsOHzY6BRPc+Wm85Xii/lWiQceZSee/b1Enu+nchsyXhSenBfC6bIGZReyMI0K
+KKKuVhyR6OSOiR5ZdZ/NyXGqsWy05fn/h0X9hnpETsNaNYNKWvpHLfKll+STJpf7
+AZquJPIclQyiq5NONx6kfPztoCLkKV/zOgIj3Sx5oSZq+5gpO91nXWVwkTbqK1d1
+004q2Mah6UQyAk1XGQc2pHx7ouVcWawjU30vZ4C015Hv2lm/gVkCggEBAPltATYS
+OqOSL1YAtIHPiHxMjNAgUdglq8JiJFXVfkocGU9eNub3Ed3sSWu6GB9Myu/sSKje
+bJ5DZqxJnvB2Fqmu9I9OunLGFSD0aXs4prwsQ1Rm5FcbImtrxcciASdkoo8Pj0z4
+vk2r2NZD3VtER5Uh+YjSDkxcS9gBStXUpCL6gj69UpOxMmWqZVjyHatVB4lEvYJl
+N82uT7N7QVNL1DzcZ9z4C4r7ks1Pm7ka12s5m/oaAlAMdVeofiPJe1xA9zRToSr4
+tIbMkOeXFLVRLuji/7XsOgal5Rl59p+OwLshX5cswPVOMrH6zt+hbsJ5q8M5dqnX
+VAOBK7KNQ/EKZwcCggEBAPD6KVvyCim46n5EbcEqCkO7gevwZkw/9vLwmM5YsxTh
+z9FQkPO0iB7mwbX8w04I91Pre4NdfcgMG0pP1b13Sb4KHBchqW1a+TCs3kSGC6gn
+1SxmXHnA9jRxAkrWlGkoAQEz+aP61cXiiy2tXpQwJ8xQCKprfoqWZwhkCtEVU6CE
+S7v9cscOHIqgNxx4WoceMmq4EoihHAZzHxTcNVbByckMjb2XQJ0iNw3lDP4ddvc+
+a4HzHfHkhzeQ5ZNc8SvWU8z80aSCOKRsSD3aUTZzxhZ4O2tZSW7v7p+FpvVee7bC
+g8YCfszTdpVUMlLRLjScimAcovcFLSvtyupinxWg4M8CggEAN9YGEmOsSte7zwXj
+YrfhtumwEBtcFwX/2Ej+F1Tuq4p0xAa0RaoDjumJWhtTsRYQy/raHSuFpzwxbNoi
+QXQ+CIhI6RfXtz/OlQ0B2/rHoJJMFEXgUfuaDfAXW0eqeHYXyezSyIlamKqipPyW
+Pgsf9yue39keKEv1EorfhNTQVaA8rezV4oglXwrxGyNALw2e3UTNI7ai8mFWKDis
+XAg6n9E7UwUYGGnO6DUtCBgRJ0jDOQ6/e8n+LrxiWIKPIgzNCiK6jpMUXqTGv4Fb
+umdNGAdQ9RnHt5tFmRlrczaSwJFtA7uaCpAR2zPpQbiywchZAiAIB2dTwGEXNiZX
+kksg2wKCAQEA6pNad3qhkgPDoK6T+Jkn7M82paoaqtcJWWwEE7oceZNnbWZz9Agl
+CY+vuawXonrv5+0vCq2Tp4zBdBFLC2h3jFrjBVFrUFxifpOIukOSTVqZFON/2bWQ
+9XOcu6UuSz7522Xw+UNPnZXtzcUacD6AP08ZYGvLfrTyDyTzspyED5k48ALEHCkM
+d5WGkFxII4etpF0TDZVnZo/iDbhe49k4yFFEGO6Ho26PESOLBkNAb2V/2bwDxlij
+l9+g21Z6HiZA5SamHPH2mXgeyrcen1cL2QupK9J6vVcqfnboE6qp2zp2c+Yx8MlY
+gfy4EA44YFaSDQVTTgrn8f9Eq+zc130H2QKCAQEAqOKgv68nIPdDSngNyCVyWego
+boFiDaEJoBBg8FrBjTJ6wFLrNAnXmbvfTtgNmNAzF1cUPJZlIIsHgGrMCfpehbXq
+WQQIw+E+yFbTGLxseGRfsLrV0CsgnAoOVeod+yIHmqc3livaUbrWhL1V2f6Ue+sE
+7YLp/iP43NaMfA4kYk2ep7+ZJoEVkCjHJJaHWgAG3RynPJHkTJlSgu7wLYvGc9uE
+ZsEFUM46lX02t7rrtMfasVGrUy1c2xOxFb4v1vG6iEZ7+YWeq5o3AkxUwEGn+mG4
+/3p+k4AaTXJDXgyZ0Sv6CkGuPHenAYG4cswcUUEf/G4Ag77x6LBNMgycJBxUJA==
+-----END RSA PRIVATE KEY-----
diff --git a/apex/permission/com.android.permission.pk8 b/apex/permission/com.android.permission.pk8
new file mode 100644
index 0000000..d51673d
--- /dev/null
+++ b/apex/permission/com.android.permission.pk8
Binary files differ
diff --git a/apex/permission/com.android.permission.x509.pem b/apex/permission/com.android.permission.x509.pem
new file mode 100644
index 0000000..4b146c9
--- /dev/null
+++ b/apex/permission/com.android.permission.x509.pem
@@ -0,0 +1,35 @@
+-----BEGIN CERTIFICATE-----
+MIIGKzCCBBOgAwIBAgIUezo3fQeVZsmLpm/dkpGWJ/G/MN8wDQYJKoZIhvcNAQEL
+BQAwgaMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQH
+DA1Nb3VudGFpbiBWaWV3MRAwDgYDVQQKDAdBbmRyb2lkMRAwDgYDVQQLDAdBbmRy
+b2lkMR8wHQYDVQQDDBZjb20uYW5kcm9pZC5wZXJtaXNzaW9uMSIwIAYJKoZIhvcN
+AQkBFhNhbmRyb2lkQGFuZHJvaWQuY29tMCAXDTE5MTAwOTIxMzExOVoYDzQ3NTcw
+OTA0MjEzMTE5WjCBozELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx
+FjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEDAOBgNVBAoMB0FuZHJvaWQxEDAOBgNV
+BAsMB0FuZHJvaWQxHzAdBgNVBAMMFmNvbS5hbmRyb2lkLnBlcm1pc3Npb24xIjAg
+BgkqhkiG9w0BCQEWE2FuZHJvaWRAYW5kcm9pZC5jb20wggIiMA0GCSqGSIb3DQEB
+AQUAA4ICDwAwggIKAoICAQCxefguRJ7E6tBCTEOeU2HJEGs6AQQapLz9hMed0aaJ
+Qr7aTQiYJEk+sG4+jPYbjpxa8JDDzJHp+4g7DjfSb+dvT9n84A8lWaI/yRXTZTQN
+Hu5m/bgHhi0LbySpiaFyodXBKUAnOhZyGPtYjtBFywFylueub8ryc1Z6UxxU7udH
+1mkIr7sE48Qkq5SyjFROE96iFmYA+vS/JXOfS0NBHiMB4GBxx4V7kXpvrTI7hhZG
+HiyhKvNh7wyHIhO9nDEw1rwtAH6CsL3YkQEVBeAU98m+0Au+qStLYkKHh2l8zT4W
+7sVK1VSqfB+VqOUmeIGdzlBfqMsoXD+FJz6KnIdUHIwjFDjL7Xr+hd+7xve+Q3S+
+U3Blk/U6atY8PM09wNfilG+SvwcKk5IgriDcu3rWKgIFxbUUaxLrDW7pLlu6wt/d
+GGtKK+Bc0jF+9Z901Tl33i5xhc5yOktT0btkKs7lSeE6VzP/Nk5g0SuzixmuRoh9
+f5Ge41N2ZCEHNXx3wZeVZwHIIPfYrL7Yql1Xoxbfs4ETFk6ChzVQcvjfDQQuK58J
+uNc+TOCoI/qflXwGCwpuHl0ier8V5Z4tpMUl5rWyVR/QGRtLPvs2lLuxczDw1OXq
+wEVtCMn9aNnd4y7R9PZ52hi53HAvDjpWefrLYi+Q04J6iGFQ1qAFBClK9DquBvmR
+swIDAQABo1MwUTAdBgNVHQ4EFgQULpfus5s5SrqLkoUKyPXA0D1iHPMwHwYDVR0j
+BBgwFoAULpfus5s5SrqLkoUKyPXA0D1iHPMwDwYDVR0TAQH/BAUwAwEB/zANBgkq
+hkiG9w0BAQsFAAOCAgEAjxQG5EFv8V/9yV2glI53VOmlWMjfEgvUjd39s/XLyPlr
+OzPOKSB0NFo8To3l4l+MsManxPK8y0OyfEVKbWVz9onv0ovo5MVokBmV/2G0jmsV
+B4e9yjOq+DmqIvY/Qh63Ywb97sTgcFI8620MhQDbh2IpEGv4ZNV0H6rgXmgdSCBw
+1EjBoYfFpN5aMgZjeyzZcq+d1IapdWqdhuEJQkMvoYS4WIumNIJlEXPQRoq/F5Ih
+nszdbKI/jVyiGFa2oeZ3rja1Y6GCRU8TYEoKx1pjS8uQDOEDTwsG/QnUe9peEj0V
+SsCkIidJWTomAmq9Tub9vpBe1zuTpuRAwxwR0qwgSxozV1Mvow1dJ19oFtHX0yD6
+ZjCpRn5PW9kMvSWSlrcrFs1NJf0j1Cvf7bHpkEDqLqpMnnh9jaFQq3nzDY+MWcIR
+jDcgQpI+AiE2/qtauZnFEVhbce49nCnk9+5bpTTIZJdzqeaExe5KXHwEtZLaEDh4
+atLY9LuEvPsjmDIMOR6hycD9FvwGXhJOQBjESIWFwigtSb1Yud9n6201jw3MLJ4k
++WhkbmZgWy+xc+Mdm5H3XyB1lvHaHGkxu+QB9KyQuVQKwbUVcbwZIfTFPN6Zr/dS
+ZXJqAbBhG/dBgF0LazuLaPVpibi+a3Y+tb9b8eXGkz4F97PWZIEDkELQ+9KOvhc=
+-----END CERTIFICATE-----
diff --git a/apex/statsd/.clang-format b/apex/statsd/.clang-format
new file mode 100644
index 0000000..cead3a0
--- /dev/null
+++ b/apex/statsd/.clang-format
@@ -0,0 +1,17 @@
+BasedOnStyle: Google
+AllowShortIfStatementsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+BinPackArguments: true
+BinPackParameters: true
+ColumnLimit: 100
+CommentPragmas: NOLINT:.*
+ContinuationIndentWidth: 8
+DerivePointerAlignment: false
+IndentWidth: 4
+PointerAlignment: Left
+TabWidth: 4
+AccessModifierOffset: -4
+IncludeCategories:
+ - Regex: '^"Log\.h"'
+ Priority: -1
diff --git a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
index 1a10753..5e5a04b 100644
--- a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
+++ b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
@@ -156,8 +156,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
-import java.time.Instant;
-import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -2071,9 +2069,7 @@
CompletableFuture<HistoricalOps> ops = new CompletableFuture<>();
HistoricalOpsRequest histOpsRequest =
- new HistoricalOpsRequest.Builder(
- Instant.now().minus(1, ChronoUnit.HOURS).toEpochMilli(),
- Long.MAX_VALUE).build();
+ new HistoricalOpsRequest.Builder(0, Long.MAX_VALUE).build();
appOps.getHistoricalOps(histOpsRequest, mContext.getMainExecutor(), ops::complete);
HistoricalOps histOps = ops.get(EXTERNAL_STATS_SYNC_TIMEOUT_MILLIS,
diff --git a/api/current.txt b/api/current.txt
index 71dc58b..57bbd77 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6851,6 +6851,7 @@
method public boolean setKeyPairCertificate(@Nullable android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.security.cert.Certificate>, boolean);
method public boolean setKeyguardDisabled(@NonNull android.content.ComponentName, boolean);
method public void setKeyguardDisabledFeatures(@NonNull android.content.ComponentName, int);
+ method public void setLocationEnabled(@NonNull android.content.ComponentName, boolean);
method public void setLockTaskFeatures(@NonNull android.content.ComponentName, int);
method public void setLockTaskPackages(@NonNull android.content.ComponentName, @NonNull String[]) throws java.lang.SecurityException;
method public void setLogoutEnabled(@NonNull android.content.ComponentName, boolean);
@@ -9230,14 +9231,16 @@
public final class WifiDeviceFilter implements android.companion.DeviceFilter<android.net.wifi.ScanResult> {
method public int describeContents();
- method public void writeToParcel(android.os.Parcel, int);
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.companion.WifiDeviceFilter> CREATOR;
}
public static final class WifiDeviceFilter.Builder {
ctor public WifiDeviceFilter.Builder();
method @NonNull public android.companion.WifiDeviceFilter build();
- method public android.companion.WifiDeviceFilter.Builder setNamePattern(@Nullable java.util.regex.Pattern);
+ method @NonNull public android.companion.WifiDeviceFilter.Builder setBssid(@Nullable android.net.MacAddress);
+ method @NonNull public android.companion.WifiDeviceFilter.Builder setBssidMask(@NonNull android.net.MacAddress);
+ method @NonNull public android.companion.WifiDeviceFilter.Builder setNamePattern(@Nullable java.util.regex.Pattern);
}
}
@@ -9489,6 +9492,7 @@
method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal);
method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
method public boolean refresh(android.net.Uri, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
+ method @NonNull public final android.content.Context requireContext();
method public final void restoreCallingIdentity(@NonNull android.content.ContentProvider.CallingIdentity);
method protected final void setPathPermissions(@Nullable android.content.pm.PathPermission[]);
method protected final void setReadPermission(@Nullable String);
@@ -29975,10 +29979,16 @@
method public String getSSID();
method public android.net.wifi.SupplicantState getSupplicantState();
method @IntRange(from=0xffffffff) public int getTxLinkSpeedMbps();
+ method public int getWifiTechnology();
method public void writeToParcel(android.os.Parcel, int);
field public static final String FREQUENCY_UNITS = "MHz";
field public static final String LINK_SPEED_UNITS = "Mbps";
field public static final int LINK_SPEED_UNKNOWN = -1; // 0xffffffff
+ field public static final int WIFI_TECHNOLOGY_11AC = 5; // 0x5
+ field public static final int WIFI_TECHNOLOGY_11AX = 6; // 0x6
+ field public static final int WIFI_TECHNOLOGY_11N = 4; // 0x4
+ field public static final int WIFI_TECHNOLOGY_LEGACY = 1; // 0x1
+ field public static final int WIFI_TECHNOLOGY_UNKNOWN = 0; // 0x0
}
public class WifiManager {
@@ -30336,6 +30346,8 @@
method public int describeContents();
method public android.net.wifi.hotspot2.pps.Credential getCredential();
method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
+ method public long getSubscriptionExpirationTimeInMillis();
+ method public boolean isOsuProvisioned();
method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
method public void writeToParcel(android.os.Parcel, int);
@@ -38907,6 +38919,7 @@
field public static final String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS";
field public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
field public static final String ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
+ field public static final String ACTION_SHOW_WORK_POLICY_INFO = "android.settings.SHOW_WORK_POLICY_INFO";
field public static final String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS";
field @Deprecated public static final String ACTION_STORAGE_VOLUME_ACCESS_SETTINGS = "android.settings.STORAGE_VOLUME_ACCESS_SETTINGS";
field public static final String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS";
@@ -41368,11 +41381,16 @@
field public static final int FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE = 1; // 0x1
field public static final int NEGATIVE_BUTTON_STYLE_CANCEL = 0; // 0x0
field public static final int NEGATIVE_BUTTON_STYLE_REJECT = 1; // 0x1
+ field public static final int POSITIVE_BUTTON_STYLE_CONTINUE = 1; // 0x1
+ field public static final int POSITIVE_BUTTON_STYLE_SAVE = 0; // 0x0
field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
+ field public static final int SAVE_DATA_TYPE_DEBIT_CARD = 32; // 0x20
field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
+ field public static final int SAVE_DATA_TYPE_GENERIC_CARD = 128; // 0x80
field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
+ field public static final int SAVE_DATA_TYPE_PAYMENT_CARD = 64; // 0x40
field public static final int SAVE_DATA_TYPE_USERNAME = 8; // 0x8
}
@@ -41386,6 +41404,7 @@
method @NonNull public android.service.autofill.SaveInfo.Builder setFlags(int);
method @NonNull public android.service.autofill.SaveInfo.Builder setNegativeAction(int, @Nullable android.content.IntentSender);
method @NonNull public android.service.autofill.SaveInfo.Builder setOptionalIds(@NonNull android.view.autofill.AutofillId[]);
+ method @NonNull public android.service.autofill.SaveInfo.Builder setPositiveAction(int);
method @NonNull public android.service.autofill.SaveInfo.Builder setTriggerId(@NonNull android.view.autofill.AutofillId);
method @NonNull public android.service.autofill.SaveInfo.Builder setValidator(@NonNull android.service.autofill.Validator);
}
@@ -44976,13 +44995,60 @@
field public static final int MMS_ERROR_RETRY = 6; // 0x6
field public static final int MMS_ERROR_UNABLE_CONNECT_MMS = 3; // 0x3
field public static final int MMS_ERROR_UNSPECIFIED = 1; // 0x1
+ field public static final int RESULT_BLUETOOTH_DISCONNECTED = 27; // 0x1b
+ field public static final int RESULT_CANCELLED = 23; // 0x17
+ field public static final int RESULT_ENCODING_ERROR = 18; // 0x12
+ field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; // 0x6
field public static final int RESULT_ERROR_GENERIC_FAILURE = 1; // 0x1
field public static final int RESULT_ERROR_LIMIT_EXCEEDED = 5; // 0x5
+ field public static final int RESULT_ERROR_NONE = 0; // 0x0
field public static final int RESULT_ERROR_NO_SERVICE = 4; // 0x4
field public static final int RESULT_ERROR_NULL_PDU = 3; // 0x3
field public static final int RESULT_ERROR_RADIO_OFF = 2; // 0x2
field public static final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8; // 0x8
field public static final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7; // 0x7
+ field public static final int RESULT_INTERNAL_ERROR = 21; // 0x15
+ field public static final int RESULT_INVALID_ARGUMENTS = 11; // 0xb
+ field public static final int RESULT_INVALID_BLUETOOTH_ADDRESS = 26; // 0x1a
+ field public static final int RESULT_INVALID_SMSC_ADDRESS = 19; // 0x13
+ field public static final int RESULT_INVALID_SMS_FORMAT = 14; // 0xe
+ field public static final int RESULT_INVALID_STATE = 12; // 0xc
+ field public static final int RESULT_MODEM_ERROR = 16; // 0x10
+ field public static final int RESULT_NETWORK_ERROR = 17; // 0x11
+ field public static final int RESULT_NETWORK_REJECT = 10; // 0xa
+ field public static final int RESULT_NO_BLUETOOTH_SERVICE = 25; // 0x19
+ field public static final int RESULT_NO_DEFAULT_SMS_APP = 32; // 0x20
+ field public static final int RESULT_NO_MEMORY = 13; // 0xd
+ field public static final int RESULT_NO_RESOURCES = 22; // 0x16
+ field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
+ field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
+ field public static final int RESULT_REMOTE_EXCEPTION = 31; // 0x1f
+ field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
+ field public static final int RESULT_RIL_CANCELLED = 119; // 0x77
+ field public static final int RESULT_RIL_ENCODING_ERR = 109; // 0x6d
+ field public static final int RESULT_RIL_INTERNAL_ERR = 113; // 0x71
+ field public static final int RESULT_RIL_INVALID_ARGUMENTS = 104; // 0x68
+ field public static final int RESULT_RIL_INVALID_MODEM_STATE = 115; // 0x73
+ field public static final int RESULT_RIL_INVALID_SMSC_ADDRESS = 110; // 0x6e
+ field public static final int RESULT_RIL_INVALID_SMS_FORMAT = 107; // 0x6b
+ field public static final int RESULT_RIL_INVALID_STATE = 103; // 0x67
+ field public static final int RESULT_RIL_MODEM_ERR = 111; // 0x6f
+ field public static final int RESULT_RIL_NETWORK_ERR = 112; // 0x70
+ field public static final int RESULT_RIL_NETWORK_NOT_READY = 116; // 0x74
+ field public static final int RESULT_RIL_NETWORK_REJECT = 102; // 0x66
+ field public static final int RESULT_RIL_NO_MEMORY = 105; // 0x69
+ field public static final int RESULT_RIL_NO_RESOURCES = 118; // 0x76
+ field public static final int RESULT_RIL_OPERATION_NOT_ALLOWED = 117; // 0x75
+ field public static final int RESULT_RIL_RADIO_NOT_AVAILABLE = 100; // 0x64
+ field public static final int RESULT_RIL_REQUEST_NOT_SUPPORTED = 114; // 0x72
+ field public static final int RESULT_RIL_REQUEST_RATE_LIMITED = 106; // 0x6a
+ field public static final int RESULT_RIL_SIM_ABSENT = 120; // 0x78
+ field public static final int RESULT_RIL_SMS_SEND_FAIL_RETRY = 101; // 0x65
+ field public static final int RESULT_RIL_SYSTEM_ERR = 108; // 0x6c
+ field public static final int RESULT_SMS_BLOCKED_DURING_EMERGENCY = 29; // 0x1d
+ field public static final int RESULT_SMS_SEND_RETRY_FAILED = 30; // 0x1e
+ field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf
+ field public static final int RESULT_UNEXPECTED_EVENT_STOP_SENDING = 28; // 0x1c
field public static final int STATUS_ON_ICC_FREE = 0; // 0x0
field public static final int STATUS_ON_ICC_READ = 1; // 0x1
field public static final int STATUS_ON_ICC_SENT = 5; // 0x5
diff --git a/api/system-current.txt b/api/system-current.txt
index 295fef1..e6a3e9b 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1394,6 +1394,7 @@
method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void startActivityAsUser(@RequiresPermission @NonNull android.content.Intent, @NonNull android.os.UserHandle);
field public static final String APP_PREDICTION_SERVICE = "app_prediction";
field public static final String BACKUP_SERVICE = "backup";
+ field public static final String BATTERY_STATS_SERVICE = "batterystats";
field public static final String BUGREPORT_SERVICE = "bugreport";
field public static final String CONTENT_SUGGESTIONS_SERVICE = "content_suggestions";
field public static final String CONTEXTHUB_SERVICE = "contexthub";
@@ -3638,7 +3639,7 @@
public final class MediaRecorder.AudioSource {
field @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public static final int ECHO_REFERENCE = 1997; // 0x7cd
field @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_HOTWORD) public static final int HOTWORD = 1999; // 0x7cf
- field public static final int RADIO_TUNER = 1998; // 0x7ce
+ field @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public static final int RADIO_TUNER = 1998; // 0x7ce
}
public class PlayerProxy {
@@ -4733,10 +4734,18 @@
field @Deprecated public byte id;
}
+ public final class WifiClient implements android.os.Parcelable {
+ method public int describeContents();
+ method @NonNull public android.net.MacAddress getMacAddress();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiClient> CREATOR;
+ }
+
@Deprecated public class WifiConfiguration implements android.os.Parcelable {
method @Deprecated public boolean hasNoInternetAccess();
method @Deprecated public boolean isEphemeral();
method @Deprecated public boolean isNoInternetAccessExpected();
+ field @Deprecated public boolean allowAutojoin;
field @Deprecated public String creatorName;
field @Deprecated public int creatorUid;
field @Deprecated public String lastUpdateName;
@@ -4759,6 +4768,7 @@
public class WifiManager {
method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
+ method @RequiresPermission("android.permission.NETWORK_SETTINGS") public void allowAutojoin(int, boolean);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @Deprecated @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
@@ -4780,8 +4790,11 @@
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsConfiguratorInitiator(@NonNull String, int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsEnrolleeInitiator(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public boolean startScan(android.os.WorkSource);
+ method @RequiresPermission(anyOf={"android.permission.NETWORK_STACK", android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public boolean startSoftAp(@Nullable android.net.wifi.WifiConfiguration);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startSubscriptionProvisioning(@NonNull android.net.wifi.hotspot2.OsuProvider, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.hotspot2.ProvisioningCallback);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void stopEasyConnectSession();
+ method @RequiresPermission(anyOf={"android.permission.NETWORK_STACK", android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public boolean stopSoftAp();
+ method @RequiresPermission(anyOf={"android.permission.NETWORK_STACK", android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateInterfaceIpState(@Nullable String, int);
method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void updateWifiUsabilityScore(int, int, int);
field public static final int CHANGE_REASON_ADDED = 0; // 0x0
field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
@@ -4796,10 +4809,16 @@
field public static final String EXTRA_CHANGE_REASON = "changeReason";
field public static final String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
field public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
+ field public static final String EXTRA_WIFI_AP_INTERFACE_NAME = "android.net.wifi.extra.WIFI_AP_INTERFACE_NAME";
+ field public static final String EXTRA_WIFI_AP_MODE = "android.net.wifi.extra.WIFI_AP_MODE";
field public static final String EXTRA_WIFI_AP_STATE = "wifi_state";
field public static final String EXTRA_WIFI_CONFIGURATION = "wifiConfiguration";
field public static final String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et";
field public static final String EXTRA_WIFI_CREDENTIAL_SSID = "ssid";
+ field public static final int IFACE_IP_MODE_CONFIGURATION_ERROR = 0; // 0x0
+ field public static final int IFACE_IP_MODE_LOCAL_ONLY = 2; // 0x2
+ field public static final int IFACE_IP_MODE_TETHERED = 1; // 0x1
+ field public static final int IFACE_IP_MODE_UNSPECIFIED = -1; // 0xffffffff
field public static final int PASSPOINT_HOME_NETWORK = 0; // 0x0
field public static final int PASSPOINT_ROAMING_NETWORK = 1; // 0x1
field public static final String WIFI_AP_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_AP_STATE_CHANGED";
@@ -4836,6 +4855,7 @@
public class WifiScanner {
method @Deprecated public void configureWifiChange(int, int, int, int, int, android.net.wifi.WifiScanner.BssidInfo[]);
method @Deprecated public void configureWifiChange(android.net.wifi.WifiScanner.WifiChangeSettings);
+ method @Nullable @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public java.util.List<java.lang.Integer> getAvailableChannels(int);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean getScanResults();
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startBackgroundScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startBackgroundScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener, android.os.WorkSource);
@@ -5193,6 +5213,23 @@
method @NonNull public android.os.BatterySaverPolicyConfig.Builder setLocationMode(int);
}
+ public class BatteryStatsManager {
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) @NonNull public android.os.connectivity.WifiBatteryStats getWifiBatteryStats();
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteFullWifiLockAcquiredFromSource(@NonNull android.os.WorkSource);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteFullWifiLockReleasedFromSource(@NonNull android.os.WorkSource);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiBatchedScanStartedFromSource(@NonNull android.os.WorkSource, @IntRange(from=0) int);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiBatchedScanStoppedFromSource(@NonNull android.os.WorkSource);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiMulticastDisabled(int);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiMulticastEnabled(int);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiOff();
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiOn();
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiRssiChanged(@IntRange(from=0xffffff81, to=0) int);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiScanStartedFromSource(@NonNull android.os.WorkSource);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiScanStoppedFromSource(@NonNull android.os.WorkSource);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiState(int, @Nullable String);
+ method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiSupplicantStateChanged(int, boolean);
+ }
+
public class Binder implements android.os.IBinder {
method public static void setProxyTransactListener(@Nullable android.os.Binder.ProxyTransactListener);
}
@@ -5636,6 +5673,8 @@
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isPrimaryUser();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isRestrictedProfile();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isRestrictedProfile(@NonNull android.os.UserHandle);
+ method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isSameProfileGroup(@NonNull android.os.UserHandle, @NonNull android.os.UserHandle);
+ method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS}) public boolean isUserUnlockingOrUnlocked(@NonNull android.os.UserHandle);
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean removeUser(@NonNull android.os.UserHandle);
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserIcon(@NonNull android.graphics.Bitmap);
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserName(@Nullable String);
@@ -5679,6 +5718,30 @@
}
+package android.os.connectivity {
+
+ public final class WifiBatteryStats implements android.os.Parcelable {
+ method public int describeContents();
+ method public long getEnergyConsumedMaMillis();
+ method public long getIdleTimeMillis();
+ method public long getKernelActiveTimeMillis();
+ method public long getLoggingDurationMillis();
+ method public long getMonitoredRailChargeConsumedMaMillis();
+ method public long getNumAppScanRequest();
+ method public long getNumBytesRx();
+ method public long getNumBytesTx();
+ method public long getNumPacketsRx();
+ method public long getNumPacketsTx();
+ method public long getRxTimeMillis();
+ method public long getScanTimeMillis();
+ method public long getSleepTimeMillis();
+ method public long getTxTimeMillis();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.os.connectivity.WifiBatteryStats> CREATOR;
+ }
+
+}
+
package android.os.image {
public class DynamicSystemClient {
@@ -5930,6 +5993,7 @@
field public static final String NAMESPACE_MEDIA_NATIVE = "media_native";
field public static final String NAMESPACE_NETD_NATIVE = "netd_native";
field public static final String NAMESPACE_PACKAGE_MANAGER_SERVICE = "package_manager_service";
+ field public static final String NAMESPACE_PERMISSIONS = "permissions";
field public static final String NAMESPACE_PRIVACY = "privacy";
field public static final String NAMESPACE_ROLLBACK = "rollback";
field public static final String NAMESPACE_ROLLBACK_BOOT = "rollback_boot";
@@ -6898,9 +6962,11 @@
method @Deprecated public final android.view.textclassifier.TextClassifier getLocalTextClassifier();
method @Nullable public final android.os.IBinder onBind(android.content.Intent);
method @MainThread public abstract void onClassifyText(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassification.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
+ method public void onConnected();
method @MainThread public void onCreateTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationContext, @NonNull android.view.textclassifier.TextClassificationSessionId);
method @MainThread public void onDestroyTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationSessionId);
method @MainThread public void onDetectLanguage(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLanguage.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLanguage>);
+ method public void onDisconnected();
method @MainThread public abstract void onGenerateLinks(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLinks.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
method @Deprecated @MainThread public void onSelectionEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.SelectionEvent);
method @MainThread public void onSuggestConversationActions(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.ConversationActions.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.ConversationActions>);
@@ -8208,24 +8274,6 @@
method public boolean disableCellBroadcastRange(int, int, int);
method public boolean enableCellBroadcastRange(int, int, int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
- field public static final int RESULT_CANCELLED = 23; // 0x17
- field public static final int RESULT_ENCODING_ERROR = 18; // 0x12
- field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; // 0x6
- field public static final int RESULT_ERROR_NONE = 0; // 0x0
- field public static final int RESULT_INTERNAL_ERROR = 21; // 0x15
- field public static final int RESULT_INVALID_ARGUMENTS = 11; // 0xb
- field public static final int RESULT_INVALID_SMSC_ADDRESS = 19; // 0x13
- field public static final int RESULT_INVALID_SMS_FORMAT = 14; // 0xe
- field public static final int RESULT_INVALID_STATE = 12; // 0xc
- field public static final int RESULT_MODEM_ERROR = 16; // 0x10
- field public static final int RESULT_NETWORK_ERROR = 17; // 0x11
- field public static final int RESULT_NETWORK_REJECT = 10; // 0xa
- field public static final int RESULT_NO_MEMORY = 13; // 0xd
- field public static final int RESULT_NO_RESOURCES = 22; // 0x16
- field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
- field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
- field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
- field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf
}
public class SubscriptionInfo implements android.os.Parcelable {
@@ -8285,6 +8333,9 @@
public class TelephonyManager {
method @Deprecated @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void call(String, String);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void carrierActionReportDefaultNetworkStatus(int, boolean);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void carrierActionResetAll(int);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void carrierActionSetRadioEnabled(int, boolean);
method public int checkCarrierPrivilegesForPackage(String);
method public int checkCarrierPrivilegesForPackageAnyPhone(String);
method public void dial(String);
diff --git a/api/test-current.txt b/api/test-current.txt
index b3834bf..a060dfc 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2373,6 +2373,7 @@
method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean);
field public static final String NAMESPACE_AUTOFILL = "autofill";
field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
+ field public static final String NAMESPACE_PERMISSIONS = "permissions";
field public static final String NAMESPACE_PRIVACY = "privacy";
field public static final String NAMESPACE_ROLLBACK = "rollback";
field public static final String NAMESPACE_ROLLBACK_BOOT = "rollback_boot";
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 1572114..f476fcf 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -546,16 +546,16 @@
;
android_log_list_element elem;
- lastTimestamp.tv_sec = msg.entry_v1.sec;
- lastTimestamp.tv_nsec = msg.entry_v1.nsec;
+ lastTimestamp.tv_sec = msg.entry.sec;
+ lastTimestamp.tv_nsec = msg.entry.nsec;
// format a BinaryLogEntry
uint64_t token = proto.start(LogProto::BINARY_LOGS);
- proto.write(BinaryLogEntry::SEC, msg.entry_v1.sec);
- proto.write(BinaryLogEntry::NANOSEC, msg.entry_v1.nsec);
- proto.write(BinaryLogEntry::UID, (int)msg.entry_v4.uid);
- proto.write(BinaryLogEntry::PID, msg.entry_v1.pid);
- proto.write(BinaryLogEntry::TID, msg.entry_v1.tid);
+ proto.write(BinaryLogEntry::SEC, (int32_t)msg.entry.sec);
+ proto.write(BinaryLogEntry::NANOSEC, (int32_t)msg.entry.nsec);
+ proto.write(BinaryLogEntry::UID, (int)msg.entry.uid);
+ proto.write(BinaryLogEntry::PID, msg.entry.pid);
+ proto.write(BinaryLogEntry::TID, (int32_t)msg.entry.tid);
proto.write(BinaryLogEntry::TAG_INDEX,
get4LE(reinterpret_cast<uint8_t const*>(msg.msg())));
do {
@@ -603,7 +603,7 @@
}
} else {
AndroidLogEntry entry;
- err = android_log_processLogBuffer(&msg.entry_v1, &entry);
+ err = android_log_processLogBuffer(&msg.entry, &entry);
if (err != NO_ERROR) {
ALOGW("[%s] fails to process to an entry.\n", this->name.string());
break;
diff --git a/cmds/statsd/benchmark/log_event_benchmark.cpp b/cmds/statsd/benchmark/log_event_benchmark.cpp
index 43addc2..2603469 100644
--- a/cmds/statsd/benchmark/log_event_benchmark.cpp
+++ b/cmds/statsd/benchmark/log_event_benchmark.cpp
@@ -54,9 +54,9 @@
write4Bytes(99 /* a value to log*/, &buffer);
buffer.push_back(EVENT_TYPE_LIST_STOP);
- msg->entry_v1.len = buffer.size();
+ msg->entry.len = buffer.size();
msg->entry.hdr_size = kLogMsgHeaderSize;
- msg->entry_v1.sec = time(nullptr);
+ msg->entry.sec = time(nullptr);
std::copy(buffer.begin(), buffer.end(), msg->buf + kLogMsgHeaderSize);
}
diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp
index fd19c9d..262921e 100644
--- a/cmds/statsd/src/logd/LogEvent.cpp
+++ b/cmds/statsd/src/logd/LogEvent.cpp
@@ -38,8 +38,8 @@
LogEvent::LogEvent(log_msg& msg) {
mContext =
create_android_log_parser(msg.msg() + sizeof(uint32_t), msg.len() - sizeof(uint32_t));
- mLogdTimestampNs = msg.entry_v1.sec * NS_PER_SEC + msg.entry_v1.nsec;
- mLogUid = msg.entry_v4.uid;
+ mLogdTimestampNs = msg.entry.sec * NS_PER_SEC + msg.entry.nsec;
+ mLogUid = msg.entry.uid;
init(mContext);
if (mContext) {
// android_log_destroy will set mContext to NULL
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 26c2c0c..f4e465a 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -563,6 +563,21 @@
* account, or the AbstractAcccountAuthenticator managing the account did so or because the
* client shares a signature with the managing AbstractAccountAuthenticator.
*
+ * <div class="caution"><p><b>Caution: </b>This method returns personal and sensitive user data.
+ * If your app accesses, collects, uses, or shares personal and sensitive data, you must clearly
+ * disclose that fact to users. For apps published on Google Play, policies protecting user data
+ * require that you do the following:</p>
+ * <ul>
+ * <li>Disclose to the user how your app accesses, collects, uses, or shares personal and
+ * sensitive data. Learn more about
+ * <a href="https://play.google.com/about/privacy-security-deception/user-data/#!#personal-sensitive">acceptable
+ * disclosure and consent</a>.</li>
+ * <li>Provide a privacy policy that describes your use of this data on- and off-device.</li>
+ * </ul>
+ * <p>To learn more, visit the
+ * <a href="https://play.google.com/about/privacy-security-deception/user-data">Google Play
+ * Policy regarding user data</a>.</p></div>
+ *
* <p>
* It is safe to call this method from the main thread.
*
@@ -649,6 +664,22 @@
* the account. For example, there are types corresponding to Google and Facebook. The exact
* string token to use will be published somewhere associated with the authenticator in
* question.
+ * </p>
+ *
+ * <div class="caution"><p><b>Caution: </b>This method returns personal and sensitive user data.
+ * If your app accesses, collects, uses, or shares personal and sensitive data, you must clearly
+ * disclose that fact to users. For apps published on Google Play, policies protecting user data
+ * require that you do the following:</p>
+ * <ul>
+ * <li>Disclose to the user how your app accesses, collects, uses, or shares personal and
+ * sensitive data. Learn more about
+ * <a href="https://play.google.com/about/privacy-security-deception/user-data/#!#personal-sensitive">acceptable
+ * disclosure and consent</a>.</li>
+ * <li>Provide a privacy policy that describes your use of this data on- and off-device.</li>
+ * </ul>
+ * <p>To learn more, visit the
+ * <a href="https://play.google.com/about/privacy-security-deception/user-data">Google Play
+ * Policy regarding user data</a>.</p></div>
*
* <p>
* It is safe to call this method from the main thread.
diff --git a/core/java/android/annotation/UnsupportedAppUsage.java b/core/java/android/annotation/UnsupportedAppUsage.java
index a454df5..204d71d 100644
--- a/core/java/android/annotation/UnsupportedAppUsage.java
+++ b/core/java/android/annotation/UnsupportedAppUsage.java
@@ -83,8 +83,9 @@
* <p>Possible values are:
* <ul>
* <li>
- * {@link android.os.Build.VERSION_CODES#O} or {@link android.os.Build.VERSION_CODES#P},
- * to limit access to apps targeting these SDKs (or earlier).
+ * An API level like {@link android.os.Build.VERSION_CODES#O} - in which case the API is
+ * available up to and including the specified release. Or, in other words, the API is
+ * blacklisted (unavailable) from the next API level from the one specified.
* </li>
* <li>
* absent (default value) - All apps can access this API, but doing so may result in
@@ -94,10 +95,6 @@
*
* </ul>
*
- * Note, if this is set to {@link android.os.Build.VERSION_CODES#O}, apps targeting O
- * maintenance releases will also be allowed to use the API, and similarly for any future
- * maintenance releases of P.
- *
* @return The maximum value for an apps targetSdkVersion in order to access this API.
*/
int maxTargetSdk() default Integer.MAX_VALUE;
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 2c57622..9872e30 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2563,9 +2563,12 @@
}
/**
- * Report to the system that your app is now fully drawn, purely for diagnostic
- * purposes (calling it does not impact the visible behavior of the activity).
- * This is only used to help instrument application launch times, so that the
+ * Report to the system that your app is now fully drawn, for diagnostic and
+ * optimization purposes. The system may adjust optimizations to prioritize
+ * work that happens before reportFullyDrawn is called, to improve app startup.
+ * Misrepresenting the startup window by calling reportFullyDrawn too late or too
+ * early may decrease application and startup performance.<p>
+ * This is also used to help instrument application launch times, so that the
* app can report when it is fully in a usable state; without this, the only thing
* the system itself can determine is the point at which the activity's window
* is <em>first</em> drawn and displayed. To participate in app launch time
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index d5e41f0..8bca87e6 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -2822,12 +2822,12 @@
LongSparseArray.StringParcelling.class);
return new OpFeatureEntry.Builder(source.readBoolean(),
- (LongSparseLongArray) longSparseLongArrayParcelling.unparcel(source),
- (LongSparseLongArray) longSparseLongArrayParcelling.unparcel(source),
- (LongSparseLongArray) longSparseLongArrayParcelling.unparcel(source),
- (LongSparseLongArray) longSparseLongArrayParcelling.unparcel(source),
- (LongSparseArray<String>) longSparseStringArrayParcelling.unparcel(source),
- (LongSparseArray<String>) longSparseStringArrayParcelling.unparcel(source));
+ longSparseLongArrayParcelling.unparcel(source),
+ longSparseLongArrayParcelling.unparcel(source),
+ longSparseLongArrayParcelling.unparcel(source),
+ longSparseLongArrayParcelling.unparcel(source),
+ longSparseStringArrayParcelling.unparcel(source),
+ longSparseStringArrayParcelling.unparcel(source));
}
}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/core/java/android/app/NotificationHistory.aidl
similarity index 75%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to core/java/android/app/NotificationHistory.aidl
index d2ec357..8150e74 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/core/java/android/app/NotificationHistory.aidl
@@ -1,11 +1,11 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
+/**
+ * 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
+ * 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,
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package android.app;
-parcelable TimeSignal;
\ No newline at end of file
+parcelable NotificationHistory;
\ No newline at end of file
diff --git a/core/java/android/app/NotificationHistory.java b/core/java/android/app/NotificationHistory.java
new file mode 100644
index 0000000..c35246b
--- /dev/null
+++ b/core/java/android/app/NotificationHistory.java
@@ -0,0 +1,506 @@
+/*
+ * 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.app;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.UserIdInt;
+import android.graphics.drawable.Icon;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * @hide
+ */
+public final class NotificationHistory implements Parcelable {
+
+ /**
+ * A historical notification. Any new fields added here should also be added to
+ * {@link #readNotificationFromParcel} and
+ * {@link #writeNotificationToParcel(HistoricalNotification, Parcel, int)}.
+ */
+ public static final class HistoricalNotification {
+ private String mPackage;
+ private String mChannelName;
+ private String mChannelId;
+ private int mUid;
+ private @UserIdInt int mUserId;
+ private long mPostedTimeMs;
+ private String mTitle;
+ private String mText;
+ private Icon mIcon;
+
+ private HistoricalNotification() {}
+
+ public String getPackage() {
+ return mPackage;
+ }
+
+ public String getChannelName() {
+ return mChannelName;
+ }
+
+ public String getChannelId() {
+ return mChannelId;
+ }
+
+ public int getUid() {
+ return mUid;
+ }
+
+ public int getUserId() {
+ return mUserId;
+ }
+
+ public long getPostedTimeMs() {
+ return mPostedTimeMs;
+ }
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public String getText() {
+ return mText;
+ }
+
+ public Icon getIcon() {
+ return mIcon;
+ }
+
+ public String getKey() {
+ return mPackage + "|" + mUid + "|" + mPostedTimeMs;
+ }
+
+ @Override
+ public String toString() {
+ return "HistoricalNotification{" +
+ "key='" + getKey() + '\'' +
+ ", mChannelName='" + mChannelName + '\'' +
+ ", mChannelId='" + mChannelId + '\'' +
+ ", mUserId=" + mUserId +
+ ", mTitle='" + mTitle + '\'' +
+ ", mText='" + mText + '\'' +
+ ", mIcon=" + mIcon +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ HistoricalNotification that = (HistoricalNotification) o;
+ boolean iconsAreSame = getIcon() == null && that.getIcon() == null
+ || (getIcon() != null && that.getIcon() != null
+ && getIcon().sameAs(that.getIcon()));
+ return getUid() == that.getUid() &&
+ getUserId() == that.getUserId() &&
+ getPostedTimeMs() == that.getPostedTimeMs() &&
+ Objects.equals(getPackage(), that.getPackage()) &&
+ Objects.equals(getChannelName(), that.getChannelName()) &&
+ Objects.equals(getChannelId(), that.getChannelId()) &&
+ Objects.equals(getTitle(), that.getTitle()) &&
+ Objects.equals(getText(), that.getText()) &&
+ iconsAreSame;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getPackage(), getChannelName(), getChannelId(), getUid(),
+ getUserId(),
+ getPostedTimeMs(), getTitle(), getText(), getIcon());
+ }
+
+ public static final class Builder {
+ private String mPackage;
+ private String mChannelName;
+ private String mChannelId;
+ private int mUid;
+ private @UserIdInt int mUserId;
+ private long mPostedTimeMs;
+ private String mTitle;
+ private String mText;
+ private Icon mIcon;
+
+ public Builder() {}
+
+ public Builder setPackage(String aPackage) {
+ mPackage = aPackage;
+ return this;
+ }
+
+ public Builder setChannelName(String channelName) {
+ mChannelName = channelName;
+ return this;
+ }
+
+ public Builder setChannelId(String channelId) {
+ mChannelId = channelId;
+ return this;
+ }
+
+ public Builder setUid(int uid) {
+ mUid = uid;
+ return this;
+ }
+
+ public Builder setUserId(int userId) {
+ mUserId = userId;
+ return this;
+ }
+
+ public Builder setPostedTimeMs(long postedTimeMs) {
+ mPostedTimeMs = postedTimeMs;
+ return this;
+ }
+
+ public Builder setTitle(String title) {
+ mTitle = title;
+ return this;
+ }
+
+ public Builder setText(String text) {
+ mText = text;
+ return this;
+ }
+
+ public Builder setIcon(Icon icon) {
+ mIcon = icon;
+ return this;
+ }
+
+ public HistoricalNotification build() {
+ HistoricalNotification n = new HistoricalNotification();
+ n.mPackage = mPackage;
+ n.mChannelName = mChannelName;
+ n.mChannelId = mChannelId;
+ n.mUid = mUid;
+ n.mUserId = mUserId;
+ n.mPostedTimeMs = mPostedTimeMs;
+ n.mTitle = mTitle;
+ n.mText = mText;
+ n.mIcon = mIcon;
+ return n;
+ }
+ }
+ }
+
+ // Only used when creating the resulting history. Not used for reading/unparceling.
+ private List<HistoricalNotification> mNotificationsToWrite = new ArrayList<>();
+ // ditto
+ private Set<String> mStringsToWrite = new HashSet<>();
+
+ // Mostly used for reading/unparceling events.
+ private Parcel mParcel = null;
+ private int mHistoryCount;
+ private int mIndex = 0;
+
+ // Sorted array of commonly used strings to shrink the size of the parcel. populated from
+ // mStringsToWrite on write and the parcel on read.
+ private String[] mStringPool;
+
+ /**
+ * Construct the iterator from a parcel.
+ */
+ private NotificationHistory(Parcel in) {
+ byte[] bytes = in.readBlob();
+ Parcel data = Parcel.obtain();
+ data.unmarshall(bytes, 0, bytes.length);
+ data.setDataPosition(0);
+ mHistoryCount = data.readInt();
+ mIndex = data.readInt();
+ if (mHistoryCount > 0) {
+ mStringPool = data.createStringArray();
+
+ final int listByteLength = data.readInt();
+ final int positionInParcel = data.readInt();
+ mParcel = Parcel.obtain();
+ mParcel.setDataPosition(0);
+ mParcel.appendFrom(data, data.dataPosition(), listByteLength);
+ mParcel.setDataSize(mParcel.dataPosition());
+ mParcel.setDataPosition(positionInParcel);
+ }
+ }
+
+ /**
+ * Create an empty iterator.
+ */
+ public NotificationHistory() {
+ mHistoryCount = 0;
+ }
+
+ /**
+ * Returns whether or not there are more events to read using {@link #getNextNotification()}.
+ *
+ * @return true if there are more events, false otherwise.
+ */
+ public boolean hasNextNotification() {
+ return mIndex < mHistoryCount;
+ }
+
+ /**
+ * Retrieve the next {@link HistoricalNotification} from the collection and put the
+ * resulting data into {@code notificationOut}.
+ *
+ * @return The next {@link HistoricalNotification} or null if there are no more notifications.
+ */
+ public @Nullable HistoricalNotification getNextNotification() {
+ if (!hasNextNotification()) {
+ return null;
+ }
+
+ HistoricalNotification n = readNotificationFromParcel(mParcel);
+
+ mIndex++;
+ if (!hasNextNotification()) {
+ mParcel.recycle();
+ mParcel = null;
+ }
+ return n;
+ }
+
+ /**
+ * Adds all of the pooled strings that have been read from disk
+ */
+ public void addPooledStrings(@NonNull List<String> strings) {
+ mStringsToWrite.addAll(strings);
+ }
+
+ /**
+ * Builds the pooled strings from pending notifications. Useful if the pooled strings on
+ * disk contains strings that aren't relevant to the notifications in our collection.
+ */
+ public void poolStringsFromNotifications() {
+ mStringsToWrite.clear();
+ for (int i = 0; i < mNotificationsToWrite.size(); i++) {
+ final HistoricalNotification notification = mNotificationsToWrite.get(i);
+ mStringsToWrite.add(notification.getPackage());
+ mStringsToWrite.add(notification.getChannelName());
+ mStringsToWrite.add(notification.getChannelId());
+ }
+ }
+
+ /**
+ * Used when populating a history from disk; adds an historical notification.
+ */
+ public void addNotificationToWrite(@NonNull HistoricalNotification notification) {
+ if (notification == null) {
+ return;
+ }
+ mNotificationsToWrite.add(notification);
+ mHistoryCount++;
+ }
+
+ /**
+ * Removes a package's historical notifications and regenerates the string pool
+ */
+ public void removeNotificationsFromWrite(String packageName) {
+ for (int i = mNotificationsToWrite.size() - 1; i >= 0; i--) {
+ if (packageName.equals(mNotificationsToWrite.get(i).getPackage())) {
+ mNotificationsToWrite.remove(i);
+ }
+ }
+ poolStringsFromNotifications();
+ }
+
+ /**
+ * Gets pooled strings in order to write them to disk
+ */
+ public @NonNull String[] getPooledStringsToWrite() {
+ String[] stringsToWrite = mStringsToWrite.toArray(new String[]{});
+ Arrays.sort(stringsToWrite);
+ return stringsToWrite;
+ }
+
+ /**
+ * Gets the historical notifications in order to write them to disk
+ */
+ public @NonNull List<HistoricalNotification> getNotificationsToWrite() {
+ return mNotificationsToWrite;
+ }
+
+ /**
+ * Gets the number of notifications in the collection
+ */
+ public int getHistoryCount() {
+ return mHistoryCount;
+ }
+
+ private int findStringIndex(String str) {
+ final int index = Arrays.binarySearch(mStringPool, str);
+ if (index < 0) {
+ throw new IllegalStateException("String '" + str + "' is not in the string pool");
+ }
+ return index;
+ }
+
+ /**
+ * Writes a single notification to the parcel. Modify this when updating member variables of
+ * {@link HistoricalNotification}.
+ */
+ private void writeNotificationToParcel(HistoricalNotification notification, Parcel p,
+ int flags) {
+ final int packageIndex;
+ if (notification.mPackage != null) {
+ packageIndex = findStringIndex(notification.mPackage);
+ } else {
+ packageIndex = -1;
+ }
+
+ final int channelNameIndex;
+ if (notification.getChannelName() != null) {
+ channelNameIndex = findStringIndex(notification.getChannelName());
+ } else {
+ channelNameIndex = -1;
+ }
+
+ final int channelIdIndex;
+ if (notification.getChannelId() != null) {
+ channelIdIndex = findStringIndex(notification.getChannelId());
+ } else {
+ channelIdIndex = -1;
+ }
+
+ p.writeInt(packageIndex);
+ p.writeInt(channelNameIndex);
+ p.writeInt(channelIdIndex);
+ p.writeInt(notification.getUid());
+ p.writeInt(notification.getUserId());
+ p.writeLong(notification.getPostedTimeMs());
+ p.writeString(notification.getTitle());
+ p.writeString(notification.getText());
+ notification.getIcon().writeToParcel(p, flags);
+ }
+
+ /**
+ * Reads a single notification from the parcel. Modify this when updating member variables of
+ * {@link HistoricalNotification}.
+ */
+ private HistoricalNotification readNotificationFromParcel(Parcel p) {
+ HistoricalNotification.Builder notificationOut = new HistoricalNotification.Builder();
+ final int packageIndex = p.readInt();
+ if (packageIndex >= 0) {
+ notificationOut.mPackage = mStringPool[packageIndex];
+ } else {
+ notificationOut.mPackage = null;
+ }
+
+ final int channelNameIndex = p.readInt();
+ if (channelNameIndex >= 0) {
+ notificationOut.setChannelName(mStringPool[channelNameIndex]);
+ } else {
+ notificationOut.setChannelName(null);
+ }
+
+ final int channelIdIndex = p.readInt();
+ if (channelIdIndex >= 0) {
+ notificationOut.setChannelId(mStringPool[channelIdIndex]);
+ } else {
+ notificationOut.setChannelId(null);
+ }
+
+ notificationOut.setUid(p.readInt());
+ notificationOut.setUserId(p.readInt());
+ notificationOut.setPostedTimeMs(p.readLong());
+ notificationOut.setTitle(p.readString());
+ notificationOut.setText(p.readString());
+ notificationOut.setIcon(Icon.CREATOR.createFromParcel(p));
+
+ return notificationOut.build();
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ Parcel data = Parcel.obtain();
+ data.writeInt(mHistoryCount);
+ data.writeInt(mIndex);
+ if (mHistoryCount > 0) {
+ mStringPool = getPooledStringsToWrite();
+ data.writeStringArray(mStringPool);
+
+ if (!mNotificationsToWrite.isEmpty()) {
+ // typically system_server to a process
+
+ // Write out the events
+ Parcel p = Parcel.obtain();
+ try {
+ p.setDataPosition(0);
+ for (int i = 0; i < mHistoryCount; i++) {
+ final HistoricalNotification notification = mNotificationsToWrite.get(i);
+ writeNotificationToParcel(notification, p, flags);
+ }
+
+ final int listByteLength = p.dataPosition();
+
+ // Write the total length of the data.
+ data.writeInt(listByteLength);
+
+ // Write our current position into the data.
+ data.writeInt(0);
+
+ // Write the data.
+ data.appendFrom(p, 0, listByteLength);
+ } finally {
+ p.recycle();
+ }
+
+ } else if (mParcel != null) {
+ // typically process to process as mNotificationsToWrite is not populated on
+ // unparcel.
+
+ // Write the total length of the data.
+ data.writeInt(mParcel.dataSize());
+
+ // Write out current position into the data.
+ data.writeInt(mParcel.dataPosition());
+
+ // Write the data.
+ data.appendFrom(mParcel, 0, mParcel.dataSize());
+ } else {
+ throw new IllegalStateException(
+ "Either mParcel or mNotificationsToWrite must not be null");
+ }
+ }
+ // Data can be too large for a transact. Write the data as a Blob, which will be written to
+ // ashmem if too large.
+ dest.writeBlob(data.marshall());
+ }
+
+ public static final @NonNull Creator<NotificationHistory> CREATOR
+ = new Creator<NotificationHistory>() {
+ @Override
+ public NotificationHistory createFromParcel(Parcel source) {
+ return new NotificationHistory(source);
+ }
+
+ @Override
+ public NotificationHistory[] newArray(int size) {
+ return new NotificationHistory[size];
+ }
+ };
+}
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 8350fa1..6a13499 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -125,6 +125,7 @@
import android.nfc.NfcManager;
import android.os.BatteryManager;
import android.os.BatteryStats;
+import android.os.BatteryStatsManager;
import android.os.BugreportManager;
import android.os.Build;
import android.os.DropBoxManager;
@@ -1286,6 +1287,16 @@
return new DynamicSystemManager(
IDynamicSystemService.Stub.asInterface(b));
}});
+ registerService(Context.BATTERY_STATS_SERVICE, BatteryStatsManager.class,
+ new CachedServiceFetcher<BatteryStatsManager>() {
+ @Override
+ public BatteryStatsManager createService(ContextImpl ctx)
+ throws ServiceNotFoundException {
+ IBinder b = ServiceManager.getServiceOrThrow(
+ Context.BATTERY_STATS_SERVICE);
+ return new BatteryStatsManager(
+ IBatteryStats.Stub.asInterface(b));
+ }});
//CHECKSTYLE:ON IndentationCheck
}
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 375a06e..ad671df 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -8351,6 +8351,24 @@
}
/**
+ * Called by device owners to set the user's master location setting.
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with
+ * @param locationEnabled whether location should be enabled or disabled
+ * @throws SecurityException if {@code admin} is not a device owner.
+ */
+ public void setLocationEnabled(@NonNull ComponentName admin, boolean locationEnabled) {
+ throwIfParentInstance("setLocationEnabled");
+ if (mService != null) {
+ try {
+ mService.setLocationEnabled(admin, locationEnabled);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+ }
+
+ /**
* Called by profile or device owners to update {@link android.provider.Settings.Secure}
* settings. Validation that the value of the setting is in the correct form for the setting
* type should be performed by the caller.
@@ -8379,6 +8397,11 @@
* all users.
* </strong>
*
+ * <strong>Note: Starting from Android R, apps should no longer call this method with the
+ * setting {@link android.provider.Settings.Secure#LOCATION_MODE}, which is deprecated. Instead,
+ * device owners should call {@link #setLocationEnabled(ComponentName, boolean)}.
+ * </strong>
+ *
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @param setting The name of the setting to update.
* @param value The value to update the setting to.
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 7d2c54e..6b50522 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -258,6 +258,8 @@
void setSystemSetting(in ComponentName who, in String setting, in String value);
void setSecureSetting(in ComponentName who, in String setting, in String value);
+ void setLocationEnabled(in ComponentName who, boolean locationEnabled);
+
boolean setTime(in ComponentName who, long millis);
boolean setTimeZone(in ComponentName who, String timeZone);
diff --git a/core/java/android/app/admin/PasswordMetrics.java b/core/java/android/app/admin/PasswordMetrics.java
index d9bfde5..0ecfca7 100644
--- a/core/java/android/app/admin/PasswordMetrics.java
+++ b/core/java/android/app/admin/PasswordMetrics.java
@@ -73,6 +73,11 @@
// consider it a complex PIN/password.
public static final int MAX_ALLOWED_SEQUENCE = 3;
+ // One of CREDENTIAL_TYPE_NONE, CREDENTIAL_TYPE_PATTERN or CREDENTIAL_TYPE_PASSWORD.
+ // Note that this class still uses CREDENTIAL_TYPE_PASSWORD to represent both numeric PIN
+ // and alphabetic password. This is OK as long as this definition is only used internally,
+ // and the value never gets mixed up with credential types from other parts of the framework.
+ // TODO: fix this (ideally after we move logic to PasswordPolicy)
public @CredentialType int credType;
// Fields below only make sense when credType is PASSWORD.
public int length = 0;
@@ -161,24 +166,26 @@
public static final @NonNull Parcelable.Creator<PasswordMetrics> CREATOR
= new Parcelable.Creator<PasswordMetrics>() {
- public PasswordMetrics createFromParcel(Parcel in) {
- int credType = in.readInt();
- int length = in.readInt();
- int letters = in.readInt();
- int upperCase = in.readInt();
- int lowerCase = in.readInt();
- int numeric = in.readInt();
- int symbols = in.readInt();
- int nonLetter = in.readInt();
- int nonNumeric = in.readInt();
- int seqLength = in.readInt();
- return new PasswordMetrics(credType, length, letters, upperCase, lowerCase, numeric,
- symbols, nonLetter, nonNumeric, seqLength);
- }
+ @Override
+ public PasswordMetrics createFromParcel(Parcel in) {
+ int credType = in.readInt();
+ int length = in.readInt();
+ int letters = in.readInt();
+ int upperCase = in.readInt();
+ int lowerCase = in.readInt();
+ int numeric = in.readInt();
+ int symbols = in.readInt();
+ int nonLetter = in.readInt();
+ int nonNumeric = in.readInt();
+ int seqLength = in.readInt();
+ return new PasswordMetrics(credType, length, letters, upperCase, lowerCase,
+ numeric, symbols, nonLetter, nonNumeric, seqLength);
+ }
- public PasswordMetrics[] newArray(int size) {
- return new PasswordMetrics[size];
- }
+ @Override
+ public PasswordMetrics[] newArray(int size) {
+ return new PasswordMetrics[size];
+ }
};
/**
@@ -189,7 +196,7 @@
* {@link com.android.internal.widget.LockPatternUtils#CREDENTIAL_TYPE_PASSWORD}.
*/
public static PasswordMetrics computeForCredential(LockscreenCredential credential) {
- if (credential.isPassword()) {
+ if (credential.isPassword() || credential.isPin()) {
return PasswordMetrics.computeForPassword(credential.getCredential());
} else if (credential.isPattern()) {
return new PasswordMetrics(CREDENTIAL_TYPE_PATTERN);
diff --git a/core/java/android/app/contentsuggestions/ContentSuggestionsManager.java b/core/java/android/app/contentsuggestions/ContentSuggestionsManager.java
index 1bb81b1..1e6ab41 100644
--- a/core/java/android/app/contentsuggestions/ContentSuggestionsManager.java
+++ b/core/java/android/app/contentsuggestions/ContentSuggestionsManager.java
@@ -45,6 +45,17 @@
*/
@SystemApi
public final class ContentSuggestionsManager {
+ /**
+ * Key into the extras Bundle passed to {@link #provideContextImage(int, Bundle)}.
+ * This can be used to provide the bitmap to
+ * {@link android.service.contentsuggestions.ContentSuggestionsService}.
+ * The value must be a {@link android.graphics.Bitmap} with the
+ * config {@link android.graphics.Bitmap.Config.HARDWARE}.
+ *
+ * @hide
+ */
+ public static final String EXTRA_BITMAP = "android.contentsuggestions.extra.BITMAP";
+
private static final String TAG = ContentSuggestionsManager.class.getSimpleName();
/**
@@ -70,7 +81,7 @@
* system content suggestions service.
*
* @param taskId of the task to snapshot.
- * @param imageContextRequestExtras sent with with request to provide implementation specific
+ * @param imageContextRequestExtras sent with request to provide implementation specific
* extra information.
*/
public void provideContextImage(
diff --git a/core/java/android/app/timedetector/ITimeDetectorService.aidl b/core/java/android/app/timedetector/ITimeDetectorService.aidl
index f624446..ddc4932 100644
--- a/core/java/android/app/timedetector/ITimeDetectorService.aidl
+++ b/core/java/android/app/timedetector/ITimeDetectorService.aidl
@@ -16,10 +16,10 @@
package android.app.timedetector;
-import android.app.timedetector.TimeSignal;
+import android.app.timedetector.PhoneTimeSuggestion;
/**
- * System private API to comunicate with time detector service.
+ * System private API to communicate with time detector service.
*
* <p>Used by parts of the Android system with signals associated with the device's time to provide
* information to the Time Detector Service.
@@ -32,5 +32,5 @@
* {@hide}
*/
interface ITimeDetectorService {
- void suggestTime(in TimeSignal timeSignal);
+ void suggestPhoneTime(in PhoneTimeSuggestion timeSuggestion);
}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/core/java/android/app/timedetector/PhoneTimeSuggestion.aidl
similarity index 94%
rename from core/java/android/app/timedetector/TimeSignal.aidl
rename to core/java/android/app/timedetector/PhoneTimeSuggestion.aidl
index d2ec357..f5e2405 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/core/java/android/app/timedetector/PhoneTimeSuggestion.aidl
@@ -16,4 +16,4 @@
package android.app.timedetector;
-parcelable TimeSignal;
\ No newline at end of file
+parcelable PhoneTimeSuggestion;
diff --git a/core/java/android/app/timedetector/PhoneTimeSuggestion.java b/core/java/android/app/timedetector/PhoneTimeSuggestion.java
new file mode 100644
index 0000000..475a4aa
--- /dev/null
+++ b/core/java/android/app/timedetector/PhoneTimeSuggestion.java
@@ -0,0 +1,137 @@
+/*
+ * 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.app.timedetector;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.TimestampedValue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A time signal from a telephony source. The value consists of the number of milliseconds elapsed
+ * since 1/1/1970 00:00:00 UTC and the time according to the elapsed realtime clock when that number
+ * was established. The elapsed realtime clock is considered accurate but volatile, so time signals
+ * must not be persisted across device resets.
+ *
+ * @hide
+ */
+public final class PhoneTimeSuggestion implements Parcelable {
+
+ public static final @NonNull Parcelable.Creator<PhoneTimeSuggestion> CREATOR =
+ new Parcelable.Creator<PhoneTimeSuggestion>() {
+ public PhoneTimeSuggestion createFromParcel(Parcel in) {
+ return PhoneTimeSuggestion.createFromParcel(in);
+ }
+
+ public PhoneTimeSuggestion[] newArray(int size) {
+ return new PhoneTimeSuggestion[size];
+ }
+ };
+
+ private final int mPhoneId;
+ @NonNull
+ private final TimestampedValue<Long> mUtcTime;
+ @Nullable
+ private ArrayList<String> mDebugInfo;
+
+ public PhoneTimeSuggestion(int phoneId, @NonNull TimestampedValue<Long> utcTime) {
+ mPhoneId = phoneId;
+ mUtcTime = Objects.requireNonNull(utcTime);
+ }
+
+ private static PhoneTimeSuggestion createFromParcel(Parcel in) {
+ int phoneId = in.readInt();
+ TimestampedValue<Long> utcTime = in.readParcelable(null /* classLoader */);
+ PhoneTimeSuggestion suggestion = new PhoneTimeSuggestion(phoneId, utcTime);
+ @SuppressWarnings("unchecked")
+ ArrayList<String> debugInfo = (ArrayList<String>) in.readArrayList(null /* classLoader */);
+ suggestion.mDebugInfo = debugInfo;
+ return suggestion;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeInt(mPhoneId);
+ dest.writeParcelable(mUtcTime, 0);
+ dest.writeList(mDebugInfo);
+ }
+
+ public int getPhoneId() {
+ return mPhoneId;
+ }
+
+ @NonNull
+ public TimestampedValue<Long> getUtcTime() {
+ return mUtcTime;
+ }
+
+ @NonNull
+ public List<String> getDebugInfo() {
+ return Collections.unmodifiableList(mDebugInfo);
+ }
+
+ /**
+ * Associates information with the instance that can be useful for debugging / logging. The
+ * information is present in {@link #toString()} but is not considered for
+ * {@link #equals(Object)} and {@link #hashCode()}.
+ */
+ public void addDebugInfo(String... debugInfos) {
+ if (mDebugInfo == null) {
+ mDebugInfo = new ArrayList<>();
+ }
+ mDebugInfo.addAll(Arrays.asList(debugInfos));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PhoneTimeSuggestion that = (PhoneTimeSuggestion) o;
+ return mPhoneId == that.mPhoneId
+ && Objects.equals(mUtcTime, that.mUtcTime);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mPhoneId, mUtcTime);
+ }
+
+ @Override
+ public String toString() {
+ return "PhoneTimeSuggestion{"
+ + "mPhoneId='" + mPhoneId + '\''
+ + ", mUtcTime=" + mUtcTime
+ + ", mDebugInfo=" + mDebugInfo
+ + '}';
+ }
+}
diff --git a/core/java/android/app/timedetector/TimeDetector.java b/core/java/android/app/timedetector/TimeDetector.java
index 052050d..334e958 100644
--- a/core/java/android/app/timedetector/TimeDetector.java
+++ b/core/java/android/app/timedetector/TimeDetector.java
@@ -45,12 +45,12 @@
* signals are available such as those that come from more reliable sources or were
* determined more recently.
*/
- public void suggestTime(@NonNull TimeSignal timeSignal) {
+ public void suggestPhoneTime(@NonNull PhoneTimeSuggestion timeSuggestion) {
if (DEBUG) {
- Log.d(TAG, "suggestTime called: " + timeSignal);
+ Log.d(TAG, "suggestPhoneTime called: " + timeSuggestion);
}
try {
- mITimeDetectorService.suggestTime(timeSignal);
+ mITimeDetectorService.suggestPhoneTime(timeSuggestion);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/app/timedetector/TimeSignal.java b/core/java/android/app/timedetector/TimeSignal.java
deleted file mode 100644
index b494260..0000000
--- a/core/java/android/app/timedetector/TimeSignal.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2018 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.app.timedetector;
-
-import android.annotation.NonNull;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.TimestampedValue;
-
-import java.util.Objects;
-
-/**
- * A time signal from a named source. The value consists of the number of milliseconds elapsed since
- * 1/1/1970 00:00:00 UTC and the time according to the elapsed realtime clock when that number was
- * established. The elapsed realtime clock is considered accurate but volatile, so time signals
- * must not be persisted across device resets.
- *
- * @hide
- */
-public final class TimeSignal implements Parcelable {
-
- public static final @android.annotation.NonNull Parcelable.Creator<TimeSignal> CREATOR =
- new Parcelable.Creator<TimeSignal>() {
- public TimeSignal createFromParcel(Parcel in) {
- return TimeSignal.createFromParcel(in);
- }
-
- public TimeSignal[] newArray(int size) {
- return new TimeSignal[size];
- }
- };
-
- public static final String SOURCE_ID_NITZ = "nitz";
-
- private final String mSourceId;
- private final TimestampedValue<Long> mUtcTime;
-
- public TimeSignal(String sourceId, TimestampedValue<Long> utcTime) {
- mSourceId = Objects.requireNonNull(sourceId);
- mUtcTime = Objects.requireNonNull(utcTime);
- }
-
- private static TimeSignal createFromParcel(Parcel in) {
- String sourceId = in.readString();
- TimestampedValue<Long> utcTime = in.readParcelable(null /* classLoader */);
- return new TimeSignal(sourceId, utcTime);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(@NonNull Parcel dest, int flags) {
- dest.writeString(mSourceId);
- dest.writeParcelable(mUtcTime, 0);
- }
-
- @NonNull
- public String getSourceId() {
- return mSourceId;
- }
-
- @NonNull
- public TimestampedValue<Long> getUtcTime() {
- return mUtcTime;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- TimeSignal that = (TimeSignal) o;
- return Objects.equals(mSourceId, that.mSourceId)
- && Objects.equals(mUtcTime, that.mUtcTime);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mSourceId, mUtcTime);
- }
-
- @Override
- public String toString() {
- return "TimeSignal{"
- + "mSourceId='" + mSourceId + '\''
- + ", mUtcTime=" + mUtcTime
- + '}';
- }
-}
diff --git a/core/java/android/bluetooth/le/ScanRecord.java b/core/java/android/bluetooth/le/ScanRecord.java
index 30868bf..97e3f52 100644
--- a/core/java/android/bluetooth/le/ScanRecord.java
+++ b/core/java/android/bluetooth/le/ScanRecord.java
@@ -154,7 +154,7 @@
}
/**
- * Returns the local name of the BLE device. The is a UTF-8 encoded string.
+ * Returns the local name of the BLE device. This is a UTF-8 encoded string.
*/
@Nullable
public String getDeviceName() {
diff --git a/core/java/android/companion/CompanionDeviceManager.java b/core/java/android/companion/CompanionDeviceManager.java
index cb35357..9cb73f9 100644
--- a/core/java/android/companion/CompanionDeviceManager.java
+++ b/core/java/android/companion/CompanionDeviceManager.java
@@ -42,11 +42,15 @@
/**
* System level service for managing companion devices
*
+ * See <a href="{@docRoot}guide/topics/connectivity/companion-device-pairing">this guide</a>
+ * for a usage example.
+ *
* <p>To obtain an instance call {@link Context#getSystemService}({@link
* Context#COMPANION_DEVICE_SERVICE}) Then, call {@link #associate(AssociationRequest,
* Callback, Handler)} to initiate the flow of associating current package with a
* device selected by user.</p>
*
+ * @see CompanionDeviceManager#associate
* @see AssociationRequest
*/
@SystemService(Context.COMPANION_DEVICE_SERVICE)
diff --git a/core/java/android/companion/WifiDeviceFilter.java b/core/java/android/companion/WifiDeviceFilter.java
index 62098d5..58bf874 100644
--- a/core/java/android/companion/WifiDeviceFilter.java
+++ b/core/java/android/companion/WifiDeviceFilter.java
@@ -17,17 +17,18 @@
package android.companion;
import static android.companion.BluetoothDeviceFilterUtils.getDeviceDisplayNameInternal;
-import static android.companion.BluetoothDeviceFilterUtils.patternFromString;
-import static android.companion.BluetoothDeviceFilterUtils.patternToString;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.ScanFilter;
+import android.net.MacAddress;
import android.net.wifi.ScanResult;
import android.os.Parcel;
-import android.provider.OneTimeUseBuilder;
+import android.os.Parcelable;
+
+import com.android.internal.util.DataClass;
+import com.android.internal.util.Parcelling;
import java.util.Objects;
import java.util.regex.Pattern;
@@ -37,30 +38,38 @@
*
* @see ScanFilter
*/
+@DataClass(
+ genParcelable = true,
+ genAidl = false,
+ genBuilder = true,
+ genEqualsHashCode = true,
+ genHiddenGetters = true)
public final class WifiDeviceFilter implements DeviceFilter<ScanResult> {
- private final Pattern mNamePattern;
+ /**
+ * If set, only devices with {@link BluetoothDevice#getName name} matching the given regular
+ * expression will be shown
+ */
+ @DataClass.ParcelWith(Parcelling.BuiltIn.ForPattern.class)
+ private @Nullable Pattern mNamePattern = null;
- private WifiDeviceFilter(Pattern namePattern) {
- mNamePattern = namePattern;
- }
+ /**
+ * If set, only devices with BSSID matching the given one will be shown
+ */
+ private @Nullable MacAddress mBssid = null;
- @SuppressLint("ParcelClassLoader")
- private WifiDeviceFilter(Parcel in) {
- this(patternFromString(in.readString()));
- }
-
- /** @hide */
- @Nullable
- public Pattern getNamePattern() {
- return mNamePattern;
- }
-
+ /**
+ * If set, only bits at positions set in this mask, will be compared to the given
+ * {@link Builder#setBssid BSSID} filter.
+ */
+ private @NonNull MacAddress mBssidMask = MacAddress.BROADCAST_ADDRESS;
/** @hide */
@Override
public boolean matches(ScanResult device) {
- return BluetoothDeviceFilterUtils.matchesName(getNamePattern(), device);
+ return BluetoothDeviceFilterUtils.matchesName(getNamePattern(), device)
+ && (mBssid == null
+ || MacAddress.fromString(device.BSSID).matches(mBssid, mBssidMask));
}
/** @hide */
@@ -75,65 +84,249 @@
return MEDIUM_TYPE_WIFI;
}
+
+
+ // Code below generated by codegen v1.0.11.
+ //
+ // DO NOT MODIFY!
+ // CHECKSTYLE:OFF Generated code
+ //
+ // To regenerate run:
+ // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/companion/WifiDeviceFilter.java
+ //
+ // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
+ // Settings > Editor > Code Style > Formatter Control
+ //@formatter:off
+
+
+ @DataClass.Generated.Member
+ /* package-private */ WifiDeviceFilter(
+ @Nullable Pattern namePattern,
+ @Nullable MacAddress bssid,
+ @NonNull MacAddress bssidMask) {
+ this.mNamePattern = namePattern;
+ this.mBssid = bssid;
+ this.mBssidMask = bssidMask;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mBssidMask);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ /**
+ * If set, only devices with {@link BluetoothDevice#getName name} matching the given regular
+ * expression will be shown
+ *
+ * @hide
+ */
+ @DataClass.Generated.Member
+ public @Nullable Pattern getNamePattern() {
+ return mNamePattern;
+ }
+
+ /**
+ * If set, only devices with BSSID matching the given one will be shown
+ *
+ * @hide
+ */
+ @DataClass.Generated.Member
+ public @Nullable MacAddress getBssid() {
+ return mBssid;
+ }
+
+ /**
+ * If set, only bits at positions set in this mask, will be compared to the given
+ * {@link Builder#setBssid BSSID} filter.
+ *
+ * @hide
+ */
+ @DataClass.Generated.Member
+ public @NonNull MacAddress getBssidMask() {
+ return mBssidMask;
+ }
+
@Override
- public boolean equals(Object o) {
+ @DataClass.Generated.Member
+ public boolean equals(@Nullable Object o) {
+ // You can override field equality logic by defining either of the methods like:
+ // boolean fieldNameEquals(WifiDeviceFilter other) { ... }
+ // boolean fieldNameEquals(FieldType otherValue) { ... }
+
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
+ @SuppressWarnings("unchecked")
WifiDeviceFilter that = (WifiDeviceFilter) o;
- return Objects.equals(mNamePattern, that.mNamePattern);
+ //noinspection PointlessBooleanExpression
+ return true
+ && Objects.equals(mNamePattern, that.mNamePattern)
+ && Objects.equals(mBssid, that.mBssid)
+ && Objects.equals(mBssidMask, that.mBssidMask);
}
@Override
+ @DataClass.Generated.Member
public int hashCode() {
- return Objects.hash(mNamePattern);
+ // You can override field hashCode logic by defining methods like:
+ // int fieldNameHashCode() { ... }
+
+ int _hash = 1;
+ _hash = 31 * _hash + Objects.hashCode(mNamePattern);
+ _hash = 31 * _hash + Objects.hashCode(mBssid);
+ _hash = 31 * _hash + Objects.hashCode(mBssidMask);
+ return _hash;
}
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(patternToString(getNamePattern()));
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- public static final @android.annotation.NonNull Creator<WifiDeviceFilter> CREATOR
- = new Creator<WifiDeviceFilter>() {
- @Override
- public WifiDeviceFilter createFromParcel(Parcel in) {
- return new WifiDeviceFilter(in);
+ @DataClass.Generated.Member
+ static Parcelling<Pattern> sParcellingForNamePattern =
+ Parcelling.Cache.get(
+ Parcelling.BuiltIn.ForPattern.class);
+ static {
+ if (sParcellingForNamePattern == null) {
+ sParcellingForNamePattern = Parcelling.Cache.put(
+ new Parcelling.BuiltIn.ForPattern());
}
+ }
+ @Override
+ @DataClass.Generated.Member
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ // You can override field parcelling by defining methods like:
+ // void parcelFieldName(Parcel dest, int flags) { ... }
+
+ byte flg = 0;
+ if (mNamePattern != null) flg |= 0x1;
+ if (mBssid != null) flg |= 0x2;
+ dest.writeByte(flg);
+ sParcellingForNamePattern.parcel(mNamePattern, dest, flags);
+ if (mBssid != null) dest.writeTypedObject(mBssid, flags);
+ dest.writeTypedObject(mBssidMask, flags);
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public int describeContents() { return 0; }
+
+ /** @hide */
+ @SuppressWarnings({"unchecked", "RedundantCast"})
+ @DataClass.Generated.Member
+ /* package-private */ WifiDeviceFilter(@NonNull Parcel in) {
+ // You can override field unparcelling by defining methods like:
+ // static FieldType unparcelFieldName(Parcel in) { ... }
+
+ byte flg = in.readByte();
+ Pattern namePattern = sParcellingForNamePattern.unparcel(in);
+ MacAddress bssid = (flg & 0x2) == 0 ? null : (MacAddress) in.readTypedObject(MacAddress.CREATOR);
+ MacAddress bssidMask = (MacAddress) in.readTypedObject(MacAddress.CREATOR);
+
+ this.mNamePattern = namePattern;
+ this.mBssid = bssid;
+ this.mBssidMask = bssidMask;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mBssidMask);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ @DataClass.Generated.Member
+ public static final @NonNull Parcelable.Creator<WifiDeviceFilter> CREATOR
+ = new Parcelable.Creator<WifiDeviceFilter>() {
@Override
public WifiDeviceFilter[] newArray(int size) {
return new WifiDeviceFilter[size];
}
+
+ @Override
+ public WifiDeviceFilter createFromParcel(@NonNull Parcel in) {
+ return new WifiDeviceFilter(in);
+ }
};
/**
- * Builder for {@link WifiDeviceFilter}
+ * A builder for {@link WifiDeviceFilter}
*/
- public static final class Builder extends OneTimeUseBuilder<WifiDeviceFilter> {
- private Pattern mNamePattern;
+ @SuppressWarnings("WeakerAccess")
+ @DataClass.Generated.Member
+ public static final class Builder {
+
+ private @Nullable Pattern mNamePattern;
+ private @Nullable MacAddress mBssid;
+ private @NonNull MacAddress mBssidMask;
+
+ private long mBuilderFieldsSet = 0L;
+
+ public Builder() {
+ }
/**
- * @param regex if set, only devices with {@link BluetoothDevice#getName name} matching the
- * given regular expression will be shown
- * @return self for chaining
+ * If set, only devices with {@link BluetoothDevice#getName name} matching the given regular
+ * expression will be shown
*/
- public Builder setNamePattern(@Nullable Pattern regex) {
+ @DataClass.Generated.Member
+ public @NonNull Builder setNamePattern(@Nullable Pattern value) {
checkNotUsed();
- mNamePattern = regex;
+ mBuilderFieldsSet |= 0x1;
+ mNamePattern = value;
return this;
}
- /** @inheritDoc */
- @Override
- @NonNull
- public WifiDeviceFilter build() {
- markUsed();
- return new WifiDeviceFilter(mNamePattern);
+ /**
+ * If set, only devices with BSSID matching the given one will be shown
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setBssid(@Nullable MacAddress value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x2;
+ mBssid = value;
+ return this;
+ }
+
+ /**
+ * If set, only bits at positions set in this mask, will be compared to the given
+ * {@link Builder#setBssid BSSID} filter.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setBssidMask(@NonNull MacAddress value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x4;
+ mBssidMask = value;
+ return this;
+ }
+
+ /** Builds the instance. This builder should not be touched after calling this! */
+ public @NonNull WifiDeviceFilter build() {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x8; // Mark builder used
+
+ if ((mBuilderFieldsSet & 0x1) == 0) {
+ mNamePattern = null;
+ }
+ if ((mBuilderFieldsSet & 0x2) == 0) {
+ mBssid = null;
+ }
+ if ((mBuilderFieldsSet & 0x4) == 0) {
+ mBssidMask = MacAddress.BROADCAST_ADDRESS;
+ }
+ WifiDeviceFilter o = new WifiDeviceFilter(
+ mNamePattern,
+ mBssid,
+ mBssidMask);
+ return o;
+ }
+
+ private void checkNotUsed() {
+ if ((mBuilderFieldsSet & 0x8) != 0) {
+ throw new IllegalStateException(
+ "This Builder should not be reused. Use a new Builder instance instead");
+ }
}
}
+
+ @DataClass.Generated(
+ time = 1571960300742L,
+ codegenVersion = "1.0.11",
+ sourceFile = "frameworks/base/core/java/android/companion/WifiDeviceFilter.java",
+ inputSignatures = "private @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForPattern.class) @android.annotation.Nullable java.util.regex.Pattern mNamePattern\nprivate @android.annotation.Nullable android.net.MacAddress mBssid\nprivate @android.annotation.NonNull android.net.MacAddress mBssidMask\npublic @java.lang.Override boolean matches(android.net.wifi.ScanResult)\npublic @java.lang.Override java.lang.String getDeviceDisplayName(android.net.wifi.ScanResult)\npublic @java.lang.Override int getMediumType()\nclass WifiDeviceFilter extends java.lang.Object implements [android.companion.DeviceFilter<android.net.wifi.ScanResult>]\n@com.android.internal.util.DataClass(genParcelable=true, genAidl=false, genBuilder=true, genEqualsHashCode=true, genHiddenGetters=true)")
+ @Deprecated
+ private void __metadata() {}
+
}
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java
index fdef2a1..b6a0a56 100644
--- a/core/java/android/content/ClipData.java
+++ b/core/java/android/content/ClipData.java
@@ -1069,9 +1069,8 @@
if (!first) {
b.append(' ');
}
- mItems.get(0).toShortString(b);
- if (mItems.size() > 1) {
- b.append(" ...");
+ for (int i=0; i<mItems.size(); i++) {
+ b.append("{...}");
}
}
}
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 02b6b3e..7de8793 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -834,6 +834,23 @@
}
/**
+ * Retrieves a Non-Nullable Context this provider is running in, this is intended to be called
+ * after {@link #onCreate}. When called before context was created, an IllegalStateException
+ * will be thrown.
+ * <p>
+ * Note A provider must be declared in the manifest and created automatically by the system,
+ * and context is only available after {@link #onCreate} is called.
+ */
+ @NonNull
+ public final Context requireContext() {
+ final Context ctx = getContext();
+ if (ctx == null) {
+ throw new IllegalStateException("Cannot find context from the provider.");
+ }
+ return ctx;
+ }
+
+ /**
* Set the calling package, returning the current value (or {@code null})
* which can be used later to restore the previous state.
*/
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 9a9fc89..fd061d0 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4745,6 +4745,14 @@
public static final String TELEPHONY_REGISTRY_SERVICE = "telephony_registry";
/**
+ * Use with {@link #getSystemService(String)} to retrieve an
+ * {@link android.os.BatteryStatsManager}.
+ * @hide
+ */
+ @SystemApi
+ public static final String BATTERY_STATS_SERVICE = "batterystats";
+
+ /**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.
*
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 2ecfc8e..4e7e713 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2678,6 +2678,9 @@
* that application is first launched (that is the first time it is moved
* out of the stopped state). The data contains the name of the package.
*
+ * <p>When the application is first launched, the application itself doesn't receive this
+ * broadcast.</p>
+ *
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
diff --git a/core/java/android/content/pm/VerificationParams.java b/core/java/android/content/pm/VerificationParams.java
deleted file mode 100644
index f072167..0000000
--- a/core/java/android/content/pm/VerificationParams.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2012 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.content.pm;
-
-import android.net.Uri;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Represents verification parameters used to verify packages to be installed.
- *
- * @deprecated callers should migrate to {@link PackageInstaller}.
- * @hide
- */
-@Deprecated
-public class VerificationParams implements Parcelable {
- /** A constant used to indicate that a uid value is not present. */
- public static final int NO_UID = -1;
-
- /** What we print out first when toString() is called. */
- private static final String TO_STRING_PREFIX = "VerificationParams{";
-
- /** The location of the supplementary verification file. */
- private final Uri mVerificationURI;
-
- /** URI referencing where the package was downloaded from. */
- private final Uri mOriginatingURI;
-
- /** HTTP referrer URI associated with the originatingURI. */
- private final Uri mReferrer;
-
- /** UID of the application that the install request originated from. */
- private final int mOriginatingUid;
-
- /** UID of application requesting the install */
- private int mInstallerUid;
-
- /**
- * Creates verification specifications for installing with application verification.
- *
- * @param verificationURI The location of the supplementary verification
- * file. This can be a 'file:' or a 'content:' URI. May be {@code null}.
- * @param originatingURI URI referencing where the package was downloaded
- * from. May be {@code null}.
- * @param referrer HTTP referrer URI associated with the originatingURI.
- * May be {@code null}.
- * @param originatingUid UID of the application that the install request originated
- * from, or NO_UID if not present
- */
- public VerificationParams(Uri verificationURI, Uri originatingURI, Uri referrer,
- int originatingUid) {
- mVerificationURI = verificationURI;
- mOriginatingURI = originatingURI;
- mReferrer = referrer;
- mOriginatingUid = originatingUid;
- mInstallerUid = NO_UID;
- }
-
- public Uri getVerificationURI() {
- return mVerificationURI;
- }
-
- public Uri getOriginatingURI() {
- return mOriginatingURI;
- }
-
- public Uri getReferrer() {
- return mReferrer;
- }
-
- /** return NO_UID if not available */
- public int getOriginatingUid() {
- return mOriginatingUid;
- }
-
- /** @return NO_UID when not set */
- public int getInstallerUid() {
- return mInstallerUid;
- }
-
- public void setInstallerUid(int uid) {
- mInstallerUid = uid;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof VerificationParams)) {
- return false;
- }
-
- final VerificationParams other = (VerificationParams) o;
-
- if (mVerificationURI == null) {
- if (other.mVerificationURI != null) {
- return false;
- }
- } else if (!mVerificationURI.equals(other.mVerificationURI)) {
- return false;
- }
-
- if (mOriginatingURI == null) {
- if (other.mOriginatingURI != null) {
- return false;
- }
- } else if (!mOriginatingURI.equals(other.mOriginatingURI)) {
- return false;
- }
-
- if (mReferrer == null) {
- if (other.mReferrer != null) {
- return false;
- }
- } else if (!mReferrer.equals(other.mReferrer)) {
- return false;
- }
-
- if (mOriginatingUid != other.mOriginatingUid) {
- return false;
- }
-
- if (mInstallerUid != other.mInstallerUid) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hash = 3;
-
- hash += 5 * (mVerificationURI == null ? 1 : mVerificationURI.hashCode());
- hash += 7 * (mOriginatingURI == null ? 1 : mOriginatingURI.hashCode());
- hash += 11 * (mReferrer == null ? 1 : mReferrer.hashCode());
- hash += 13 * mOriginatingUid;
- hash += 17 * mInstallerUid;
-
- return hash;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder(TO_STRING_PREFIX);
-
- sb.append("mVerificationURI=");
- sb.append(mVerificationURI.toString());
- sb.append(",mOriginatingURI=");
- sb.append(mOriginatingURI.toString());
- sb.append(",mReferrer=");
- sb.append(mReferrer.toString());
- sb.append(",mOriginatingUid=");
- sb.append(mOriginatingUid);
- sb.append(",mInstallerUid=");
- sb.append(mInstallerUid);
- sb.append('}');
-
- return sb.toString();
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeParcelable(mVerificationURI, 0);
- dest.writeParcelable(mOriginatingURI, 0);
- dest.writeParcelable(mReferrer, 0);
- dest.writeInt(mOriginatingUid);
- dest.writeInt(mInstallerUid);
- }
-
-
- private VerificationParams(Parcel source) {
- mVerificationURI = source.readParcelable(Uri.class.getClassLoader());
- mOriginatingURI = source.readParcelable(Uri.class.getClassLoader());
- mReferrer = source.readParcelable(Uri.class.getClassLoader());
- mOriginatingUid = source.readInt();
- mInstallerUid = source.readInt();
- }
-
- public static final @android.annotation.NonNull Parcelable.Creator<VerificationParams> CREATOR =
- new Parcelable.Creator<VerificationParams>() {
- public VerificationParams createFromParcel(Parcel source) {
- return new VerificationParams(source);
- }
-
- public VerificationParams[] newArray(int size) {
- return new VerificationParams[size];
- }
- };
-}
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index ac1cbd4..578d086 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -66,7 +66,6 @@
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.lang.annotation.Retention;
@@ -2641,75 +2640,4 @@
// For persistence, we don't care about assetsSeq and WindowConfiguration, so do not read it
// out.
}
-
-
- /**
- * Writes the Configuration's member fields as attributes into the XmlSerializer.
- * The serializer is expected to have already started a tag so that attributes can be
- * immediately written.
- *
- * @param xml The serializer to which to write the attributes.
- * @param config The Configuration whose member fields to write.
- * {@hide}
- */
- public static void writeXmlAttrs(XmlSerializer xml, Configuration config) throws IOException {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_FONT_SCALE,
- Float.floatToIntBits(config.fontScale));
- if (config.mcc != 0) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_MCC, config.mcc);
- }
- if (config.mnc != 0) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_MNC, config.mnc);
- }
- config.fixUpLocaleList();
- if (!config.mLocaleList.isEmpty()) {
- XmlUtils.writeStringAttribute(xml, XML_ATTR_LOCALES, config.mLocaleList.toLanguageTags());
- }
- if (config.touchscreen != TOUCHSCREEN_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_TOUCHSCREEN, config.touchscreen);
- }
- if (config.keyboard != KEYBOARD_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_KEYBOARD, config.keyboard);
- }
- if (config.keyboardHidden != KEYBOARDHIDDEN_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_KEYBOARD_HIDDEN, config.keyboardHidden);
- }
- if (config.hardKeyboardHidden != HARDKEYBOARDHIDDEN_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_HARD_KEYBOARD_HIDDEN,
- config.hardKeyboardHidden);
- }
- if (config.navigation != NAVIGATION_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_NAVIGATION, config.navigation);
- }
- if (config.navigationHidden != NAVIGATIONHIDDEN_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_NAVIGATION_HIDDEN, config.navigationHidden);
- }
- if (config.orientation != ORIENTATION_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_ORIENTATION, config.orientation);
- }
- if (config.screenLayout != SCREENLAYOUT_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_SCREEN_LAYOUT, config.screenLayout);
- }
- if (config.colorMode != COLOR_MODE_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_COLOR_MODE, config.colorMode);
- }
- if (config.uiMode != 0) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_UI_MODE, config.uiMode);
- }
- if (config.screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_SCREEN_WIDTH, config.screenWidthDp);
- }
- if (config.screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_SCREEN_HEIGHT, config.screenHeightDp);
- }
- if (config.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_SMALLEST_WIDTH, config.smallestScreenWidthDp);
- }
- if (config.densityDpi != DENSITY_DPI_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_DENSITY, config.densityDpi);
- }
-
- // For persistence, we do not care about assetsSeq and window configuration, so do not write
- // it out.
- }
}
diff --git a/core/java/android/hardware/biometrics/BiometricAuthenticator.java b/core/java/android/hardware/biometrics/BiometricAuthenticator.java
index 0ec812f..698876b 100644
--- a/core/java/android/hardware/biometrics/BiometricAuthenticator.java
+++ b/core/java/android/hardware/biometrics/BiometricAuthenticator.java
@@ -36,23 +36,30 @@
* @hide
*/
int TYPE_NONE = 0;
+
+ /**
+ * Constant representing credential (PIN, pattern, or password).
+ * @hide
+ */
+ int TYPE_CREDENTIAL = 1 << 0;
+
/**
* Constant representing fingerprint.
* @hide
*/
- int TYPE_FINGERPRINT = 1 << 0;
+ int TYPE_FINGERPRINT = 1 << 1;
/**
* Constant representing iris.
* @hide
*/
- int TYPE_IRIS = 1 << 1;
+ int TYPE_IRIS = 1 << 2;
/**
* Constant representing face.
* @hide
*/
- int TYPE_FACE = 1 << 2;
+ int TYPE_FACE = 1 << 3;
/**
* Container for biometric data
diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java
index 27c04b4..c8bf570 100644
--- a/core/java/android/hardware/biometrics/BiometricConstants.java
+++ b/core/java/android/hardware/biometrics/BiometricConstants.java
@@ -134,6 +134,13 @@
int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14;
/**
+ * This constant is only used by SystemUI. It notifies SystemUI that authentication was paused
+ * because the authentication attempt was unsuccessful.
+ * @hide
+ */
+ int BIOMETRIC_PAUSED_REJECTED = 100;
+
+ /**
* @hide
*/
@UnsupportedAppUsage
diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java
index cbe8a05..9d427c8 100644
--- a/core/java/android/hardware/biometrics/BiometricManager.java
+++ b/core/java/android/hardware/biometrics/BiometricManager.java
@@ -137,7 +137,7 @@
public boolean hasEnrolledBiometrics(int userId) {
if (mService != null) {
try {
- return mService.hasEnrolledBiometrics(userId);
+ return mService.hasEnrolledBiometrics(userId, mContext.getOpPackageName());
} catch (RemoteException e) {
Slog.w(TAG, "Remote exception in hasEnrolledBiometrics(): " + e);
return false;
diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java
index cf86e25..9c51b52 100644
--- a/core/java/android/hardware/biometrics/BiometricPrompt.java
+++ b/core/java/android/hardware/biometrics/BiometricPrompt.java
@@ -26,6 +26,8 @@
import android.app.KeyguardManager;
import android.content.Context;
import android.content.DialogInterface;
+import android.hardware.face.FaceManager;
+import android.hardware.fingerprint.FingerprintManager;
import android.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -339,9 +341,23 @@
}
@Override
- public void onError(int error, String message) throws RemoteException {
+ public void onError(int modality, int error, int vendorCode) throws RemoteException {
mExecutor.execute(() -> {
- mAuthenticationCallback.onAuthenticationError(error, message);
+ String errorMessage;
+ switch (modality) {
+ case TYPE_FACE:
+ errorMessage = FaceManager.getErrorString(mContext, error, vendorCode);
+ break;
+
+ case TYPE_FINGERPRINT:
+ errorMessage = FingerprintManager.getErrorString(mContext, error,
+ vendorCode);
+ break;
+
+ default:
+ errorMessage = "";
+ }
+ mAuthenticationCallback.onAuthenticationError(error, errorMessage);
});
}
diff --git a/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl b/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl
new file mode 100644
index 0000000..987d197
--- /dev/null
+++ b/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+import android.hardware.biometrics.IBiometricServiceReceiverInternal;
+import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
+import android.hardware.face.IFaceServiceReceiver;
+import android.hardware.face.Face;
+
+/**
+ * This interface encapsulates fingerprint, face, iris, etc. authenticators.
+ * Implementations of this interface are meant to be registered with BiometricService.
+ * @hide
+ */
+interface IBiometricAuthenticator {
+
+ // This method prepares the service to start authenticating, but doesn't start authentication.
+ // This is protected by the MANAGE_BIOMETRIC signature permission. This method should only be
+ // called from BiometricService. The additional uid, pid, userId arguments should be determined
+ // by BiometricService. To start authentication after the clients are ready, use
+ // startPreparedClient().
+ void prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId,
+ int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName,
+ int cookie, int callingUid, int callingPid, int callingUserId);
+
+ // Starts authentication with the previously prepared client.
+ void startPreparedClient(int cookie);
+
+ // Same as above, with extra arguments.
+ void cancelAuthenticationFromService(IBinder token, String opPackageName,
+ int callingUid, int callingPid, int callingUserId, boolean fromClient);
+
+ // Determine if HAL is loaded and ready
+ boolean isHardwareDetected(String opPackageName);
+
+ // Determine if a user has at least one enrolled face
+ boolean hasEnrolledTemplates(int userId, String opPackageName);
+
+ // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
+ void resetLockout(in byte [] token);
+
+ // Explicitly set the active user (for enrolling work profile)
+ void setActiveUser(int uid);
+}
diff --git a/core/java/android/hardware/biometrics/IBiometricService.aidl b/core/java/android/hardware/biometrics/IBiometricService.aidl
index 6a3bf38..06336a5 100644
--- a/core/java/android/hardware/biometrics/IBiometricService.aidl
+++ b/core/java/android/hardware/biometrics/IBiometricService.aidl
@@ -19,6 +19,7 @@
import android.os.Bundle;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.biometrics.IBiometricServiceReceiver;
+import android.hardware.biometrics.IBiometricAuthenticator;
/**
* Communication channel from BiometricPrompt and BiometricManager to BiometricService. The
@@ -40,7 +41,12 @@
int canAuthenticate(String opPackageName, int userId);
// Checks if any biometrics are enrolled.
- boolean hasEnrolledBiometrics(int userId);
+ boolean hasEnrolledBiometrics(int userId, String opPackageName);
+
+ // Registers an authenticator (e.g. face, fingerprint, iris).
+ // Id must be unique, whereas strength and modality don't need to be.
+ // TODO(b/123321528): Turn strength and modality into enums.
+ void registerAuthenticator(int id, int strength, int modality, IBiometricAuthenticator authenticator);
// Register callback for when keyguard biometric eligibility changes.
void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);
diff --git a/core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl b/core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl
index 22ef33e..c960049 100644
--- a/core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl
+++ b/core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl
@@ -25,7 +25,7 @@
// Noties that authentication failed.
void onAuthenticationFailed();
// Notify BiometricPrompt that an error has occurred.
- void onError(int error, String message);
+ void onError(int modality, int error, int vendorCode);
// Notifies that a biometric has been acquired.
void onAcquired(int acquiredInfo, String message);
// Notifies that the SystemUI dialog has been dismissed.
diff --git a/core/java/android/hardware/biometrics/IBiometricServiceReceiverInternal.aidl b/core/java/android/hardware/biometrics/IBiometricServiceReceiverInternal.aidl
index 66b6e89..61310f3 100644
--- a/core/java/android/hardware/biometrics/IBiometricServiceReceiverInternal.aidl
+++ b/core/java/android/hardware/biometrics/IBiometricServiceReceiverInternal.aidl
@@ -31,7 +31,7 @@
void onAuthenticationFailed();
// Notify BiometricService than an error has occured. Forward to the correct receiver depending
// on the cookie.
- void onError(int cookie, int error, String message);
+ void onError(int cookie, int modality, int error, int vendorCode);
// Notifies that a biometric has been acquired.
void onAcquired(int acquiredInfo, String message);
// Notifies that the SystemUI dialog has been dismissed.
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 12b285a..55ebe28 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -504,8 +504,7 @@
public boolean isHardwareDetected() {
if (mService != null) {
try {
- long deviceId = 0; /* TODO: plumb hardware id to FPMS */
- return mService.isHardwareDetected(deviceId, mContext.getOpPackageName());
+ return mService.isHardwareDetected(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/hardware/face/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl
index b6a0afb..68a4aef 100644
--- a/core/java/android/hardware/face/IFaceService.aidl
+++ b/core/java/android/hardware/face/IFaceService.aidl
@@ -67,7 +67,7 @@
List<Face> getEnrolledFaces(int userId, String opPackageName);
// Determine if HAL is loaded and ready
- boolean isHardwareDetected(long deviceId, String opPackageName);
+ boolean isHardwareDetected(String opPackageName);
// Get a pre-enrollment authentication token
long generateChallenge(IBinder token);
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index d0622c8..22f8590 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -691,8 +691,7 @@
public boolean isHardwareDetected() {
if (mService != null) {
try {
- long deviceId = 0; /* TODO: plumb hardware id to FPMS */
- return mService.isHardwareDetected(deviceId, mContext.getOpPackageName());
+ return mService.isHardwareDetected(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
index dd6b29d..1a7e128 100644
--- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl
+++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
@@ -71,7 +71,7 @@
List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName);
// Determine if HAL is loaded and ready
- boolean isHardwareDetected(long deviceId, String opPackageName);
+ boolean isHardwareDetected(String opPackageName);
// Get a pre-enrollment authentication token
long preEnroll(IBinder token);
diff --git a/core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java b/core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java
index 160376b..eb5d0cb 100644
--- a/core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java
+++ b/core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java
@@ -58,8 +58,8 @@
*/
private static final String VOICE_KEYPHRASE_META_DATA = "android.voice_enrollment";
/**
- * Activity Action: Show activity for managing the keyphrases for hotword detection.
- * This needs to be defined by an activity that supports enrolling users for hotword/keyphrase
+ * Intent Action: for managing the keyphrases for hotword detection.
+ * This needs to be defined by a service that supports enrolling users for hotword/keyphrase
* detection.
*/
public static final String ACTION_MANAGE_VOICE_KEYPHRASES =
@@ -101,7 +101,7 @@
// Find the apps that supports enrollment for hotword keyhphrases,
// Pick a privileged app and obtain the information about the supported keyphrases
// from its metadata.
- List<ResolveInfo> ris = pm.queryIntentActivities(
+ List<ResolveInfo> ris = pm.queryIntentServices(
new Intent(ACTION_MANAGE_VOICE_KEYPHRASES), PackageManager.MATCH_DEFAULT_ONLY);
if (ris == null || ris.isEmpty()) {
// No application capable of enrolling for voice keyphrases is present.
@@ -116,11 +116,11 @@
for (ResolveInfo ri : ris) {
try {
ApplicationInfo ai = pm.getApplicationInfo(
- ri.activityInfo.packageName, PackageManager.GET_META_DATA);
+ ri.serviceInfo.packageName, PackageManager.GET_META_DATA);
if ((ai.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) == 0) {
// The application isn't privileged (/system/priv-app).
// The enrollment application needs to be a privileged system app.
- Slog.w(TAG, ai.packageName + "is not a privileged system app");
+ Slog.w(TAG, ai.packageName + " is not a privileged system app");
continue;
}
if (!Manifest.permission.MANAGE_VOICE_KEYPHRASES.equals(ai.permission)) {
@@ -137,7 +137,7 @@
}
} catch (PackageManager.NameNotFoundException e) {
String error = "error parsing voice enrollment meta-data for "
- + ri.activityInfo.packageName;
+ + ri.serviceInfo.packageName;
parseErrors.add(error + ": " + e);
Slog.w(TAG, error, e);
}
@@ -290,7 +290,7 @@
}
/**
- * Returns an intent to launch an activity that manages the given keyphrase
+ * Returns an intent to launch an service that manages the given keyphrase
* for the locale.
*
* @param action The enrollment related action that this intent is supposed to perform.
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 83391f3..43842c5 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -94,6 +94,7 @@
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Collections;
/**
* InputMethodService provides a standard implementation of an InputMethod,
@@ -434,6 +435,7 @@
final int[] mTmpLocation = new int[2];
final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> {
+ onComputeInsets(mTmpInsets);
if (isExtractViewShown()) {
// In true fullscreen mode, we just say the window isn't covering
// any content so we don't impact whatever is behind.
@@ -442,12 +444,15 @@
info.touchableRegion.setEmpty();
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME);
} else {
- onComputeInsets(mTmpInsets);
info.contentInsets.top = mTmpInsets.contentTopInsets;
info.visibleInsets.top = mTmpInsets.visibleTopInsets;
info.touchableRegion.set(mTmpInsets.touchableRegion);
info.setTouchableInsets(mTmpInsets.touchableInsets);
}
+
+ if (mInputFrame != null) {
+ setImeExclusionRect(mTmpInsets.visibleTopInsets);
+ }
};
final View.OnClickListener mActionClickListener = v -> {
@@ -672,6 +677,14 @@
mPrivOps.setImeWindowStatus(visibilityFlags, backDisposition);
}
+ /** Set region of the keyboard to be avoided from back gesture */
+ private void setImeExclusionRect(int visibleTopInsets) {
+ View inputFrameRootView = mInputFrame.getRootView();
+ Rect r = new Rect(0, visibleTopInsets, inputFrameRootView.getWidth(),
+ inputFrameRootView.getHeight());
+ inputFrameRootView.setSystemGestureExclusionRects(Collections.singletonList(r));
+ }
+
/**
* Concrete implementation of
* {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 3e325b7..e3259ff 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -57,6 +57,9 @@
private static final String TAG = "NetworkCapabilities";
private static final int INVALID_UID = -1;
+ // Set to true when private DNS is broken.
+ private boolean mPrivateDnsBroken;
+
/**
* @hide
*/
@@ -86,6 +89,7 @@
mUids = null;
mEstablishingVpnAppUid = INVALID_UID;
mSSID = null;
+ mPrivateDnsBroken = false;
}
/**
@@ -104,6 +108,7 @@
mEstablishingVpnAppUid = nc.mEstablishingVpnAppUid;
mUnwantedNetworkCapabilities = nc.mUnwantedNetworkCapabilities;
mSSID = nc.mSSID;
+ mPrivateDnsBroken = nc.mPrivateDnsBroken;
}
/**
@@ -557,6 +562,9 @@
}
if (mLinkUpBandwidthKbps != 0 || mLinkDownBandwidthKbps != 0) return "link bandwidth";
if (hasSignalStrength()) return "signalStrength";
+ if (isPrivateDnsBroken()) {
+ return "privateDnsBroken";
+ }
return null;
}
@@ -1443,7 +1451,8 @@
&& equalsSpecifier(that)
&& equalsTransportInfo(that)
&& equalsUids(that)
- && equalsSSID(that));
+ && equalsSSID(that)
+ && equalsPrivateDnsBroken(that));
}
@Override
@@ -1460,7 +1469,8 @@
+ (mSignalStrength * 29)
+ Objects.hashCode(mUids) * 31
+ Objects.hashCode(mSSID) * 37
- + Objects.hashCode(mTransportInfo) * 41;
+ + Objects.hashCode(mTransportInfo) * 41
+ + Objects.hashCode(mPrivateDnsBroken) * 43;
}
@Override
@@ -1479,6 +1489,7 @@
dest.writeInt(mSignalStrength);
dest.writeArraySet(mUids);
dest.writeString(mSSID);
+ dest.writeBoolean(mPrivateDnsBroken);
}
public static final @android.annotation.NonNull Creator<NetworkCapabilities> CREATOR =
@@ -1498,6 +1509,7 @@
netCap.mUids = (ArraySet<UidRange>) in.readArraySet(
null /* ClassLoader, null for default */);
netCap.mSSID = in.readString();
+ netCap.mPrivateDnsBroken = in.readBoolean();
return netCap;
}
@Override
@@ -1555,6 +1567,10 @@
sb.append(" SSID: ").append(mSSID);
}
+ if (mPrivateDnsBroken) {
+ sb.append(" Private DNS is broken");
+ }
+
sb.append("]");
return sb.toString();
}
@@ -1706,4 +1722,28 @@
public boolean isMetered() {
return !hasCapability(NET_CAPABILITY_NOT_METERED);
}
+
+ /**
+ * Check if private dns is broken.
+ *
+ * @return {@code true} if {@code mPrivateDnsBroken} is set when private DNS is broken.
+ * @hide
+ */
+ public boolean isPrivateDnsBroken() {
+ return mPrivateDnsBroken;
+ }
+
+ /**
+ * Set mPrivateDnsBroken to true when private dns is broken.
+ *
+ * @param broken the status of private DNS to be set.
+ * @hide
+ */
+ public void setPrivateDnsBroken(boolean broken) {
+ mPrivateDnsBroken = broken;
+ }
+
+ private boolean equalsPrivateDnsBroken(NetworkCapabilities nc) {
+ return mPrivateDnsBroken == nc.mPrivateDnsBroken;
+ }
}
diff --git a/core/java/android/net/NetworkMisc.java b/core/java/android/net/NetworkMisc.java
index 9ba3bd9..4ad52d5 100644
--- a/core/java/android/net/NetworkMisc.java
+++ b/core/java/android/net/NetworkMisc.java
@@ -77,6 +77,12 @@
*/
public boolean skip464xlat;
+ /**
+ * Set to true if the PRIVATE_DNS_BROKEN notification has shown for this network.
+ * Reset this bit when private DNS mode is changed from strict mode to opportunistic/off mode.
+ */
+ public boolean hasShownBroken;
+
public NetworkMisc() {
}
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index c5c0945..af0ec11 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -19,6 +19,7 @@
import static android.app.ActivityManager.PROCESS_STATE_BOUND_TOP;
import static android.app.ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE_LOCATION;
+import android.annotation.IntDef;
import android.annotation.UnsupportedAppUsage;
import android.app.ActivityManager;
import android.content.Context;
@@ -48,6 +49,8 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +79,7 @@
protected static final boolean SCREEN_OFF_RPM_STATS_ENABLED = false;
/** @hide */
- public static final String SERVICE_NAME = "batterystats";
+ public static final String SERVICE_NAME = Context.BATTERY_STATS_SERVICE;
/**
* A constant indicating a partial wake lock timer.
@@ -223,6 +226,15 @@
@Deprecated
public static final int STATS_SINCE_UNPLUGGED = 2;
+ /** @hide */
+ @IntDef(flag = true, prefix = { "STATS_" }, value = {
+ STATS_SINCE_CHARGED,
+ STATS_CURRENT,
+ STATS_SINCE_UNPLUGGED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface StatName {}
+
// NOTE: Update this list if you add/change any stats above.
// These characters are supposed to represent "total", "last", "current",
// and "unplugged". They were shortened for efficiency sake.
@@ -2490,6 +2502,25 @@
public static final int NUM_WIFI_SUPPL_STATES = WIFI_SUPPL_STATE_UNINITIALIZED+1;
+ /** @hide */
+ @IntDef(flag = true, prefix = { "WIFI_SUPPL_STATE_" }, value = {
+ WIFI_SUPPL_STATE_INVALID,
+ WIFI_SUPPL_STATE_DISCONNECTED,
+ WIFI_SUPPL_STATE_INTERFACE_DISABLED,
+ WIFI_SUPPL_STATE_INACTIVE,
+ WIFI_SUPPL_STATE_SCANNING,
+ WIFI_SUPPL_STATE_AUTHENTICATING,
+ WIFI_SUPPL_STATE_ASSOCIATING,
+ WIFI_SUPPL_STATE_ASSOCIATED,
+ WIFI_SUPPL_STATE_FOUR_WAY_HANDSHAKE,
+ WIFI_SUPPL_STATE_GROUP_HANDSHAKE,
+ WIFI_SUPPL_STATE_COMPLETED,
+ WIFI_SUPPL_STATE_DORMANT,
+ WIFI_SUPPL_STATE_UNINITIALIZED,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface WifiSupplState {}
+
static final String[] WIFI_SUPPL_STATE_NAMES = {
"invalid", "disconn", "disabled", "inactive", "scanning",
"authenticating", "associating", "associated", "4-way-handshake",
@@ -2641,34 +2672,48 @@
public static final int WIFI_STATE_ON_CONNECTED_STA_P2P = 6;
public static final int WIFI_STATE_SOFT_AP = 7;
+ public static final int NUM_WIFI_STATES = WIFI_STATE_SOFT_AP + 1;
+
+ /** @hide */
+ @IntDef(flag = true, prefix = { "WIFI_STATE_" }, value = {
+ WIFI_STATE_OFF,
+ WIFI_STATE_OFF_SCANNING,
+ WIFI_STATE_ON_NO_NETWORKS,
+ WIFI_STATE_ON_DISCONNECTED,
+ WIFI_STATE_ON_CONNECTED_STA,
+ WIFI_STATE_ON_CONNECTED_P2P,
+ WIFI_STATE_ON_CONNECTED_STA_P2P,
+ WIFI_STATE_SOFT_AP
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface WifiState {}
+
static final String[] WIFI_STATE_NAMES = {
"off", "scanning", "no_net", "disconn",
"sta", "p2p", "sta_p2p", "soft_ap"
};
- public static final int NUM_WIFI_STATES = WIFI_STATE_SOFT_AP+1;
-
/**
* Returns the time in microseconds that WiFi has been running in the given state.
*
* {@hide}
*/
- public abstract long getWifiStateTime(int wifiState,
- long elapsedRealtimeUs, int which);
+ public abstract long getWifiStateTime(@WifiState int wifiState,
+ long elapsedRealtimeUs, @StatName int which);
/**
* Returns the number of times that WiFi has entered the given state.
*
* {@hide}
*/
- public abstract int getWifiStateCount(int wifiState, int which);
+ public abstract int getWifiStateCount(@WifiState int wifiState, @StatName int which);
/**
* Returns the {@link Timer} object that tracks the given WiFi state.
*
* {@hide}
*/
- public abstract Timer getWifiStateTimer(int wifiState);
+ public abstract Timer getWifiStateTimer(@WifiState int wifiState);
/**
* Returns the time in microseconds that the wifi supplicant has been
@@ -2676,7 +2721,8 @@
*
* {@hide}
*/
- public abstract long getWifiSupplStateTime(int state, long elapsedRealtimeUs, int which);
+ public abstract long getWifiSupplStateTime(@WifiSupplState int state, long elapsedRealtimeUs,
+ @StatName int which);
/**
* Returns the number of times that the wifi supplicant has transitioned
@@ -2684,14 +2730,14 @@
*
* {@hide}
*/
- public abstract int getWifiSupplStateCount(int state, int which);
+ public abstract int getWifiSupplStateCount(@WifiSupplState int state, @StatName int which);
/**
* Returns the {@link Timer} object that tracks the given wifi supplicant state.
*
* {@hide}
*/
- public abstract Timer getWifiSupplStateTimer(int state);
+ public abstract Timer getWifiSupplStateTimer(@WifiSupplState int state);
public static final int NUM_WIFI_SIGNAL_STRENGTH_BINS = 5;
diff --git a/core/java/android/os/BatteryStatsManager.java b/core/java/android/os/BatteryStatsManager.java
new file mode 100644
index 0000000..367a868
--- /dev/null
+++ b/core/java/android/os/BatteryStatsManager.java
@@ -0,0 +1,247 @@
+/*
+ * 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.os;
+
+import android.annotation.IntRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
+import android.annotation.SystemApi;
+import android.annotation.SystemService;
+import android.content.Context;
+import android.os.connectivity.WifiBatteryStats;
+
+import com.android.internal.app.IBatteryStats;
+
+/**
+ * This class provides an API surface for internal system components to report events that are
+ * needed for battery usage/estimation and battery blaming for apps.
+ *
+ * Note: This internally uses the same {@link IBatteryStats} binder service as the public
+ * {@link BatteryManager}.
+ * @hide
+ */
+@SystemApi
+@SystemService(Context.BATTERY_STATS_SERVICE)
+public class BatteryStatsManager {
+ private final IBatteryStats mBatteryStats;
+
+ /** @hide */
+ public BatteryStatsManager(IBatteryStats batteryStats) {
+ mBatteryStats = batteryStats;
+ }
+
+ /**
+ * Indicates that the wifi connection RSSI has changed.
+ *
+ * @param newRssi The new RSSI value.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiRssiChanged(@IntRange(from = -127, to = 0) int newRssi) {
+ try {
+ mBatteryStats.noteWifiRssiChanged(newRssi);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that wifi was toggled on.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiOn() {
+ try {
+ mBatteryStats.noteWifiOn();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that wifi was toggled off.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiOff() {
+ try {
+ mBatteryStats.noteWifiOff();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that wifi state has changed.
+ *
+ * @param newWifiState The new wifi State.
+ * @param accessPoint SSID of the network if wifi is connected to STA, else null.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiState(@BatteryStats.WifiState int newWifiState,
+ @Nullable String accessPoint) {
+ try {
+ mBatteryStats.noteWifiState(newWifiState, accessPoint);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that a new wifi scan has started.
+ *
+ * @param ws Worksource (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiScanStartedFromSource(@NonNull WorkSource ws) {
+ try {
+ mBatteryStats.noteWifiScanStartedFromSource(ws);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that an ongoing wifi scan has stopped.
+ *
+ * @param ws Worksource (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiScanStoppedFromSource(@NonNull WorkSource ws) {
+ try {
+ mBatteryStats.noteWifiScanStoppedFromSource(ws);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that a new wifi batched scan has started.
+ *
+ * @param ws Worksource (to be used for battery blaming).
+ * @param csph Channels scanned per hour.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiBatchedScanStartedFromSource(@NonNull WorkSource ws,
+ @IntRange(from = 0) int csph) {
+ try {
+ mBatteryStats.noteWifiBatchedScanStartedFromSource(ws, csph);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that an ongoing wifi batched scan has stopped.
+ *
+ * @param ws Worksource (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiBatchedScanStoppedFromSource(@NonNull WorkSource ws) {
+ try {
+ mBatteryStats.noteWifiBatchedScanStoppedFromSource(ws);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Retrieves all the wifi related battery stats.
+ *
+ * @return Instance of {@link WifiBatteryStats}.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public @NonNull WifiBatteryStats getWifiBatteryStats() {
+ try {
+ return mBatteryStats.getWifiBatteryStats();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ return null;
+ }
+ }
+
+ /**
+ * Indicates an app acquiring full wifi lock.
+ *
+ * @param ws Worksource (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteFullWifiLockAcquiredFromSource(@NonNull WorkSource ws) {
+ try {
+ mBatteryStats.noteFullWifiLockAcquiredFromSource(ws);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates an app releasing full wifi lock.
+ *
+ * @param ws Worksource (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteFullWifiLockReleasedFromSource(@NonNull WorkSource ws) {
+ try {
+ mBatteryStats.noteFullWifiLockReleasedFromSource(ws);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that supplicant state has changed.
+ *
+ * @param newSupplState The new Supplicant state.
+ * @param failedAuth Boolean indicating whether there was a connection failure due to
+ * authentication failure.
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiSupplicantStateChanged(@BatteryStats.WifiSupplState int newSupplState,
+ boolean failedAuth) {
+ try {
+ mBatteryStats.noteWifiSupplicantStateChanged(newSupplState, failedAuth);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that an app has acquired the wifi multicast lock.
+ *
+ * @param uid UID of the app that acquired the wifi lock (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiMulticastEnabled(int uid) {
+ try {
+ mBatteryStats.noteWifiMulticastEnabled(uid);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Indicates that an app has released the wifi multicast lock.
+ *
+ * @param uid UID of the app that released the wifi lock (to be used for battery blaming).
+ */
+ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
+ public void noteWifiMulticastDisabled(int uid) {
+ try {
+ mBatteryStats.noteWifiMulticastDisabled(uid);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+}
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
index 6d5fe53b..a92237b 100644
--- a/core/java/android/os/Environment.java
+++ b/core/java/android/os/Environment.java
@@ -55,6 +55,7 @@
private static final String ENV_VENDOR_ROOT = "VENDOR_ROOT";
private static final String ENV_PRODUCT_ROOT = "PRODUCT_ROOT";
private static final String ENV_SYSTEM_EXT_ROOT = "SYSTEM_EXT_ROOT";
+ private static final String ENV_APEX_ROOT = "APEX_ROOT";
/** {@hide} */
public static final String DIR_ANDROID = "Android";
@@ -78,7 +79,9 @@
private static final File DIR_VENDOR_ROOT = getDirectory(ENV_VENDOR_ROOT, "/vendor");
private static final File DIR_PRODUCT_ROOT = getDirectory(ENV_PRODUCT_ROOT, "/product");
private static final File DIR_SYSTEM_EXT_ROOT = getDirectory(ENV_SYSTEM_EXT_ROOT,
- "/system_ext");
+ "/system_ext");
+ private static final File DIR_APEX_ROOT = getDirectory(ENV_APEX_ROOT,
+ "/apex");
@UnsupportedAppUsage
private static UserEnvironment sCurrentUser;
@@ -248,6 +251,16 @@
}
/**
+ * Return root directory of the apex mount point, where all the apex modules are made available
+ * to the rest of the system.
+ *
+ * @hide
+ */
+ public static @NonNull File getApexDirectory() {
+ return DIR_APEX_ROOT;
+ }
+
+ /**
* Return the system directory for a user. This is for use by system
* services to store files relating to the user. This directory will be
* automatically deleted when the user is removed.
diff --git a/core/java/android/os/ServiceManagerNative.java b/core/java/android/os/ServiceManagerNative.java
index f641731..124b6c6 100644
--- a/core/java/android/os/ServiceManagerNative.java
+++ b/core/java/android/os/ServiceManagerNative.java
@@ -86,6 +86,10 @@
throw new RemoteException();
}
+ public boolean isDeclared(String name) throws RemoteException {
+ throw new RemoteException();
+ }
+
/**
* Same as mServiceManager but used by apps.
*
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index c6b63ca..b7a3c8f 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -1314,7 +1314,8 @@
}
/**
- * Returns whether switching users is currently allowed.
+ * Returns whether switching users is currently allowed for the user this process is running
+ * under.
* <p>
* Switching users is not allowed in the following cases:
* <li>the user is in a phone call</li>
@@ -1329,10 +1330,24 @@
android.Manifest.permission.MANAGE_USERS,
android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional = true)
public @UserSwitchabilityResult int getUserSwitchability() {
- final boolean allowUserSwitchingWhenSystemUserLocked = Settings.Global.getInt(
- mContext.getContentResolver(),
- Settings.Global.ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED, 0) != 0;
- final boolean systemUserUnlocked = isUserUnlocked(UserHandle.SYSTEM);
+ return getUserSwitchability(Process.myUserHandle());
+ }
+
+ /**
+ * Returns whether switching users is currently allowed for the provided user.
+ * <p>
+ * Switching users is not allowed in the following cases:
+ * <li>the user is in a phone call</li>
+ * <li>{@link #DISALLOW_USER_SWITCH} is set</li>
+ * <li>system user hasn't been unlocked yet</li>
+ *
+ * @return A {@link UserSwitchabilityResult} flag indicating if the user is switchable.
+ * @hide
+ */
+ @RequiresPermission(allOf = {Manifest.permission.READ_PHONE_STATE,
+ android.Manifest.permission.MANAGE_USERS,
+ android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional = true)
+ public @UserSwitchabilityResult int getUserSwitchability(UserHandle userHandle) {
final TelephonyManager tm =
(TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
@@ -1340,12 +1355,22 @@
if (tm.getCallState() != TelephonyManager.CALL_STATE_IDLE) {
flags |= SWITCHABILITY_STATUS_USER_IN_CALL;
}
- if (hasUserRestriction(DISALLOW_USER_SWITCH)) {
+ if (hasUserRestriction(DISALLOW_USER_SWITCH, userHandle)) {
flags |= SWITCHABILITY_STATUS_USER_SWITCH_DISALLOWED;
}
- if (!allowUserSwitchingWhenSystemUserLocked && !systemUserUnlocked) {
- flags |= SWITCHABILITY_STATUS_SYSTEM_USER_LOCKED;
+
+ // System User is always unlocked in Headless System User Mode, so ignore this flag
+ if (!isHeadlessSystemUserMode()) {
+ final boolean allowUserSwitchingWhenSystemUserLocked = Settings.Global.getInt(
+ mContext.getContentResolver(),
+ Settings.Global.ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED, 0) != 0;
+ final boolean systemUserUnlocked = isUserUnlocked(UserHandle.SYSTEM);
+
+ if (!allowUserSwitchingWhenSystemUserLocked && !systemUserUnlocked) {
+ flags |= SWITCHABILITY_STATUS_SYSTEM_USER_LOCKED;
+ }
}
+
return flags;
}
@@ -1748,8 +1773,30 @@
}
}
- /** {@hide} */
- public boolean isUserUnlockingOrUnlocked(UserHandle user) {
+ /**
+ * Return whether the provided user is already running in an
+ * "unlocked" state or in the process of unlocking.
+ * <p>
+ * On devices with direct boot, a user is unlocked only after they've
+ * entered their credentials (such as a lock pattern or PIN). On devices
+ * without direct boot, a user is unlocked as soon as it starts.
+ * <p>
+ * When a user is locked, only device-protected data storage is available.
+ * When a user is unlocked, both device-protected and credential-protected
+ * private app data storage is available.
+ *
+ * <p>Requires {@code android.permission.MANAGE_USERS} or
+ * {@code android.permission.INTERACT_ACROSS_USERS}, otherwise specified {@link UserHandle user}
+ * must be the calling user or a profile associated with it.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ Manifest.permission.MANAGE_USERS,
+ Manifest.permission.INTERACT_ACROSS_USERS
+ })
+ public boolean isUserUnlockingOrUnlocked(@NonNull UserHandle user) {
return isUserUnlockingOrUnlocked(user.getIdentifier());
}
@@ -2568,6 +2615,22 @@
}
/**
+ * Checks if the 2 provided user handles belong to the same profile group.
+ *
+ * @param user one of the two user handles to check.
+ * @param otherUser one of the two user handles to check.
+ * @return true if the two users are in the same profile group.
+ *
+ * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
+ public boolean isSameProfileGroup(@NonNull UserHandle user, @NonNull UserHandle otherUser) {
+ return isSameProfileGroup(user.getIdentifier(), otherUser.getIdentifier());
+ }
+
+ /**
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
* @param userId one of the two user ids to check.
* @param otherUserId one of the two user ids to check.
diff --git a/core/java/android/os/connectivity/WifiBatteryStats.java b/core/java/android/os/connectivity/WifiBatteryStats.java
index 9d2d5d8..d10a647 100644
--- a/core/java/android/os/connectivity/WifiBatteryStats.java
+++ b/core/java/android/os/connectivity/WifiBatteryStats.java
@@ -15,278 +15,385 @@
*/
package android.os.connectivity;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.os.BatteryStats;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Arrays;
+import java.util.Objects;
/**
- * API for Wifi power stats
+ * Class for holding Wifi related battery stats
*
* @hide
*/
+@SystemApi
public final class WifiBatteryStats implements Parcelable {
+ private long mLoggingDurationMillis = 0;
+ private long mKernelActiveTimeMillis = 0;
+ private long mNumPacketsTx = 0;
+ private long mNumBytesTx = 0;
+ private long mNumPacketsRx = 0;
+ private long mNumBytesRx = 0;
+ private long mSleepTimeMillis = 0;
+ private long mScanTimeMillis = 0;
+ private long mIdleTimeMillis = 0;
+ private long mRxTimeMillis = 0;
+ private long mTxTimeMillis = 0;
+ private long mEnergyConsumedMaMillis = 0;
+ private long mNumAppScanRequest = 0;
+ private long[] mTimeInStateMillis =
+ new long[BatteryStats.NUM_WIFI_STATES];
+ private long[] mTimeInSupplicantStateMillis =
+ new long[BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS];
+ private long[] mTimeInRxSignalStrengthLevelMillis =
+ new long[BatteryStats.NUM_WIFI_SUPPL_STATES];
+ private long mMonitoredRailChargeConsumedMaMillis = 0;
- private long mLoggingDurationMs;
- private long mKernelActiveTimeMs;
- private long mNumPacketsTx;
- private long mNumBytesTx;
- private long mNumPacketsRx;
- private long mNumBytesRx;
- private long mSleepTimeMs;
- private long mScanTimeMs;
- private long mIdleTimeMs;
- private long mRxTimeMs;
- private long mTxTimeMs;
- private long mEnergyConsumedMaMs;
- private long mNumAppScanRequest;
- private long[] mTimeInStateMs;
- private long[] mTimeInSupplicantStateMs;
- private long[] mTimeInRxSignalStrengthLevelMs;
- private long mMonitoredRailChargeConsumedMaMs;
+ public static final @NonNull Parcelable.Creator<WifiBatteryStats> CREATOR =
+ new Parcelable.Creator<WifiBatteryStats>() {
+ public WifiBatteryStats createFromParcel(Parcel in) {
+ return new WifiBatteryStats(in);
+ }
- public static final @android.annotation.NonNull Parcelable.Creator<WifiBatteryStats> CREATOR = new
- Parcelable.Creator<WifiBatteryStats>() {
- public WifiBatteryStats createFromParcel(Parcel in) {
- return new WifiBatteryStats(in);
- }
+ public WifiBatteryStats[] newArray(int size) {
+ return new WifiBatteryStats[size];
+ }
+ };
- public WifiBatteryStats[] newArray(int size) {
- return new WifiBatteryStats[size];
- }
- };
+ @Override
+ public int describeContents() {
+ return 0;
+ }
- public WifiBatteryStats() {
- initialize();
- }
+ @Override
+ public void writeToParcel(@NonNull Parcel out, int flags) {
+ out.writeLong(mLoggingDurationMillis);
+ out.writeLong(mKernelActiveTimeMillis);
+ out.writeLong(mNumPacketsTx);
+ out.writeLong(mNumBytesTx);
+ out.writeLong(mNumPacketsRx);
+ out.writeLong(mNumBytesRx);
+ out.writeLong(mSleepTimeMillis);
+ out.writeLong(mScanTimeMillis);
+ out.writeLong(mIdleTimeMillis);
+ out.writeLong(mRxTimeMillis);
+ out.writeLong(mTxTimeMillis);
+ out.writeLong(mEnergyConsumedMaMillis);
+ out.writeLong(mNumAppScanRequest);
+ out.writeLongArray(mTimeInStateMillis);
+ out.writeLongArray(mTimeInRxSignalStrengthLevelMillis);
+ out.writeLongArray(mTimeInSupplicantStateMillis);
+ out.writeLong(mMonitoredRailChargeConsumedMaMillis);
+ }
- public void writeToParcel(Parcel out, int flags) {
- out.writeLong(mLoggingDurationMs);
- out.writeLong(mKernelActiveTimeMs);
- out.writeLong(mNumPacketsTx);
- out.writeLong(mNumBytesTx);
- out.writeLong(mNumPacketsRx);
- out.writeLong(mNumBytesRx);
- out.writeLong(mSleepTimeMs);
- out.writeLong(mScanTimeMs);
- out.writeLong(mIdleTimeMs);
- out.writeLong(mRxTimeMs);
- out.writeLong(mTxTimeMs);
- out.writeLong(mEnergyConsumedMaMs);
- out.writeLong(mNumAppScanRequest);
- out.writeLongArray(mTimeInStateMs);
- out.writeLongArray(mTimeInRxSignalStrengthLevelMs);
- out.writeLongArray(mTimeInSupplicantStateMs);
- out.writeLong(mMonitoredRailChargeConsumedMaMs);
- }
+ @Override
+ public boolean equals(@Nullable Object other) {
+ if (!(other instanceof WifiBatteryStats)) return false;
+ if (other == this) return true;
+ WifiBatteryStats otherStats = (WifiBatteryStats) other;
+ return this.mLoggingDurationMillis == otherStats.mLoggingDurationMillis
+ && this.mKernelActiveTimeMillis == otherStats.mKernelActiveTimeMillis
+ && this.mNumPacketsTx == otherStats.mNumPacketsTx
+ && this.mNumBytesTx == otherStats.mNumBytesTx
+ && this.mNumPacketsRx == otherStats.mNumPacketsRx
+ && this.mNumBytesRx == otherStats.mNumBytesRx
+ && this.mSleepTimeMillis == otherStats.mSleepTimeMillis
+ && this.mScanTimeMillis == otherStats.mScanTimeMillis
+ && this.mIdleTimeMillis == otherStats.mIdleTimeMillis
+ && this.mRxTimeMillis == otherStats.mRxTimeMillis
+ && this.mTxTimeMillis == otherStats.mTxTimeMillis
+ && this.mEnergyConsumedMaMillis == otherStats.mEnergyConsumedMaMillis
+ && this.mNumAppScanRequest == otherStats.mNumAppScanRequest
+ && Arrays.equals(this.mTimeInStateMillis, otherStats.mTimeInStateMillis)
+ && Arrays.equals(this.mTimeInSupplicantStateMillis,
+ otherStats.mTimeInSupplicantStateMillis)
+ && Arrays.equals(this.mTimeInRxSignalStrengthLevelMillis,
+ otherStats.mTimeInRxSignalStrengthLevelMillis)
+ && this.mMonitoredRailChargeConsumedMaMillis
+ == otherStats.mMonitoredRailChargeConsumedMaMillis;
+ }
- public void readFromParcel(Parcel in) {
- mLoggingDurationMs = in.readLong();
- mKernelActiveTimeMs = in.readLong();
- mNumPacketsTx = in.readLong();
- mNumBytesTx = in.readLong();
- mNumPacketsRx = in.readLong();
- mNumBytesRx = in.readLong();
- mSleepTimeMs = in.readLong();
- mScanTimeMs = in.readLong();
- mIdleTimeMs = in.readLong();
- mRxTimeMs = in.readLong();
- mTxTimeMs = in.readLong();
- mEnergyConsumedMaMs = in.readLong();
- mNumAppScanRequest = in.readLong();
- in.readLongArray(mTimeInStateMs);
- in.readLongArray(mTimeInRxSignalStrengthLevelMs);
- in.readLongArray(mTimeInSupplicantStateMs);
- mMonitoredRailChargeConsumedMaMs = in.readLong();
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(mLoggingDurationMillis, mKernelActiveTimeMillis, mNumPacketsTx,
+ mNumBytesTx, mNumPacketsRx, mNumBytesRx, mSleepTimeMillis, mScanTimeMillis,
+ mIdleTimeMillis, mRxTimeMillis, mTxTimeMillis, mEnergyConsumedMaMillis,
+ mNumAppScanRequest, Arrays.hashCode(mTimeInStateMillis),
+ Arrays.hashCode(mTimeInSupplicantStateMillis),
+ Arrays.hashCode(mTimeInRxSignalStrengthLevelMillis),
+ mMonitoredRailChargeConsumedMaMillis);
+ }
- public long getLoggingDurationMs() {
- return mLoggingDurationMs;
- }
+ /** @hide **/
+ public WifiBatteryStats() {}
- public long getKernelActiveTimeMs() {
- return mKernelActiveTimeMs;
- }
+ private void readFromParcel(Parcel in) {
+ mLoggingDurationMillis = in.readLong();
+ mKernelActiveTimeMillis = in.readLong();
+ mNumPacketsTx = in.readLong();
+ mNumBytesTx = in.readLong();
+ mNumPacketsRx = in.readLong();
+ mNumBytesRx = in.readLong();
+ mSleepTimeMillis = in.readLong();
+ mScanTimeMillis = in.readLong();
+ mIdleTimeMillis = in.readLong();
+ mRxTimeMillis = in.readLong();
+ mTxTimeMillis = in.readLong();
+ mEnergyConsumedMaMillis = in.readLong();
+ mNumAppScanRequest = in.readLong();
+ in.readLongArray(mTimeInStateMillis);
+ in.readLongArray(mTimeInRxSignalStrengthLevelMillis);
+ in.readLongArray(mTimeInSupplicantStateMillis);
+ mMonitoredRailChargeConsumedMaMillis = in.readLong();
+ }
- public long getNumPacketsTx() {
- return mNumPacketsTx;
- }
+ /**
+ * Returns the duration for which these wifi stats were collected.
+ *
+ * @return Duration of stats collection in millis.
+ */
+ public long getLoggingDurationMillis() {
+ return mLoggingDurationMillis;
+ }
- public long getNumBytesTx() {
- return mNumBytesTx;
- }
+ /**
+ * Returns the duration for which the kernel was active within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Duration of kernel active time in millis.
+ */
+ public long getKernelActiveTimeMillis() {
+ return mKernelActiveTimeMillis;
+ }
- public long getNumPacketsRx() {
- return mNumPacketsRx;
- }
+ /**
+ * Returns the number of packets transmitted over wifi within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Number of packets transmitted.
+ */
+ public long getNumPacketsTx() {
+ return mNumPacketsTx;
+ }
- public long getNumBytesRx() {
- return mNumBytesRx;
- }
+ /**
+ * Returns the number of packets received over wifi within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Number of packets received.
+ */
+ public long getNumBytesTx() {
+ return mNumBytesTx;
+ }
- public long getSleepTimeMs() {
- return mSleepTimeMs;
- }
+ /**
+ * Returns the number of bytes transmitted over wifi within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Number of bytes transmitted.
+ */
+ public long getNumPacketsRx() {
+ return mNumPacketsRx;
+ }
- public long getScanTimeMs() {
- return mScanTimeMs;
- }
+ /**
+ * Returns the number of bytes received over wifi within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Number of bytes received.
+ */
+ public long getNumBytesRx() {
+ return mNumBytesRx;
+ }
- public long getIdleTimeMs() {
- return mIdleTimeMs;
- }
+ /**
+ * Returns the duration for which the device was sleeping within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Duration of sleep time in millis.
+ */
+ public long getSleepTimeMillis() {
+ return mSleepTimeMillis;
+ }
- public long getRxTimeMs() {
- return mRxTimeMs;
- }
+ /**
+ * Returns the duration for which the device was wifi scanning within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Duration of wifi scanning time in millis.
+ */
+ public long getScanTimeMillis() {
+ return mScanTimeMillis;
+ }
- public long getTxTimeMs() {
- return mTxTimeMs;
- }
+ /**
+ * Returns the duration for which the device was idle within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Duration of idle time in millis.
+ */
+ public long getIdleTimeMillis() {
+ return mIdleTimeMillis;
+ }
- public long getEnergyConsumedMaMs() {
- return mEnergyConsumedMaMs;
- }
+ /**
+ * Returns the duration for which the device was receiving over wifi within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Duration of wifi reception time in millis.
+ */
+ public long getRxTimeMillis() {
+ return mRxTimeMillis;
+ }
- public long getNumAppScanRequest() {
- return mNumAppScanRequest;
- }
+ /**
+ * Returns the duration for which the device was transmitting over wifi within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Duration of wifi transmission time in millis.
+ */
+ public long getTxTimeMillis() {
+ return mTxTimeMillis;
+ }
- public long[] getTimeInStateMs() {
- return mTimeInStateMs;
- }
+ /**
+ * Returns an estimation of energy consumed by wifi chip within
+ * {@link #getLoggingDurationMillis()}.
+ *
+ * @return Energy consumed in millis.
+ */
+ public long getEnergyConsumedMaMillis() {
+ return mEnergyConsumedMaMillis;
+ }
- public long[] getTimeInRxSignalStrengthLevelMs() {
- return mTimeInRxSignalStrengthLevelMs;
- }
+ /**
+ * Returns the number of app initiated wifi scans within {@link #getLoggingDurationMillis()}.
+ *
+ * @return Number of app scans.
+ */
+ public long getNumAppScanRequest() {
+ return mNumAppScanRequest;
+ }
- public long[] getTimeInSupplicantStateMs() {
- return mTimeInSupplicantStateMs;
- }
+ /**
+ * Returns the energy consumed by wifi chip within {@link #getLoggingDurationMillis()}.
+ *
+ * @return Energy consumed in millis.
+ */
+ public long getMonitoredRailChargeConsumedMaMillis() {
+ return mMonitoredRailChargeConsumedMaMillis;
+ }
- public long getMonitoredRailChargeConsumedMaMs() {
- return mMonitoredRailChargeConsumedMaMs;
- }
+ /** @hide */
+ public void setLoggingDurationMillis(long t) {
+ mLoggingDurationMillis = t;
+ return;
+ }
- public void setLoggingDurationMs(long t) {
- mLoggingDurationMs = t;
- return;
- }
+ /** @hide */
+ public void setKernelActiveTimeMillis(long t) {
+ mKernelActiveTimeMillis = t;
+ return;
+ }
- public void setKernelActiveTimeMs(long t) {
- mKernelActiveTimeMs = t;
- return;
- }
+ /** @hide */
+ public void setNumPacketsTx(long n) {
+ mNumPacketsTx = n;
+ return;
+ }
- public void setNumPacketsTx(long n) {
- mNumPacketsTx = n;
- return;
- }
+ /** @hide */
+ public void setNumBytesTx(long b) {
+ mNumBytesTx = b;
+ return;
+ }
- public void setNumBytesTx(long b) {
- mNumBytesTx = b;
- return;
- }
+ /** @hide */
+ public void setNumPacketsRx(long n) {
+ mNumPacketsRx = n;
+ return;
+ }
- public void setNumPacketsRx(long n) {
- mNumPacketsRx = n;
- return;
- }
+ /** @hide */
+ public void setNumBytesRx(long b) {
+ mNumBytesRx = b;
+ return;
+ }
- public void setNumBytesRx(long b) {
- mNumBytesRx = b;
- return;
- }
+ /** @hide */
+ public void setSleepTimeMillis(long t) {
+ mSleepTimeMillis = t;
+ return;
+ }
- public void setSleepTimeMs(long t) {
- mSleepTimeMs = t;
- return;
- }
+ /** @hide */
+ public void setScanTimeMillis(long t) {
+ mScanTimeMillis = t;
+ return;
+ }
- public void setScanTimeMs(long t) {
- mScanTimeMs = t;
- return;
- }
+ /** @hide */
+ public void setIdleTimeMillis(long t) {
+ mIdleTimeMillis = t;
+ return;
+ }
- public void setIdleTimeMs(long t) {
- mIdleTimeMs = t;
- return;
- }
+ /** @hide */
+ public void setRxTimeMillis(long t) {
+ mRxTimeMillis = t;
+ return;
+ }
- public void setRxTimeMs(long t) {
- mRxTimeMs = t;
- return;
- }
+ /** @hide */
+ public void setTxTimeMillis(long t) {
+ mTxTimeMillis = t;
+ return;
+ }
- public void setTxTimeMs(long t) {
- mTxTimeMs = t;
- return;
- }
+ /** @hide */
+ public void setEnergyConsumedMaMillis(long e) {
+ mEnergyConsumedMaMillis = e;
+ return;
+ }
- public void setEnergyConsumedMaMs(long e) {
- mEnergyConsumedMaMs = e;
- return;
- }
+ /** @hide */
+ public void setNumAppScanRequest(long n) {
+ mNumAppScanRequest = n;
+ return;
+ }
- public void setNumAppScanRequest(long n) {
- mNumAppScanRequest = n;
- return;
- }
+ /** @hide */
+ public void setTimeInStateMillis(long[] t) {
+ mTimeInStateMillis = Arrays.copyOfRange(t, 0,
+ Math.min(t.length, BatteryStats.NUM_WIFI_STATES));
+ return;
+ }
- public void setTimeInStateMs(long[] t) {
- mTimeInStateMs = Arrays.copyOfRange(t, 0,
- Math.min(t.length, BatteryStats.NUM_WIFI_STATES));
- return;
- }
+ /** @hide */
+ public void setTimeInRxSignalStrengthLevelMillis(long[] t) {
+ mTimeInRxSignalStrengthLevelMillis = Arrays.copyOfRange(t, 0,
+ Math.min(t.length, BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS));
+ return;
+ }
- public void setTimeInRxSignalStrengthLevelMs(long[] t) {
- mTimeInRxSignalStrengthLevelMs = Arrays.copyOfRange(t, 0,
- Math.min(t.length, BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS));
- return;
- }
+ /** @hide */
+ public void setTimeInSupplicantStateMillis(long[] t) {
+ mTimeInSupplicantStateMillis = Arrays.copyOfRange(
+ t, 0, Math.min(t.length, BatteryStats.NUM_WIFI_SUPPL_STATES));
+ return;
+ }
- public void setTimeInSupplicantStateMs(long[] t) {
- mTimeInSupplicantStateMs = Arrays.copyOfRange(
- t, 0, Math.min(t.length, BatteryStats.NUM_WIFI_SUPPL_STATES));
- return;
- }
+ /** @hide */
+ public void setMonitoredRailChargeConsumedMaMillis(long monitoredRailEnergyConsumedMaMillis) {
+ mMonitoredRailChargeConsumedMaMillis = monitoredRailEnergyConsumedMaMillis;
+ return;
+ }
- public void setMonitoredRailChargeConsumedMaMs(long monitoredRailEnergyConsumedMaMs) {
- mMonitoredRailChargeConsumedMaMs = monitoredRailEnergyConsumedMaMs;
- return;
- }
-
- public int describeContents() {
- return 0;
- }
-
- private WifiBatteryStats(Parcel in) {
- initialize();
- readFromParcel(in);
- }
-
- private void initialize() {
- mLoggingDurationMs = 0;
- mKernelActiveTimeMs = 0;
- mNumPacketsTx = 0;
- mNumBytesTx = 0;
- mNumPacketsRx = 0;
- mNumBytesRx = 0;
- mSleepTimeMs = 0;
- mScanTimeMs = 0;
- mIdleTimeMs = 0;
- mRxTimeMs = 0;
- mTxTimeMs = 0;
- mEnergyConsumedMaMs = 0;
- mNumAppScanRequest = 0;
- mTimeInStateMs = new long[BatteryStats.NUM_WIFI_STATES];
- Arrays.fill(mTimeInStateMs, 0);
- mTimeInRxSignalStrengthLevelMs = new long[BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS];
- Arrays.fill(mTimeInRxSignalStrengthLevelMs, 0);
- mTimeInSupplicantStateMs = new long[BatteryStats.NUM_WIFI_SUPPL_STATES];
- Arrays.fill(mTimeInSupplicantStateMs, 0);
- mMonitoredRailChargeConsumedMaMs = 0;
- return;
- }
-}
\ No newline at end of file
+ private WifiBatteryStats(Parcel in) {
+ readFromParcel(in);
+ }
+}
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 77fd946..0e00d5e 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -104,16 +104,17 @@
* Start DynamicSystem installation. This call may take an unbounded amount of time. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if the partition is read only, e.g. system.
* @return {@code true} if the call succeeds. {@code false} either the device does not contain
* enough space or a DynamicSystem is currently in use where the {@link #isInUse} would be
* true.
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public Session startInstallation(long systemSize, long userdataSize) {
+ public Session startInstallation(String name, long size, boolean readOnly) {
try {
- if (mService.startInstallation(systemSize, userdataSize)) {
+ if (mService.startInstallation(name, size, readOnly)) {
return new Session();
} else {
return null;
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index a6de170..75f6785 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -24,11 +24,12 @@
* Start DynamicSystem installation. This call may take 60~90 seconds. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if this partition is readOnly
* @return true if the call succeeds
*/
- boolean startInstallation(long systemSize, long userdataSize);
+ boolean startInstallation(@utf8InCpp String name, long size, boolean readOnly);
/**
* Query the progress of the current installation operation. This can be called while
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index e456c8a..8b8afd5 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -338,6 +338,15 @@
public static final String NAMESPACE_PRIVACY = "privacy";
/**
+ * Permission related properties definitions.
+ *
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static final String NAMESPACE_PERMISSIONS = "permissions";
+
+ /**
* Interface for accessing keys belonging to {@link #NAMESPACE_WINDOW_MANAGER}.
* @hide
*/
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index bdc7834..b5580d4 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1722,6 +1722,20 @@
= "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
/**
+ * Activity Action: Show Work Policy info.
+ * DPC apps can implement an activity that handles this intent in order to show device policies
+ * associated with the work profile or managed device.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing.
+ *
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_SHOW_WORK_POLICY_INFO =
+ "android.settings.SHOW_WORK_POLICY_INFO";
+
+ /**
* Activity Action: Show screen that let user select its Autofill Service.
* <p>
* Input: Intent's data URI set with an application name, using the
@@ -8594,13 +8608,19 @@
public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
/**
- * URI for the "wireless charging started" and "wired charging started" sound.
+ * URI for the "wireless charging started" sound.
* @hide
*/
- public static final String CHARGING_STARTED_SOUND =
+ public static final String WIRELESS_CHARGING_STARTED_SOUND =
"wireless_charging_started_sound";
/**
+ * URI for "wired charging started" sound.
+ * @hide
+ */
+ public static final String CHARGING_STARTED_SOUND = "charging_started_sound";
+
+ /**
* Whether to play a sound for charging events.
* @deprecated Use {@link android.provider.Settings.Secure#CHARGING_SOUNDS_ENABLED} instead
* @hide
@@ -8803,6 +8823,13 @@
public static final String DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS =
"force_desktop_mode_on_external_displays";
+ /**
+ * Whether to allow non-resizable apps to be freeform.
+ * @hide
+ */
+ public static final String DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM =
+ "enable_sizecompat_freeform";
+
/**
* Whether user has enabled development settings.
*/
diff --git a/core/java/android/service/autofill/SaveInfo.java b/core/java/android/service/autofill/SaveInfo.java
index 94b9d05..48ba429 100644
--- a/core/java/android/service/autofill/SaveInfo.java
+++ b/core/java/android/service/autofill/SaveInfo.java
@@ -181,6 +181,23 @@
public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 0x10;
/**
+ * Type used when the {@link FillResponse} represents a debit card.
+ */
+ public static final int SAVE_DATA_TYPE_DEBIT_CARD = 0x20;
+
+ /**
+ * Type used when the {@link FillResponse} represents a payment card except for credit and
+ * debit cards.
+ */
+ public static final int SAVE_DATA_TYPE_PAYMENT_CARD = 0x40;
+
+ /**
+ * Type used when the {@link FillResponse} represents a card that does not a specified card or
+ * cannot identify what the card is for.
+ */
+ public static final int SAVE_DATA_TYPE_GENERIC_CARD = 0x80;
+
+ /**
* Style for the negative button of the save UI to cancel the
* save operation. In this case, the user tapping the negative
* button signals that they would prefer to not save the filled
@@ -207,6 +224,30 @@
@Retention(RetentionPolicy.SOURCE)
@interface NegativeButtonStyle{}
+ /**
+ * Style for the positive button of save UI to request the save operation.
+ * In this case, the user tapping the positive button signals that they
+ * agrees to save the filled content.
+ */
+ public static final int POSITIVE_BUTTON_STYLE_SAVE = 0;
+
+ /**
+ * Style for the positive button of save UI to have next action before the save operation.
+ * This could be useful if the filled content contains sensitive personally identifiable
+ * information and then requires user confirmation or verification. In this case, the user
+ * tapping the positive button signals that they would complete the next required action
+ * to save the filled content.
+ */
+ public static final int POSITIVE_BUTTON_STYLE_CONTINUE = 1;
+
+ /** @hide */
+ @IntDef(prefix = { "POSITIVE_BUTTON_STYLE_" }, value = {
+ POSITIVE_BUTTON_STYLE_SAVE,
+ POSITIVE_BUTTON_STYLE_CONTINUE
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ @interface PositiveButtonStyle{}
+
/** @hide */
@IntDef(flag = true, prefix = { "SAVE_DATA_TYPE_" }, value = {
SAVE_DATA_TYPE_GENERIC,
@@ -214,7 +255,10 @@
SAVE_DATA_TYPE_ADDRESS,
SAVE_DATA_TYPE_CREDIT_CARD,
SAVE_DATA_TYPE_USERNAME,
- SAVE_DATA_TYPE_EMAIL_ADDRESS
+ SAVE_DATA_TYPE_EMAIL_ADDRESS,
+ SAVE_DATA_TYPE_DEBIT_CARD,
+ SAVE_DATA_TYPE_PAYMENT_CARD,
+ SAVE_DATA_TYPE_GENERIC_CARD
})
@Retention(RetentionPolicy.SOURCE)
@interface SaveDataType{}
@@ -266,6 +310,7 @@
private final @SaveDataType int mType;
private final @NegativeButtonStyle int mNegativeButtonStyle;
+ private final @PositiveButtonStyle int mPositiveButtonStyle;
private final IntentSender mNegativeActionListener;
private final AutofillId[] mRequiredIds;
private final AutofillId[] mOptionalIds;
@@ -281,6 +326,7 @@
mType = builder.mType;
mNegativeButtonStyle = builder.mNegativeButtonStyle;
mNegativeActionListener = builder.mNegativeActionListener;
+ mPositiveButtonStyle = builder.mPositiveButtonStyle;
mRequiredIds = builder.mRequiredIds;
mOptionalIds = builder.mOptionalIds;
mDescription = builder.mDescription;
@@ -313,6 +359,11 @@
}
/** @hide */
+ public @PositiveButtonStyle int getPositiveActionStyle() {
+ return mPositiveButtonStyle;
+ }
+
+ /** @hide */
public @Nullable AutofillId[] getRequiredIds() {
return mRequiredIds;
}
@@ -374,6 +425,7 @@
private final @SaveDataType int mType;
private @NegativeButtonStyle int mNegativeButtonStyle = NEGATIVE_BUTTON_STYLE_CANCEL;
+ private @PositiveButtonStyle int mPositiveButtonStyle = POSITIVE_BUTTON_STYLE_SAVE;
private IntentSender mNegativeActionListener;
private final AutofillId[] mRequiredIds;
private AutofillId[] mOptionalIds;
@@ -394,8 +446,9 @@
* can be any combination of {@link SaveInfo#SAVE_DATA_TYPE_GENERIC},
* {@link SaveInfo#SAVE_DATA_TYPE_PASSWORD},
* {@link SaveInfo#SAVE_DATA_TYPE_ADDRESS}, {@link SaveInfo#SAVE_DATA_TYPE_CREDIT_CARD},
- * {@link SaveInfo#SAVE_DATA_TYPE_USERNAME}, or
- * {@link SaveInfo#SAVE_DATA_TYPE_EMAIL_ADDRESS}.
+ * {@link SaveInfo#SAVE_DATA_TYPE_DEBIT_CARD}, {@link SaveInfo#SAVE_DATA_TYPE_PAYMENT_CARD},
+ * {@link SaveInfo#SAVE_DATA_TYPE_GENERIC_CARD}, {@link SaveInfo#SAVE_DATA_TYPE_USERNAME},
+ * or {@link SaveInfo#SAVE_DATA_TYPE_EMAIL_ADDRESS}.
* @param requiredIds ids of all required views that will trigger a save request.
*
* <p>See {@link SaveInfo} for more info.
@@ -418,8 +471,9 @@
* can be any combination of {@link SaveInfo#SAVE_DATA_TYPE_GENERIC},
* {@link SaveInfo#SAVE_DATA_TYPE_PASSWORD},
* {@link SaveInfo#SAVE_DATA_TYPE_ADDRESS}, {@link SaveInfo#SAVE_DATA_TYPE_CREDIT_CARD},
- * {@link SaveInfo#SAVE_DATA_TYPE_USERNAME}, or
- * {@link SaveInfo#SAVE_DATA_TYPE_EMAIL_ADDRESS}.
+ * {@link SaveInfo#SAVE_DATA_TYPE_DEBIT_CARD}, {@link SaveInfo#SAVE_DATA_TYPE_PAYMENT_CARD},
+ * {@link SaveInfo#SAVE_DATA_TYPE_GENERIC_CARD}, {@link SaveInfo#SAVE_DATA_TYPE_USERNAME},
+ * or {@link SaveInfo#SAVE_DATA_TYPE_EMAIL_ADDRESS}.
*
* <p>See {@link SaveInfo} for more info.
*/
@@ -523,6 +577,8 @@
public @NonNull Builder setNegativeAction(@NegativeButtonStyle int style,
@Nullable IntentSender listener) {
throwIfDestroyed();
+ Preconditions.checkArgumentInRange(style, NEGATIVE_BUTTON_STYLE_CANCEL,
+ NEGATIVE_BUTTON_STYLE_REJECT, "style");
if (style != NEGATIVE_BUTTON_STYLE_CANCEL
&& style != NEGATIVE_BUTTON_STYLE_REJECT) {
throw new IllegalArgumentException("Invalid style: " + style);
@@ -533,6 +589,33 @@
}
/**
+ * Sets the style for the positive save action.
+ *
+ * <p>This allows an autofill service to customize the style of the
+ * positive action in the save UI. Note that selecting the positive
+ * action regardless of its style would dismiss the save UI and calling
+ * into the {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback) save request}.
+ * The service should take the next action if selecting style
+ * {@link #POSITIVE_BUTTON_STYLE_CONTINUE}. The default style is
+ * {@link #POSITIVE_BUTTON_STYLE_SAVE}
+ *
+ * @param style The action style.
+ * @return This builder.
+ *
+ * @see #POSITIVE_BUTTON_STYLE_SAVE
+ * @see #POSITIVE_BUTTON_STYLE_CONTINUE
+ *
+ * @throws IllegalArgumentException If the style is invalid
+ */
+ public @NonNull Builder setPositiveAction(@PositiveButtonStyle int style) {
+ throwIfDestroyed();
+ Preconditions.checkArgumentInRange(style, POSITIVE_BUTTON_STYLE_SAVE,
+ POSITIVE_BUTTON_STYLE_CONTINUE, "style");
+ mPositiveButtonStyle = style;
+ return this;
+ }
+
+ /**
* Sets an object used to validate the user input - if the input is not valid, the
* autofill save UI is not shown.
*
@@ -717,8 +800,10 @@
final StringBuilder builder = new StringBuilder("SaveInfo: [type=")
.append(DebugUtils.flagsToString(SaveInfo.class, "SAVE_DATA_TYPE_", mType))
.append(", requiredIds=").append(Arrays.toString(mRequiredIds))
- .append(", style=").append(DebugUtils.flagsToString(SaveInfo.class,
- "NEGATIVE_BUTTON_STYLE_", mNegativeButtonStyle));
+ .append(", negative style=").append(DebugUtils.flagsToString(SaveInfo.class,
+ "NEGATIVE_BUTTON_STYLE_", mNegativeButtonStyle))
+ .append(", positive style=").append(DebugUtils.flagsToString(SaveInfo.class,
+ "POSITIVE_BUTTON_STYLE_", mPositiveButtonStyle));
if (mOptionalIds != null) {
builder.append(", optionalIds=").append(Arrays.toString(mOptionalIds));
}
@@ -763,6 +848,7 @@
parcel.writeParcelableArray(mOptionalIds, flags);
parcel.writeInt(mNegativeButtonStyle);
parcel.writeParcelable(mNegativeActionListener, flags);
+ parcel.writeInt(mPositiveButtonStyle);
parcel.writeCharSequence(mDescription);
parcel.writeParcelable(mCustomDescription, flags);
parcel.writeParcelable(mValidator, flags);
@@ -794,6 +880,7 @@
}
builder.setNegativeAction(parcel.readInt(), parcel.readParcelable(null));
+ builder.setPositiveAction(parcel.readInt());
builder.setDescription(parcel.readCharSequence());
final CustomDescription customDescripton = parcel.readParcelable(null);
if (customDescripton != null) {
diff --git a/core/java/android/service/contentsuggestions/ContentSuggestionsService.java b/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
index efc8e87..4bcd39f 100644
--- a/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
+++ b/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
@@ -66,12 +66,17 @@
int colorSpaceId, Bundle imageContextRequestExtras) {
Bitmap wrappedBuffer = null;
- if (contextImage != null) {
- ColorSpace colorSpace = null;
- if (colorSpaceId >= 0 && colorSpaceId < ColorSpace.Named.values().length) {
- colorSpace = ColorSpace.get(ColorSpace.Named.values()[colorSpaceId]);
+ if (imageContextRequestExtras.containsKey(ContentSuggestionsManager.EXTRA_BITMAP)) {
+ wrappedBuffer = imageContextRequestExtras.getParcelable(
+ ContentSuggestionsManager.EXTRA_BITMAP);
+ } else {
+ if (contextImage != null) {
+ ColorSpace colorSpace = null;
+ if (colorSpaceId >= 0 && colorSpaceId < ColorSpace.Named.values().length) {
+ colorSpace = ColorSpace.get(ColorSpace.Named.values()[colorSpaceId]);
+ }
+ wrappedBuffer = Bitmap.wrapHardwareBuffer(contextImage, colorSpace);
}
- wrappedBuffer = Bitmap.wrapHardwareBuffer(contextImage, colorSpace);
}
mHandler.sendMessage(
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index 8a9f689..12c2580 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -516,7 +516,7 @@
* @see android.telephony.euicc.EuiccManager#eraseSubscriptions
*
* @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
- * and use @link{onEraseSubscriptionsWithOptions} instead
+ * and use {@link #onEraseSubscriptionsWithOptions(int, int)} instead
*/
@Deprecated
public abstract int onEraseSubscriptions(int slotId);
diff --git a/core/java/android/service/textclassifier/ITextClassifierService.aidl b/core/java/android/service/textclassifier/ITextClassifierService.aidl
index 2f8d67b..da57506 100644
--- a/core/java/android/service/textclassifier/ITextClassifierService.aidl
+++ b/core/java/android/service/textclassifier/ITextClassifierService.aidl
@@ -74,4 +74,6 @@
in TextClassificationSessionId sessionId,
in ConversationActions.Request request,
in ITextClassifierCallback callback);
+
+ void onConnectedStateChanged(int connected);
}
diff --git a/core/java/android/service/textclassifier/TextClassifierService.java b/core/java/android/service/textclassifier/TextClassifierService.java
index 2470d19..4d58ae4 100644
--- a/core/java/android/service/textclassifier/TextClassifierService.java
+++ b/core/java/android/service/textclassifier/TextClassifierService.java
@@ -17,6 +17,7 @@
package android.service.textclassifier;
import android.Manifest;
+import android.annotation.IntDef;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -51,6 +52,8 @@
import com.android.internal.util.Preconditions;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -99,6 +102,18 @@
"android.service.textclassifier.TextClassifierService";
/** @hide **/
+ public static final int CONNECTED = 0;
+ /** @hide **/
+ public static final int DISCONNECTED = 1;
+ /** @hide */
+ @IntDef(value = {
+ CONNECTED,
+ DISCONNECTED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ConnectionState{}
+
+ /** @hide **/
private static final String KEY_RESULT = "key_result";
private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper(), null, true);
@@ -195,6 +210,12 @@
mMainThreadHandler.post(
() -> TextClassifierService.this.onDestroyTextClassificationSession(sessionId));
}
+
+ @Override
+ public void onConnectedStateChanged(@ConnectionState int connected) {
+ mMainThreadHandler.post(connected == CONNECTED ? TextClassifierService.this::onConnected
+ : TextClassifierService.this::onDisconnected);
+ }
};
@Nullable
@@ -206,6 +227,26 @@
return null;
}
+ @Override
+ public boolean onUnbind(@NonNull Intent intent) {
+ onDisconnected();
+ return super.onUnbind(intent);
+ }
+
+ /**
+ * Called when the Android system connects to service.
+ */
+ public void onConnected() {
+ }
+
+ /**
+ * Called when the Android system disconnects from the service.
+ *
+ * <p> At this point this service may no longer be an active {@link TextClassifierService}.
+ */
+ public void onDisconnected() {
+ }
+
/**
* Returns suggested text selection start and end indices, recognized entity types, and their
* associated confidence scores. The entity types are ordered from highest to lowest scoring.
diff --git a/core/java/android/service/voice/AlwaysOnHotwordDetector.java b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
index 94f6a50..cf56eae 100644
--- a/core/java/android/service/voice/AlwaysOnHotwordDetector.java
+++ b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
@@ -20,7 +20,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
-import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.hardware.soundtrigger.IRecognitionStatusCallback;
import android.hardware.soundtrigger.KeyphraseEnrollmentInfo;
@@ -446,7 +446,7 @@
/**
* Creates an intent to start the enrollment for the associated keyphrase.
- * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}.
+ * This intent must be invoked using {@link Context#startForegroundService(Intent)}.
* Starting re-enrollment is only valid if the keyphrase is un-enrolled,
* i.e. {@link #STATE_KEYPHRASE_UNENROLLED},
* otherwise {@link #createReEnrollIntent()} should be preferred.
@@ -468,7 +468,7 @@
/**
* Creates an intent to start the un-enrollment for the associated keyphrase.
- * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}.
+ * This intent must be invoked using {@link Context#startForegroundService(Intent)}.
* Starting re-enrollment is only valid if the keyphrase is already enrolled,
* i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error.
*
@@ -489,7 +489,7 @@
/**
* Creates an intent to start the re-enrollment for the associated keyphrase.
- * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}.
+ * This intent must be invoked using {@link Context#startForegroundService(Intent)}.
* Starting re-enrollment is only valid if the keyphrase is already enrolled,
* i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error.
*
diff --git a/core/java/android/util/LongSparseArray.java b/core/java/android/util/LongSparseArray.java
index e78b796..73e17a6 100644
--- a/core/java/android/util/LongSparseArray.java
+++ b/core/java/android/util/LongSparseArray.java
@@ -17,7 +17,6 @@
package android.util;
import android.os.Parcel;
-import android.os.Parcelable;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.GrowingArrayUtils;
@@ -25,6 +24,8 @@
import libcore.util.EmptyArray;
+import java.util.Arrays;
+
/**
* SparseArray mapping longs to Objects. Unlike a normal array of Objects,
* there can be gaps in the indices. It is intended to be more memory efficient
@@ -450,22 +451,25 @@
/**
* @hide
*/
- public static class StringParcelling implements com.android.internal.util.Parcelling {
+ public static class StringParcelling implements
+ com.android.internal.util.Parcelling<LongSparseArray<String>> {
@Override
- public void parcel(Object item, Parcel dest, int parcelFlags) {
- if (item == null) {
+ public void parcel(LongSparseArray<String> array, Parcel dest, int parcelFlags) {
+ if (array == null) {
dest.writeInt(-1);
return;
}
- LongSparseArray<String> array = (LongSparseArray<String>) item;
- dest.writeInt(array.mSize);
+ int size = array.mSize;
+
+ dest.writeInt(size);
dest.writeLongArray(array.mKeys);
- dest.writeStringArray((String[]) array.mValues);
+
+ dest.writeStringArray(Arrays.copyOfRange(array.mValues, 0, size, String[].class));
}
@Override
- public Object unparcel(Parcel source) {
+ public LongSparseArray<String> unparcel(Parcel source) {
int size = source.readInt();
if (size == -1) {
return null;
@@ -490,49 +494,4 @@
return array;
}
}
-
- /**
- * @hide
- */
- public static class Parcelling<T extends Parcelable> implements
- com.android.internal.util.Parcelling {
- @Override
- public void parcel(Object item, Parcel dest, int parcelFlags) {
- if (item == null) {
- dest.writeInt(-1);
- return;
- }
-
- LongSparseArray<T> array = (LongSparseArray<T>) item;
- dest.writeInt(array.mSize);
- dest.writeLongArray(array.mKeys);
- dest.writeParcelableArray((T[]) array.mValues, parcelFlags);
- }
-
- @Override
- public Object unparcel(Parcel source) {
- int size = source.readInt();
- if (size == -1) {
- return null;
- }
-
- LongSparseArray<T> array = new LongSparseArray<>(0);
- array.mSize = size;
- array.mKeys = source.createLongArray();
- array.mValues = source.readParcelableArray(null);
-
- // Make sure array is sane
- Preconditions.checkArgument(array.mKeys.length >= size);
- Preconditions.checkArgument(array.mValues.length >= size);
-
- if (size > 0) {
- long last = array.mKeys[0];
- for (int i = 1; i < size; i++) {
- Preconditions.checkArgument(last < array.mKeys[i]);
- }
- }
-
- return array;
- }
- }
}
diff --git a/core/java/android/util/LongSparseLongArray.java b/core/java/android/util/LongSparseLongArray.java
index 9ffd4f0..a0edd04 100644
--- a/core/java/android/util/LongSparseLongArray.java
+++ b/core/java/android/util/LongSparseLongArray.java
@@ -289,22 +289,22 @@
/**
* @hide
*/
- public static class Parcelling implements com.android.internal.util.Parcelling {
+ public static class Parcelling implements
+ com.android.internal.util.Parcelling<LongSparseLongArray> {
@Override
- public void parcel(Object item, Parcel dest, int parcelFlags) {
- if (item == null) {
+ public void parcel(LongSparseLongArray array, Parcel dest, int parcelFlags) {
+ if (array == null) {
dest.writeInt(-1);
return;
}
- LongSparseLongArray array = (LongSparseLongArray) item;
dest.writeInt(array.mSize);
dest.writeLongArray(array.mKeys);
dest.writeLongArray(array.mValues);
}
@Override
- public Object unparcel(Parcel source) {
+ public LongSparseLongArray unparcel(Parcel source) {
int size = source.readInt();
if (size == -1) {
return null;
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index 0fb1c33..786dbb0 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -17,6 +17,7 @@
package android.view;
import static android.view.InsetsState.INSET_SIDE_BOTTOM;
+import static android.view.InsetsState.INSET_SIDE_FLOATING;
import static android.view.InsetsState.INSET_SIDE_LEFT;
import static android.view.InsetsState.INSET_SIDE_RIGHT;
import static android.view.InsetsState.INSET_SIDE_TOP;
@@ -151,6 +152,8 @@
updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, mPendingInsets.right, params, state);
updateLeashesForSide(INSET_SIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params,
state);
+ updateLeashesForSide(INSET_SIDE_FLOATING, 0 /* offset */, 0 /* inset */, params, state);
+
SyncRtSurfaceTransactionApplier applier = mTransactionApplierSupplier.get();
applier.scheduleApply(params.toArray(new SurfaceParams[params.size()]));
mCurrentInsets = mPendingInsets;
@@ -238,7 +241,9 @@
// If the system is controlling the insets source, the leash can be null.
if (leash != null) {
surfaceParams.add(new SurfaceParams(leash, 1f /* alpha */, mTmpMatrix,
- null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, inset != 0));
+ null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/,
+ side == INSET_SIDE_FLOATING
+ ? consumer.isVisible() : inset != 0 /* visible */));
}
}
}
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index 99502a6..e9de3f0 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -109,6 +109,7 @@
INSET_SIDE_TOP,
INSET_SIDE_RIGHT,
INSET_SIDE_BOTTOM,
+ INSET_SIDE_FLOATING,
INSET_SIDE_UNKNWON
})
public @interface InsetSide {}
@@ -116,7 +117,8 @@
static final int INSET_SIDE_TOP = 1;
static final int INSET_SIDE_RIGHT = 2;
static final int INSET_SIDE_BOTTOM = 3;
- static final int INSET_SIDE_UNKNWON = 4;
+ static final int INSET_SIDE_FLOATING = 4;
+ static final int INSET_SIDE_UNKNWON = 5;
private final ArrayMap<Integer, InsetsSource> mSources = new ArrayMap<>();
@@ -224,10 +226,10 @@
typeVisibilityMap[index] = source.isVisible();
}
- if (typeSideMap != null && !Insets.NONE.equals(insets)) {
+ if (typeSideMap != null) {
@InsetSide int insetSide = getInsetSide(insets);
if (insetSide != INSET_SIDE_UNKNWON) {
- typeSideMap.put(source.getType(), getInsetSide(insets));
+ typeSideMap.put(source.getType(), insetSide);
}
}
}
@@ -237,6 +239,9 @@
* is set in order that this method returns a meaningful result.
*/
private @InsetSide int getInsetSide(Insets insets) {
+ if (Insets.NONE.equals(insets)) {
+ return INSET_SIDE_FLOATING;
+ }
if (insets.left != 0) {
return INSET_SIDE_LEFT;
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 2f0a4eb..59e9ed1 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -712,6 +712,8 @@
mSurfaceAlpha = 1f;
synchronized (mSurfaceControlLock) {
+ mSurface.release();
+
if (mRtHandlingPositionUpdates) {
mRtReleaseSurfaces = true;
return;
@@ -725,7 +727,6 @@
mTmpTransaction.remove(mBackgroundControl);
mBackgroundControl = null;
}
- mSurface.release();
mTmpTransaction.apply();
}
}
@@ -1198,7 +1199,6 @@
mRtTransaction.remove(mBackgroundControl);
mSurfaceControl = null;
mBackgroundControl = null;
- mSurface.release();
}
mRtHandlingPositionUpdates = false;
}
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 4db6308..f8522ed 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -71,11 +71,24 @@
}
/**
- * Notify the host application that the current page has entered full
- * screen mode. The host application must show the custom View which
- * contains the web contents — video or other HTML content —
- * in full screen mode. Also see "Full screen support" documentation on
- * {@link WebView}.
+ * Notify the host application that the current page has entered full screen mode. After this
+ * call, web content will no longer be rendered in the WebView, but will instead be rendered
+ * in {@code view}. The host application should add this View to a Window which is configured
+ * with {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} flag in order to
+ * actually display this web content full screen.
+ *
+ * <p>The application may explicitly exit fullscreen mode by invoking {@code callback} (ex. when
+ * the user presses the back button). However, this is generally not necessary as the web page
+ * will often show its own UI to close out of fullscreen. Regardless of how the WebView exits
+ * fullscreen mode, WebView will invoke {@link #onHideCustomView()}, signaling for the
+ * application to remove the custom View.
+ *
+ * <p>If this method is not overridden, WebView will report to the web page it does not support
+ * fullscreen mode and will not honor the web page's request to run in fullscreen mode.
+ *
+ * <p class="note"><b>Note:</b> if overriding this method, the application must also override
+ * {@link #onHideCustomView()}.
+ *
* @param view is the View object to be shown.
* @param callback invoke this callback to request the page to exit
* full screen mode.
@@ -98,10 +111,13 @@
CustomViewCallback callback) {};
/**
- * Notify the host application that the current page has exited full
- * screen mode. The host application must hide the custom View, ie. the
- * View passed to {@link #onShowCustomView} when the content entered fullscreen.
- * Also see "Full screen support" documentation on {@link WebView}.
+ * Notify the host application that the current page has exited full screen mode. The host
+ * application must hide the custom View (the View which was previously passed to {@link
+ * #onShowCustomView(View, CustomViewCallback) onShowCustomView()}). After this call, web
+ * content will render in the original WebView again.
+ *
+ * <p class="note"><b>Note:</b> if overriding this method, the application must also override
+ * {@link #onShowCustomView(View, CustomViewCallback) onShowCustomView()}.
*/
public void onHideCustomView() {}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 00c1e29..b1752a4 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -45,8 +45,6 @@
import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
-import android.content.pm.LabeledIntent;
-import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
@@ -61,9 +59,7 @@
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.AnimatedVectorDrawable;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
import android.metrics.LogMaker;
import android.net.Uri;
import android.os.AsyncTask;
@@ -85,7 +81,6 @@
import android.service.chooser.ChooserTargetService;
import android.service.chooser.IChooserTargetResult;
import android.service.chooser.IChooserTargetService;
-import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.HashedStringCache;
@@ -110,6 +105,14 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.app.ResolverListAdapter.ActivityInfoPresentationGetter;
+import com.android.internal.app.ResolverListAdapter.ViewHolder;
+import com.android.internal.app.chooser.ChooserTargetInfo;
+import com.android.internal.app.chooser.DisplayResolveInfo;
+import com.android.internal.app.chooser.NotSelectableTargetInfo;
+import com.android.internal.app.chooser.SelectableTargetInfo;
+import com.android.internal.app.chooser.SelectableTargetInfo.SelectableTargetInfoCommunicator;
+import com.android.internal.app.chooser.TargetInfo;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
@@ -124,7 +127,6 @@
import java.lang.annotation.RetentionPolicy;
import java.text.Collator;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -138,7 +140,9 @@
* for example, those generated by @see android.content.Intent#createChooser(Intent, CharSequence).
*
*/
-public class ChooserActivity extends ResolverActivity {
+public class ChooserActivity extends ResolverActivity implements
+ ChooserListAdapter.ChooserListCommunicator,
+ SelectableTargetInfoCommunicator {
private static final String TAG = "ChooserActivity";
@@ -154,12 +158,6 @@
private static final boolean DEBUG = false;
- /**
- * If {@link #USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS} and this is set to true,
- * {@link AppPredictionManager} will be queried for direct share targets.
- */
- // TODO(b/123089490): Replace with system flag
- private static final boolean USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS = true;
private static final boolean USE_PREDICTION_MANAGER_FOR_SHARE_ACTIVITIES = true;
// TODO(b/123088566) Share these in a better way.
private static final String APP_PREDICTION_SHARE_UI_SURFACE = "share";
@@ -167,24 +165,21 @@
private static final int APP_PREDICTION_SHARE_TARGET_QUERY_PACKAGE_LIMIT = 20;
public static final String APP_PREDICTION_INTENT_FILTER_KEY = "intent_filter";
+ @VisibleForTesting
+ public static final int LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS = 250;
+
private boolean mIsAppPredictorComponentAvailable;
private AppPredictor mAppPredictor;
private AppPredictor.Callback mAppPredictorCallback;
private Map<ChooserTarget, AppTarget> mDirectShareAppTargetCache;
- /**
- * If set to true, use ShortcutManager to retrieve the matching direct share targets, instead of
- * binding to every ChooserTargetService implementation.
- */
- // TODO(b/121287573): Replace with a system flag (setprop?)
- private static final boolean USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS = true;
- private static final boolean USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS = true;
-
public static final int TARGET_TYPE_DEFAULT = 0;
public static final int TARGET_TYPE_CHOOSER_TARGET = 1;
public static final int TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER = 2;
public static final int TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE = 3;
+ private static final boolean USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS = true;
+
@IntDef(flag = false, prefix = { "TARGET_TYPE_" }, value = {
TARGET_TYPE_DEFAULT,
TARGET_TYPE_CHOOSER_TARGET,
@@ -233,10 +228,6 @@
private int mCurrAvailableWidth = 0;
- /** {@link ChooserActivity#getBaseScore} */
- public static final float CALLER_TARGET_SCORE_BOOST = 900.f;
- /** {@link ChooserActivity#getBaseScore} */
- public static final float SHORTCUT_TARGET_SCORE_BOOST = 90.f;
private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment";
// TODO: Update to handle landscape instead of using static value
private static final int MAX_RANKED_TARGETS = 4;
@@ -246,14 +237,9 @@
private static final int MAX_LOG_RANK_POSITION = 12;
- @VisibleForTesting
- public static final int LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS = 250;
-
private static final int MAX_EXTRA_INITIAL_INTENTS = 2;
private static final int MAX_EXTRA_CHOOSER_TARGETS = 2;
- private boolean mListViewDataChanged = false;
-
@Retention(SOURCE)
@IntDef({CONTENT_PREVIEW_FILE, CONTENT_PREVIEW_IMAGE, CONTENT_PREVIEW_TEXT})
private @interface ContentPreviewType {
@@ -266,9 +252,6 @@
private static final int CONTENT_PREVIEW_TEXT = 3;
protected MetricsLogger mMetricsLogger;
- // Sorted list of DisplayResolveInfos for the alphabetical app section.
- private List<ResolverActivity.DisplayResolveInfo> mSortedList = new ArrayList<>();
-
private ContentPreviewCoordinator mPreviewCoord;
private class ContentPreviewCoordinator {
@@ -645,8 +628,7 @@
if (isFinishing() || isDestroyed()) {
return;
}
- // May be null if there are no apps to perform share/open action.
- if (mChooserListAdapter == null) {
+ if (mChooserListAdapter.getCount() == 0) {
return;
}
if (resultList.isEmpty()) {
@@ -775,7 +757,7 @@
@Override
public void onSomePackagesChanged() {
mAdapter.handlePackagesChanged();
- bindProfileView();
+ updateProfileViewButton();
}
};
}
@@ -1191,7 +1173,7 @@
}
}
- @Override
+ @Override // ResolverListCommunicator
public Intent getReplacementIntent(ActivityInfo aInfo, Intent defIntent) {
Intent result = defIntent;
if (mReplacementExtras != null) {
@@ -1231,9 +1213,8 @@
}
@Override
- public void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter) {
+ public void onPrepareAdapterView(AbsListView adapterView, ResolverListAdapter adapter) {
final ListView listView = adapterView instanceof ListView ? (ListView) adapterView : null;
- mChooserListAdapter = (ChooserListAdapter) adapter;
if (mCallerChooserTargets != null && mCallerChooserTargets.length > 0) {
mChooserListAdapter.addServiceResults(null, Lists.newArrayList(mCallerChooserTargets),
TARGET_TYPE_DEFAULT);
@@ -1245,11 +1226,17 @@
}
@Override
+ protected boolean rebuildList() {
+ mChooserListAdapter = (ChooserListAdapter) mAdapter;
+ return rebuildListInternal();
+ }
+
+ @Override
public int getLayoutResource() {
return R.layout.chooser_grid;
}
- @Override
+ @Override // ResolverListCommunicator
public boolean shouldGetActivityMetadata() {
return true;
}
@@ -1328,7 +1315,7 @@
final long selectionCost = System.currentTimeMillis() - mChooserShownTime;
super.startSelected(which, always, filtered);
- if (mChooserListAdapter != null) {
+ if (mChooserListAdapter.getCount() > 0) {
// Log the index of which type of target the user picked.
// Lower values mean the ranking was better.
int cat = 0;
@@ -1342,7 +1329,7 @@
// Log the package name + target name to answer the question if most users
// share to mostly the same person or to a bunch of different people.
ChooserTarget target =
- mChooserListAdapter.mServiceTargets.get(value).getChooserTarget();
+ mChooserListAdapter.getChooserTargetForValue(value);
directTargetHashed = HashedStringCache.getInstance().hashString(
this,
TAG,
@@ -1428,7 +1415,7 @@
continue;
}
final ActivityInfo ai = dri.getResolveInfo().activityInfo;
- if (USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS
+ if (ChooserFlags.USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS
&& sm.hasShareTargets(ai.packageName)) {
// Share targets will be queried from ShortcutManager
continue;
@@ -1817,8 +1804,8 @@
*/
@Nullable
private AppPredictor getAppPredictorForDirectShareIfEnabled() {
- return USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS && !ActivityManager.isLowRamDeviceStatic()
- ? getAppPredictor() : null;
+ return ChooserFlags.USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS
+ && !ActivityManager.isLowRamDeviceStatic() ? getAppPredictor() : null;
}
/**
@@ -1900,24 +1887,18 @@
}
}
- private void updateAlphabeticalList() {
- mSortedList.clear();
- mSortedList.addAll(getDisplayList());
- Collections.sort(mSortedList, new AzInfoComparator(ChooserActivity.this));
- }
-
/**
* Sort intents alphabetically based on display label.
*/
- class AzInfoComparator implements Comparator<ResolverActivity.DisplayResolveInfo> {
+ static class AzInfoComparator implements Comparator<DisplayResolveInfo> {
Collator mCollator;
AzInfoComparator(Context context) {
mCollator = Collator.getInstance(context.getResources().getConfiguration().locale);
}
@Override
- public int compare(ResolverActivity.DisplayResolveInfo lhsp,
- ResolverActivity.DisplayResolveInfo rhsp) {
+ public int compare(
+ DisplayResolveInfo lhsp, DisplayResolveInfo rhsp) {
return mCollator.compare(lhsp.getDisplayLabel(), rhsp.getDisplayLabel());
}
}
@@ -1955,12 +1936,12 @@
}
@Override
- public ResolveListAdapter createAdapter(Context context, List<Intent> payloadIntents,
- Intent[] initialIntents, List<ResolveInfo> rList, int launchedFromUid,
- boolean filterLastUsed) {
- final ChooserListAdapter adapter = new ChooserListAdapter(context, payloadIntents,
- initialIntents, rList, launchedFromUid, filterLastUsed, createListController());
- return adapter;
+ public ResolverListAdapter createAdapter(Context context, List<Intent> payloadIntents,
+ Intent[] initialIntents, List<ResolveInfo> rList,
+ boolean filterLastUsed, boolean useLayoutForBrowsables) {
+ return new ChooserListAdapter(context, payloadIntents,
+ initialIntents, rList, filterLastUsed, createListController(),
+ useLayoutForBrowsables, this, this);
}
@VisibleForTesting
@@ -1999,347 +1980,21 @@
return null;
}
- interface ChooserTargetInfo extends TargetInfo {
- float getModifiedScore();
-
- ChooserTarget getChooserTarget();
-
- /**
- * Do not label as 'equals', since this doesn't quite work
- * as intended with java 8.
- */
- default boolean isSimilar(ChooserTargetInfo other) {
- if (other == null) return false;
-
- ChooserTarget ct1 = getChooserTarget();
- ChooserTarget ct2 = other.getChooserTarget();
-
- // If either is null, there is not enough info to make an informed decision
- // about equality, so just exit
- if (ct1 == null || ct2 == null) return false;
-
- if (ct1.getComponentName().equals(ct2.getComponentName())
- && TextUtils.equals(getDisplayLabel(), other.getDisplayLabel())
- && TextUtils.equals(getExtendedInfo(), other.getExtendedInfo())) {
- return true;
- }
-
- return false;
- }
- }
-
- /**
- * Distinguish between targets that selectable by the user, vs those that are
- * placeholders for the system while information is loading in an async manner.
- */
- abstract class NotSelectableTargetInfo implements ChooserTargetInfo {
-
- public Intent getResolvedIntent() {
- return null;
- }
-
- public ComponentName getResolvedComponentName() {
- return null;
- }
-
- public boolean start(Activity activity, Bundle options) {
- return false;
- }
-
- public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
- return false;
- }
-
- public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
- return false;
- }
-
- public ResolveInfo getResolveInfo() {
- return null;
- }
-
- public CharSequence getDisplayLabel() {
- return null;
- }
-
- public CharSequence getExtendedInfo() {
- return null;
- }
-
- public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
- return null;
- }
-
- public List<Intent> getAllSourceIntents() {
- return null;
- }
-
- public float getModifiedScore() {
- return -0.1f;
- }
-
- public ChooserTarget getChooserTarget() {
- return null;
- }
-
- public boolean isSuspended() {
- return false;
- }
- }
-
- final class PlaceHolderTargetInfo extends NotSelectableTargetInfo {
- public Drawable getDisplayIcon() {
+ static final class PlaceHolderTargetInfo extends NotSelectableTargetInfo {
+ public Drawable getDisplayIcon(Context context) {
AnimatedVectorDrawable avd = (AnimatedVectorDrawable)
- getDrawable(R.drawable.chooser_direct_share_icon_placeholder);
+ context.getDrawable(R.drawable.chooser_direct_share_icon_placeholder);
avd.start(); // Start animation after generation
return avd;
}
}
-
- final class EmptyTargetInfo extends NotSelectableTargetInfo {
- public Drawable getDisplayIcon() {
+ static final class EmptyTargetInfo extends NotSelectableTargetInfo {
+ public Drawable getDisplayIcon(Context context) {
return null;
}
}
- final class SelectableTargetInfo implements ChooserTargetInfo {
- private final DisplayResolveInfo mSourceInfo;
- private final ResolveInfo mBackupResolveInfo;
- private final ChooserTarget mChooserTarget;
- private final String mDisplayLabel;
- private Drawable mBadgeIcon = null;
- private CharSequence mBadgeContentDescription;
- private Drawable mDisplayIcon;
- private final Intent mFillInIntent;
- private final int mFillInFlags;
- private final float mModifiedScore;
- private boolean mIsSuspended = false;
-
- SelectableTargetInfo(DisplayResolveInfo sourceInfo, ChooserTarget chooserTarget,
- float modifiedScore) {
- mSourceInfo = sourceInfo;
- mChooserTarget = chooserTarget;
- mModifiedScore = modifiedScore;
- if (sourceInfo != null) {
- final ResolveInfo ri = sourceInfo.getResolveInfo();
- if (ri != null) {
- final ActivityInfo ai = ri.activityInfo;
- if (ai != null && ai.applicationInfo != null) {
- final PackageManager pm = getPackageManager();
- mBadgeIcon = pm.getApplicationIcon(ai.applicationInfo);
- mBadgeContentDescription = pm.getApplicationLabel(ai.applicationInfo);
- mIsSuspended =
- (ai.applicationInfo.flags & ApplicationInfo.FLAG_SUSPENDED) != 0;
- }
- }
- }
- // TODO(b/121287224): do this in the background thread, and only for selected targets
- mDisplayIcon = getChooserTargetIconDrawable(chooserTarget);
-
- if (sourceInfo != null) {
- mBackupResolveInfo = null;
- } else {
- mBackupResolveInfo = getPackageManager().resolveActivity(getResolvedIntent(), 0);
- }
-
- mFillInIntent = null;
- mFillInFlags = 0;
-
- mDisplayLabel = sanitizeDisplayLabel(chooserTarget.getTitle());
- }
-
- private SelectableTargetInfo(SelectableTargetInfo other, Intent fillInIntent, int flags) {
- mSourceInfo = other.mSourceInfo;
- mBackupResolveInfo = other.mBackupResolveInfo;
- mChooserTarget = other.mChooserTarget;
- mBadgeIcon = other.mBadgeIcon;
- mBadgeContentDescription = other.mBadgeContentDescription;
- mDisplayIcon = other.mDisplayIcon;
- mFillInIntent = fillInIntent;
- mFillInFlags = flags;
- mModifiedScore = other.mModifiedScore;
-
- mDisplayLabel = sanitizeDisplayLabel(mChooserTarget.getTitle());
- }
-
- private String sanitizeDisplayLabel(CharSequence label) {
- SpannableStringBuilder sb = new SpannableStringBuilder(label);
- sb.clearSpans();
- return sb.toString();
- }
-
- public boolean isSuspended() {
- return mIsSuspended;
- }
-
- /**
- * Since ShortcutInfos are returned by ShortcutManager, we can cache the shortcuts and skip
- * the call to LauncherApps#getShortcuts(ShortcutQuery).
- */
- // TODO(121287224): Refactor code to apply the suggestion above
- private Drawable getChooserTargetIconDrawable(ChooserTarget target) {
- Drawable directShareIcon = null;
-
- // First get the target drawable and associated activity info
- final Icon icon = target.getIcon();
- if (icon != null) {
- directShareIcon = icon.loadDrawable(ChooserActivity.this);
- } else if (USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS) {
- Bundle extras = target.getIntentExtras();
- if (extras != null && extras.containsKey(Intent.EXTRA_SHORTCUT_ID)) {
- CharSequence shortcutId = extras.getCharSequence(Intent.EXTRA_SHORTCUT_ID);
- LauncherApps launcherApps = (LauncherApps) getSystemService(
- Context.LAUNCHER_APPS_SERVICE);
- final LauncherApps.ShortcutQuery q = new LauncherApps.ShortcutQuery();
- q.setPackage(target.getComponentName().getPackageName());
- q.setShortcutIds(Arrays.asList(shortcutId.toString()));
- q.setQueryFlags(LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC);
- final List<ShortcutInfo> shortcuts = launcherApps.getShortcuts(q, getUser());
- if (shortcuts != null && shortcuts.size() > 0) {
- directShareIcon = launcherApps.getShortcutIconDrawable(shortcuts.get(0), 0);
- }
- }
- }
-
- if (directShareIcon == null) return null;
-
- ActivityInfo info = null;
- try {
- info = mPm.getActivityInfo(target.getComponentName(), 0);
- } catch (NameNotFoundException error) {
- Log.e(TAG, "Could not find activity associated with ChooserTarget");
- }
-
- if (info == null) return null;
-
- // Now fetch app icon and raster with no badging even in work profile
- Bitmap appIcon = makePresentationGetter(info).getIconBitmap(
- UserHandle.getUserHandleForUid(UserHandle.myUserId()));
-
- // Raster target drawable with appIcon as a badge
- SimpleIconFactory sif = SimpleIconFactory.obtain(ChooserActivity.this);
- Bitmap directShareBadgedIcon = sif.createAppBadgedIconBitmap(directShareIcon, appIcon);
- sif.recycle();
-
- return new BitmapDrawable(getResources(), directShareBadgedIcon);
- }
-
- public float getModifiedScore() {
- return mModifiedScore;
- }
-
- @Override
- public Intent getResolvedIntent() {
- if (mSourceInfo != null) {
- return mSourceInfo.getResolvedIntent();
- }
-
- final Intent targetIntent = new Intent(getTargetIntent());
- targetIntent.setComponent(mChooserTarget.getComponentName());
- targetIntent.putExtras(mChooserTarget.getIntentExtras());
- return targetIntent;
- }
-
- @Override
- public ComponentName getResolvedComponentName() {
- if (mSourceInfo != null) {
- return mSourceInfo.getResolvedComponentName();
- } else if (mBackupResolveInfo != null) {
- return new ComponentName(mBackupResolveInfo.activityInfo.packageName,
- mBackupResolveInfo.activityInfo.name);
- }
- return null;
- }
-
- private Intent getBaseIntentToSend() {
- Intent result = getResolvedIntent();
- if (result == null) {
- Log.e(TAG, "ChooserTargetInfo: no base intent available to send");
- } else {
- result = new Intent(result);
- if (mFillInIntent != null) {
- result.fillIn(mFillInIntent, mFillInFlags);
- }
- result.fillIn(mReferrerFillInIntent, 0);
- }
- return result;
- }
-
- @Override
- public boolean start(Activity activity, Bundle options) {
- throw new RuntimeException("ChooserTargets should be started as caller.");
- }
-
- @Override
- public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
- final Intent intent = getBaseIntentToSend();
- if (intent == null) {
- return false;
- }
- intent.setComponent(mChooserTarget.getComponentName());
- intent.putExtras(mChooserTarget.getIntentExtras());
-
- // Important: we will ignore the target security checks in ActivityManager
- // if and only if the ChooserTarget's target package is the same package
- // where we got the ChooserTargetService that provided it. This lets a
- // ChooserTargetService provide a non-exported or permission-guarded target
- // to the chooser for the user to pick.
- //
- // If mSourceInfo is null, we got this ChooserTarget from the caller or elsewhere
- // so we'll obey the caller's normal security checks.
- final boolean ignoreTargetSecurity = mSourceInfo != null
- && mSourceInfo.getResolvedComponentName().getPackageName()
- .equals(mChooserTarget.getComponentName().getPackageName());
- return activity.startAsCallerImpl(intent, options, ignoreTargetSecurity, userId);
- }
-
- @Override
- public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
- throw new RuntimeException("ChooserTargets should be started as caller.");
- }
-
- @Override
- public ResolveInfo getResolveInfo() {
- return mSourceInfo != null ? mSourceInfo.getResolveInfo() : mBackupResolveInfo;
- }
-
- @Override
- public CharSequence getDisplayLabel() {
- return mDisplayLabel;
- }
-
- @Override
- public CharSequence getExtendedInfo() {
- // ChooserTargets have badge icons, so we won't show the extended info to disambiguate.
- return null;
- }
-
- @Override
- public Drawable getDisplayIcon() {
- return mDisplayIcon;
- }
-
- public ChooserTarget getChooserTarget() {
- return mChooserTarget;
- }
-
- @Override
- public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
- return new SelectableTargetInfo(this, fillInIntent, flags);
- }
-
- @Override
- public List<Intent> getAllSourceIntents() {
- final List<Intent> results = new ArrayList<>();
- if (mSourceInfo != null) {
- // We only queried the service for the first one in our sourceinfo.
- results.add(mSourceInfo.getAllSourceIntents().get(0));
- }
- return results;
- }
- }
-
private void handleScroll(View view, int x, int y, int oldx, int oldy) {
if (mChooserRowAdapter != null) {
mChooserRowAdapter.handleScroll(view, y, oldy);
@@ -2408,7 +2063,8 @@
boolean isExpandable = getResources().getConfiguration().orientation
== Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode();
- if (directShareHeight != 0 && isSendAction(getTargetIntent()) && isExpandable) {
+ if (directShareHeight != 0 && isSendAction(getTargetIntent())
+ && isExpandable) {
// make sure to leave room for direct share 4->8 expansion
int requiredExpansionHeight =
(int) (directShareHeight / DIRECT_SHARE_EXPANSION_RATE);
@@ -2424,485 +2080,6 @@
}
}
- public class ChooserListAdapter extends ResolveListAdapter {
- public static final int TARGET_BAD = -1;
- public static final int TARGET_CALLER = 0;
- public static final int TARGET_SERVICE = 1;
- public static final int TARGET_STANDARD = 2;
- public static final int TARGET_STANDARD_AZ = 3;
-
- private static final int MAX_SUGGESTED_APP_TARGETS = 4;
- private static final int MAX_CHOOSER_TARGETS_PER_APP = 2;
-
- private static final int MAX_SERVICE_TARGETS = 8;
-
- private final int mMaxShortcutTargetsPerApp =
- getResources().getInteger(R.integer.config_maxShortcutTargetsPerApp);
-
- private int mNumShortcutResults = 0;
-
- // Reserve spots for incoming direct share targets by adding placeholders
- private ChooserTargetInfo mPlaceHolderTargetInfo = new PlaceHolderTargetInfo();
- private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
- private final List<TargetInfo> mCallerTargets = new ArrayList<>();
-
- private final BaseChooserTargetComparator mBaseTargetComparator
- = new BaseChooserTargetComparator();
-
- public ChooserListAdapter(Context context, List<Intent> payloadIntents,
- Intent[] initialIntents, List<ResolveInfo> rList, int launchedFromUid,
- boolean filterLastUsed, ResolverListController resolverListController) {
- // Don't send the initial intents through the shared ResolverActivity path,
- // we want to separate them into a different section.
- super(context, payloadIntents, null, rList, launchedFromUid, filterLastUsed,
- resolverListController);
-
- createPlaceHolders();
-
- if (initialIntents != null) {
- final PackageManager pm = getPackageManager();
- for (int i = 0; i < initialIntents.length; i++) {
- final Intent ii = initialIntents[i];
- if (ii == null) {
- continue;
- }
-
- // We reimplement Intent#resolveActivityInfo here because if we have an
- // implicit intent, we want the ResolveInfo returned by PackageManager
- // instead of one we reconstruct ourselves. The ResolveInfo returned might
- // have extra metadata and resolvePackageName set and we want to respect that.
- ResolveInfo ri = null;
- ActivityInfo ai = null;
- final ComponentName cn = ii.getComponent();
- if (cn != null) {
- try {
- ai = pm.getActivityInfo(ii.getComponent(), 0);
- ri = new ResolveInfo();
- ri.activityInfo = ai;
- } catch (PackageManager.NameNotFoundException ignored) {
- // ai will == null below
- }
- }
- if (ai == null) {
- ri = pm.resolveActivity(ii, PackageManager.MATCH_DEFAULT_ONLY);
- ai = ri != null ? ri.activityInfo : null;
- }
- if (ai == null) {
- Log.w(TAG, "No activity found for " + ii);
- continue;
- }
- UserManager userManager =
- (UserManager) getSystemService(Context.USER_SERVICE);
- if (ii instanceof LabeledIntent) {
- LabeledIntent li = (LabeledIntent) ii;
- ri.resolvePackageName = li.getSourcePackage();
- ri.labelRes = li.getLabelResource();
- ri.nonLocalizedLabel = li.getNonLocalizedLabel();
- ri.icon = li.getIconResource();
- ri.iconResourceId = ri.icon;
- }
- if (userManager.isManagedProfile()) {
- ri.noResourceId = true;
- ri.icon = 0;
- }
- ResolveInfoPresentationGetter getter = makePresentationGetter(ri);
- mCallerTargets.add(new DisplayResolveInfo(ii, ri,
- getter.getLabel(), getter.getSubLabel(), ii));
- }
- }
- }
-
- @Override
- public void handlePackagesChanged() {
- if (DEBUG) {
- Log.d(TAG, "clearing queryTargets on package change");
- }
- createPlaceHolders();
- mServicesRequested.clear();
- notifyDataSetChanged();
-
- super.handlePackagesChanged();
- }
-
- @Override
- public void notifyDataSetChanged() {
- if (!mListViewDataChanged) {
- mChooserHandler.sendEmptyMessageDelayed(ChooserHandler.LIST_VIEW_UPDATE_MESSAGE,
- LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
- mListViewDataChanged = true;
- }
- }
-
- private void refreshListView() {
- if (mListViewDataChanged) {
- super.notifyDataSetChanged();
- }
- mListViewDataChanged = false;
- }
-
-
- private void createPlaceHolders() {
- mNumShortcutResults = 0;
- mServiceTargets.clear();
- for (int i = 0; i < MAX_SERVICE_TARGETS; i++) {
- mServiceTargets.add(mPlaceHolderTargetInfo);
- }
- }
-
- @Override
- public View onCreateView(ViewGroup parent) {
- return mInflater.inflate(
- com.android.internal.R.layout.resolve_grid_item, parent, false);
- }
-
- @Override
- protected void onBindView(View view, TargetInfo info) {
- super.onBindView(view, info);
-
- // If target is loading, show a special placeholder shape in the label, make unclickable
- final ViewHolder holder = (ViewHolder) view.getTag();
- if (info instanceof PlaceHolderTargetInfo) {
- final int maxWidth = getResources().getDimensionPixelSize(
- R.dimen.chooser_direct_share_label_placeholder_max_width);
- holder.text.setMaxWidth(maxWidth);
- holder.text.setBackground(getResources().getDrawable(
- R.drawable.chooser_direct_share_label_placeholder, getTheme()));
- // Prevent rippling by removing background containing ripple
- holder.itemView.setBackground(null);
- } else {
- holder.text.setMaxWidth(Integer.MAX_VALUE);
- holder.text.setBackground(null);
- holder.itemView.setBackground(holder.defaultItemViewBackground);
- }
- }
-
- /**
- * Rather than fully sorting the input list, this sorting task will put the top k elements
- * in the head of input list and fill the tail with other elements in undetermined order.
- */
- @Override
- AsyncTask<List<ResolvedComponentInfo>,
- Void,
- List<ResolvedComponentInfo>> createSortingTask() {
- return new AsyncTask<List<ResolvedComponentInfo>,
- Void,
- List<ResolvedComponentInfo>>() {
- @Override
- protected List<ResolvedComponentInfo> doInBackground(
- List<ResolvedComponentInfo>... params) {
- mResolverListController.topK(params[0],
- getMaxRankedTargets());
- return params[0];
- }
-
- @Override
- protected void onPostExecute(List<ResolvedComponentInfo> sortedComponents) {
- processSortedList(sortedComponents);
- bindProfileView();
- notifyDataSetChanged();
- }
- };
- }
-
- @Override
- public void onListRebuilt() {
- updateAlphabeticalList();
-
- // don't support direct share on low ram devices
- if (ActivityManager.isLowRamDeviceStatic()) {
- return;
- }
-
- if (USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS
- || USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS) {
- if (DEBUG) {
- Log.d(TAG, "querying direct share targets from ShortcutManager");
- }
-
- queryDirectShareTargets(this, false);
- }
- if (USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS) {
- if (DEBUG) {
- Log.d(TAG, "List built querying services");
- }
-
- queryTargetServices(this);
- }
- }
-
- @Override
- public boolean shouldGetResolvedFilter() {
- return true;
- }
-
- @Override
- public int getCount() {
- return getRankedTargetCount() + getAlphaTargetCount()
- + getSelectableServiceTargetCount() + getCallerTargetCount();
- }
-
- @Override
- public int getUnfilteredCount() {
- int appTargets = super.getUnfilteredCount();
- if (appTargets > getMaxRankedTargets()) {
- appTargets = appTargets + getMaxRankedTargets();
- }
- return appTargets + getSelectableServiceTargetCount() + getCallerTargetCount();
- }
-
-
- public int getCallerTargetCount() {
- return Math.min(mCallerTargets.size(), MAX_SUGGESTED_APP_TARGETS);
- }
-
- /**
- * Filter out placeholders and non-selectable service targets
- */
- public int getSelectableServiceTargetCount() {
- int count = 0;
- for (ChooserTargetInfo info : mServiceTargets) {
- if (info instanceof SelectableTargetInfo) {
- count++;
- }
- }
- return count;
- }
-
- public int getServiceTargetCount() {
- if (isSendAction(getTargetIntent()) && !ActivityManager.isLowRamDeviceStatic()) {
- return Math.min(mServiceTargets.size(), MAX_SERVICE_TARGETS);
- }
-
- return 0;
- }
-
- int getAlphaTargetCount() {
- int standardCount = super.getCount();
- return standardCount > getMaxRankedTargets() ? standardCount : 0;
- }
-
- int getRankedTargetCount() {
- int spacesAvailable = getMaxRankedTargets() - getCallerTargetCount();
- return Math.min(spacesAvailable, super.getCount());
- }
-
- private int getMaxRankedTargets() {
- return mChooserRowAdapter == null ? 4 : mChooserRowAdapter.getMaxTargetsPerRow();
- }
-
- public int getPositionTargetType(int position) {
- int offset = 0;
-
- final int serviceTargetCount = getServiceTargetCount();
- if (position < serviceTargetCount) {
- return TARGET_SERVICE;
- }
- offset += serviceTargetCount;
-
- final int callerTargetCount = getCallerTargetCount();
- if (position - offset < callerTargetCount) {
- return TARGET_CALLER;
- }
- offset += callerTargetCount;
-
- final int rankedTargetCount = getRankedTargetCount();
- if (position - offset < rankedTargetCount) {
- return TARGET_STANDARD;
- }
- offset += rankedTargetCount;
-
- final int standardTargetCount = getAlphaTargetCount();
- if (position - offset < standardTargetCount) {
- return TARGET_STANDARD_AZ;
- }
-
- return TARGET_BAD;
- }
-
- @Override
- public TargetInfo getItem(int position) {
- return targetInfoForPosition(position, true);
- }
-
-
- /**
- * Find target info for a given position.
- * Since ChooserActivity displays several sections of content, determine which
- * section provides this item.
- */
- @Override
- public TargetInfo targetInfoForPosition(int position, boolean filtered) {
- int offset = 0;
-
- // Direct share targets
- final int serviceTargetCount = filtered ? getServiceTargetCount() :
- getSelectableServiceTargetCount();
- if (position < serviceTargetCount) {
- return mServiceTargets.get(position);
- }
- offset += serviceTargetCount;
-
- // Targets provided by calling app
- final int callerTargetCount = getCallerTargetCount();
- if (position - offset < callerTargetCount) {
- return mCallerTargets.get(position - offset);
- }
- offset += callerTargetCount;
-
- // Ranked standard app targets
- final int rankedTargetCount = getRankedTargetCount();
- if (position - offset < rankedTargetCount) {
- return filtered ? super.getItem(position - offset)
- : getDisplayResolveInfo(position - offset);
- }
- offset += rankedTargetCount;
-
- // Alphabetical complete app target list.
- if (position - offset < getAlphaTargetCount() && !mSortedList.isEmpty()) {
- return mSortedList.get(position - offset);
- }
-
- return null;
- }
-
-
- /**
- * Evaluate targets for inclusion in the direct share area. May not be included
- * if score is too low.
- */
- public void addServiceResults(DisplayResolveInfo origTarget, List<ChooserTarget> targets,
- @ShareTargetType int targetType) {
- if (DEBUG) {
- Log.d(TAG, "addServiceResults " + origTarget + ", " + targets.size()
- + " targets");
- }
-
- if (targets.size() == 0) {
- return;
- }
-
- final float baseScore = getBaseScore(origTarget, targetType);
- Collections.sort(targets, mBaseTargetComparator);
-
- final boolean isShortcutResult =
- (targetType == TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER
- || targetType == TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE);
- final int maxTargets = isShortcutResult ? mMaxShortcutTargetsPerApp
- : MAX_CHOOSER_TARGETS_PER_APP;
- float lastScore = 0;
- boolean shouldNotify = false;
- for (int i = 0, count = Math.min(targets.size(), maxTargets); i < count; i++) {
- final ChooserTarget target = targets.get(i);
- float targetScore = target.getScore();
- targetScore *= baseScore;
- if (i > 0 && targetScore >= lastScore) {
- // Apply a decay so that the top app can't crowd out everything else.
- // This incents ChooserTargetServices to define what's truly better.
- targetScore = lastScore * 0.95f;
- }
- boolean isInserted = insertServiceTarget(
- new SelectableTargetInfo(origTarget, target, targetScore));
-
- if (isInserted && isShortcutResult) {
- mNumShortcutResults++;
- }
-
- shouldNotify |= isInserted;
-
- if (DEBUG) {
- Log.d(TAG, " => " + target.toString() + " score=" + targetScore
- + " base=" + target.getScore()
- + " lastScore=" + lastScore
- + " baseScore=" + baseScore);
- }
-
- lastScore = targetScore;
- }
-
- if (shouldNotify) {
- notifyDataSetChanged();
- }
- }
-
- private int getNumShortcutResults() {
- return mNumShortcutResults;
- }
-
- /**
- * Use the scoring system along with artificial boosts to create up to 4 distinct buckets:
- * <ol>
- * <li>App-supplied targets
- * <li>Shortcuts ranked via App Prediction Manager
- * <li>Shortcuts ranked via legacy heuristics
- * <li>Legacy direct share targets
- * </ol>
- */
- public float getBaseScore(DisplayResolveInfo target, @ShareTargetType int targetType) {
- if (target == null) {
- return CALLER_TARGET_SCORE_BOOST;
- }
-
- if (targetType == TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE) {
- return SHORTCUT_TARGET_SCORE_BOOST;
- }
-
- float score = super.getScore(target);
- if (targetType == TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER) {
- return score * SHORTCUT_TARGET_SCORE_BOOST;
- }
-
- return score;
- }
-
- /**
- * Calling this marks service target loading complete, and will attempt to no longer
- * update the direct share area.
- */
- public void completeServiceTargetLoading() {
- mServiceTargets.removeIf(o -> o instanceof PlaceHolderTargetInfo);
-
- if (mServiceTargets.isEmpty()) {
- mServiceTargets.add(new EmptyTargetInfo());
- }
- notifyDataSetChanged();
- }
-
- private boolean insertServiceTarget(ChooserTargetInfo chooserTargetInfo) {
- // Avoid inserting any potentially late results
- if (mServiceTargets.size() == 1
- && mServiceTargets.get(0) instanceof EmptyTargetInfo) {
- return false;
- }
-
- // Check for duplicates and abort if found
- for (ChooserTargetInfo otherTargetInfo : mServiceTargets) {
- if (chooserTargetInfo.isSimilar(otherTargetInfo)) {
- return false;
- }
- }
-
- int currentSize = mServiceTargets.size();
- final float newScore = chooserTargetInfo.getModifiedScore();
- for (int i = 0; i < Math.min(currentSize, MAX_SERVICE_TARGETS); i++) {
- final ChooserTargetInfo serviceTarget = mServiceTargets.get(i);
- if (serviceTarget == null) {
- mServiceTargets.set(i, chooserTargetInfo);
- return true;
- } else if (newScore > serviceTarget.getModifiedScore()) {
- mServiceTargets.add(i, chooserTargetInfo);
- return true;
- }
- }
-
- if (currentSize < MAX_SERVICE_TARGETS) {
- mServiceTargets.add(chooserTargetInfo);
- return true;
- }
-
- return false;
- }
- }
-
static class BaseChooserTargetComparator implements Comparator<ChooserTarget> {
@Override
public int compare(ChooserTarget lhs, ChooserTarget rhs) {
@@ -2911,8 +2088,77 @@
}
}
+ @Override // ResolverListCommunicator
+ public void onHandlePackagesChanged() {
+ mServicesRequested.clear();
+ mAdapter.notifyDataSetChanged();
+ super.onHandlePackagesChanged();
+ }
- private boolean isSendAction(Intent targetIntent) {
+ @Override // SelectableTargetInfoCommunicator
+ public ActivityInfoPresentationGetter makePresentationGetter(ActivityInfo info) {
+ return mChooserListAdapter.makePresentationGetter(info);
+ }
+
+ @Override // SelectableTargetInfoCommunicator
+ public Intent getReferrerFillInIntent() {
+ return mReferrerFillInIntent;
+ }
+
+ @Override // ChooserListCommunicator
+ public int getMaxRankedTargets() {
+ return mChooserRowAdapter == null ? 4 : mChooserRowAdapter.getMaxTargetsPerRow();
+ }
+
+ @Override // ChooserListCommunicator
+ public void sendListViewUpdateMessage() {
+ mChooserHandler.sendEmptyMessageDelayed(ChooserHandler.LIST_VIEW_UPDATE_MESSAGE,
+ LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
+ }
+
+ @Override
+ public void onListRebuilt() {
+ if (mChooserListAdapter.mDisplayList == null
+ || mChooserListAdapter.mDisplayList.isEmpty()) {
+ mChooserListAdapter.notifyDataSetChanged();
+ } else {
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... voids) {
+ mChooserListAdapter.updateAlphabeticalList();
+ return null;
+ }
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ mChooserListAdapter.notifyDataSetChanged();
+ }
+ }.execute();
+ }
+
+ // don't support direct share on low ram devices
+ if (ActivityManager.isLowRamDeviceStatic()) {
+ return;
+ }
+
+ if (ChooserFlags.USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS
+ || ChooserFlags.USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS) {
+ if (DEBUG) {
+ Log.d(TAG, "querying direct share targets from ShortcutManager");
+ }
+
+ queryDirectShareTargets(mChooserListAdapter, false);
+ }
+ if (USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS) {
+ if (DEBUG) {
+ Log.d(TAG, "List built querying services");
+ }
+
+ queryTargetServices(mChooserListAdapter);
+ }
+ }
+
+ @Override // ChooserListCommunicator
+ public boolean isSendAction(Intent targetIntent) {
if (targetIntent == null) {
return false;
}
@@ -3067,7 +2313,8 @@
// There can be at most one row in the listview, that is internally
// a ViewGroup with 2 rows
public int getServiceTargetRowCount() {
- if (isSendAction(getTargetIntent()) && !ActivityManager.isLowRamDeviceStatic()) {
+ if (isSendAction(getTargetIntent())
+ && !ActivityManager.isLowRamDeviceStatic()) {
return 1;
}
return 0;
@@ -3164,7 +2411,7 @@
getResources().getDrawable(R.drawable.chooser_row_layer_list, null));
mProfileView = profileRow.findViewById(R.id.profile_button);
mProfileView.setOnClickListener(ChooserActivity.this::onProfileClick);
- bindProfileView();
+ updateProfileViewButton();
return profileRow;
}
diff --git a/core/java/com/android/internal/app/ChooserFlags.java b/core/java/com/android/internal/app/ChooserFlags.java
new file mode 100644
index 0000000..f1f1dbf
--- /dev/null
+++ b/core/java/com/android/internal/app/ChooserFlags.java
@@ -0,0 +1,38 @@
+/*
+ * 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.internal.app;
+
+import android.app.prediction.AppPredictionManager;
+
+/**
+ * Common flags for {@link ChooserListAdapter} and {@link ChooserActivity}.
+ */
+public class ChooserFlags {
+ /**
+ * If set to true, use ShortcutManager to retrieve the matching direct share targets, instead of
+ * binding to every ChooserTargetService implementation.
+ */
+ // TODO(b/121287573): Replace with a system flag (setprop?)
+ public static final boolean USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS = true;
+
+ /**
+ * If {@link ChooserFlags#USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS} and this is set to true,
+ * {@link AppPredictionManager} will be queried for direct share targets.
+ */
+ // TODO(b/123089490): Replace with system flag
+ static final boolean USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS = true;
+}
diff --git a/core/java/com/android/internal/app/ChooserListAdapter.java b/core/java/com/android/internal/app/ChooserListAdapter.java
new file mode 100644
index 0000000..6eb470f
--- /dev/null
+++ b/core/java/com/android/internal/app/ChooserListAdapter.java
@@ -0,0 +1,539 @@
+/*
+ * 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.internal.app;
+
+import static com.android.internal.app.ChooserActivity.TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE;
+import static com.android.internal.app.ChooserActivity.TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER;
+
+import android.app.ActivityManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.LabeledIntent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.AsyncTask;
+import android.os.UserManager;
+import android.service.chooser.ChooserTarget;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.internal.R;
+import com.android.internal.app.ResolverActivity.ResolvedComponentInfo;
+import com.android.internal.app.chooser.ChooserTargetInfo;
+import com.android.internal.app.chooser.DisplayResolveInfo;
+import com.android.internal.app.chooser.SelectableTargetInfo;
+import com.android.internal.app.chooser.TargetInfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ChooserListAdapter extends ResolverListAdapter {
+ private static final String TAG = "ChooserListAdapter";
+ private static final boolean DEBUG = false;
+
+ public static final int TARGET_BAD = -1;
+ public static final int TARGET_CALLER = 0;
+ public static final int TARGET_SERVICE = 1;
+ public static final int TARGET_STANDARD = 2;
+ public static final int TARGET_STANDARD_AZ = 3;
+
+ private static final int MAX_SUGGESTED_APP_TARGETS = 4;
+ private static final int MAX_CHOOSER_TARGETS_PER_APP = 2;
+
+ static final int MAX_SERVICE_TARGETS = 8;
+
+ /** {@link #getBaseScore} */
+ public static final float CALLER_TARGET_SCORE_BOOST = 900.f;
+ /** {@link #getBaseScore} */
+ public static final float SHORTCUT_TARGET_SCORE_BOOST = 90.f;
+
+ private final int mMaxShortcutTargetsPerApp;
+ private final ChooserListCommunicator mChooserListCommunicator;
+ private final SelectableTargetInfo.SelectableTargetInfoCommunicator
+ mSelectableTargetInfoComunicator;
+
+ private int mNumShortcutResults = 0;
+
+ // Reserve spots for incoming direct share targets by adding placeholders
+ private ChooserTargetInfo
+ mPlaceHolderTargetInfo = new ChooserActivity.PlaceHolderTargetInfo();
+ private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
+ private final List<TargetInfo> mCallerTargets = new ArrayList<>();
+
+ private final ChooserActivity.BaseChooserTargetComparator mBaseTargetComparator =
+ new ChooserActivity.BaseChooserTargetComparator();
+ private boolean mListViewDataChanged = false;
+
+ // Sorted list of DisplayResolveInfos for the alphabetical app section.
+ private List<DisplayResolveInfo> mSortedList = new ArrayList<>();
+
+ public ChooserListAdapter(Context context, List<Intent> payloadIntents,
+ Intent[] initialIntents, List<ResolveInfo> rList,
+ boolean filterLastUsed, ResolverListController resolverListController,
+ boolean useLayoutForBrowsables,
+ ChooserListCommunicator chooserListCommunicator,
+ SelectableTargetInfo.SelectableTargetInfoCommunicator selectableTargetInfoComunicator) {
+ // Don't send the initial intents through the shared ResolverActivity path,
+ // we want to separate them into a different section.
+ super(context, payloadIntents, null, rList, filterLastUsed,
+ resolverListController, useLayoutForBrowsables,
+ chooserListCommunicator);
+
+ createPlaceHolders();
+ mMaxShortcutTargetsPerApp =
+ context.getResources().getInteger(R.integer.config_maxShortcutTargetsPerApp);
+ mChooserListCommunicator = chooserListCommunicator;
+ mSelectableTargetInfoComunicator = selectableTargetInfoComunicator;
+
+ if (initialIntents != null) {
+ final PackageManager pm = context.getPackageManager();
+ for (int i = 0; i < initialIntents.length; i++) {
+ final Intent ii = initialIntents[i];
+ if (ii == null) {
+ continue;
+ }
+
+ // We reimplement Intent#resolveActivityInfo here because if we have an
+ // implicit intent, we want the ResolveInfo returned by PackageManager
+ // instead of one we reconstruct ourselves. The ResolveInfo returned might
+ // have extra metadata and resolvePackageName set and we want to respect that.
+ ResolveInfo ri = null;
+ ActivityInfo ai = null;
+ final ComponentName cn = ii.getComponent();
+ if (cn != null) {
+ try {
+ ai = pm.getActivityInfo(ii.getComponent(), 0);
+ ri = new ResolveInfo();
+ ri.activityInfo = ai;
+ } catch (PackageManager.NameNotFoundException ignored) {
+ // ai will == null below
+ }
+ }
+ if (ai == null) {
+ ri = pm.resolveActivity(ii, PackageManager.MATCH_DEFAULT_ONLY);
+ ai = ri != null ? ri.activityInfo : null;
+ }
+ if (ai == null) {
+ Log.w(TAG, "No activity found for " + ii);
+ continue;
+ }
+ UserManager userManager =
+ (UserManager) context.getSystemService(Context.USER_SERVICE);
+ if (ii instanceof LabeledIntent) {
+ LabeledIntent li = (LabeledIntent) ii;
+ ri.resolvePackageName = li.getSourcePackage();
+ ri.labelRes = li.getLabelResource();
+ ri.nonLocalizedLabel = li.getNonLocalizedLabel();
+ ri.icon = li.getIconResource();
+ ri.iconResourceId = ri.icon;
+ }
+ if (userManager.isManagedProfile()) {
+ ri.noResourceId = true;
+ ri.icon = 0;
+ }
+ mCallerTargets.add(new DisplayResolveInfo(ii, ri, ii, makePresentationGetter(ri)));
+ }
+ }
+ }
+
+ @Override
+ public void handlePackagesChanged() {
+ if (DEBUG) {
+ Log.d(TAG, "clearing queryTargets on package change");
+ }
+ createPlaceHolders();
+ mChooserListCommunicator.onHandlePackagesChanged();
+
+ }
+
+ @Override
+ public void notifyDataSetChanged() {
+ if (!mListViewDataChanged) {
+ mChooserListCommunicator.sendListViewUpdateMessage();
+ mListViewDataChanged = true;
+ }
+ }
+
+ void refreshListView() {
+ if (mListViewDataChanged) {
+ super.notifyDataSetChanged();
+ }
+ mListViewDataChanged = false;
+ }
+
+
+ private void createPlaceHolders() {
+ mNumShortcutResults = 0;
+ mServiceTargets.clear();
+ for (int i = 0; i < MAX_SERVICE_TARGETS; i++) {
+ mServiceTargets.add(mPlaceHolderTargetInfo);
+ }
+ }
+
+ @Override
+ public View onCreateView(ViewGroup parent) {
+ return mInflater.inflate(
+ com.android.internal.R.layout.resolve_grid_item, parent, false);
+ }
+
+ @Override
+ protected void onBindView(View view, TargetInfo info) {
+ super.onBindView(view, info);
+
+ // If target is loading, show a special placeholder shape in the label, make unclickable
+ final ViewHolder holder = (ViewHolder) view.getTag();
+ if (info instanceof ChooserActivity.PlaceHolderTargetInfo) {
+ final int maxWidth = mContext.getResources().getDimensionPixelSize(
+ R.dimen.chooser_direct_share_label_placeholder_max_width);
+ holder.text.setMaxWidth(maxWidth);
+ holder.text.setBackground(mContext.getResources().getDrawable(
+ R.drawable.chooser_direct_share_label_placeholder, mContext.getTheme()));
+ // Prevent rippling by removing background containing ripple
+ holder.itemView.setBackground(null);
+ } else {
+ holder.text.setMaxWidth(Integer.MAX_VALUE);
+ holder.text.setBackground(null);
+ holder.itemView.setBackground(holder.defaultItemViewBackground);
+ }
+ }
+
+ void updateAlphabeticalList() {
+ mSortedList.clear();
+ mSortedList.addAll(mDisplayList);
+ Collections.sort(mSortedList, new ChooserActivity.AzInfoComparator(mContext));
+ }
+
+ @Override
+ public boolean shouldGetResolvedFilter() {
+ return true;
+ }
+
+ @Override
+ public int getCount() {
+ return getRankedTargetCount() + getAlphaTargetCount()
+ + getSelectableServiceTargetCount() + getCallerTargetCount();
+ }
+
+ @Override
+ public int getUnfilteredCount() {
+ int appTargets = super.getUnfilteredCount();
+ if (appTargets > mChooserListCommunicator.getMaxRankedTargets()) {
+ appTargets = appTargets + mChooserListCommunicator.getMaxRankedTargets();
+ }
+ return appTargets + getSelectableServiceTargetCount() + getCallerTargetCount();
+ }
+
+
+ public int getCallerTargetCount() {
+ return Math.min(mCallerTargets.size(), MAX_SUGGESTED_APP_TARGETS);
+ }
+
+ /**
+ * Filter out placeholders and non-selectable service targets
+ */
+ public int getSelectableServiceTargetCount() {
+ int count = 0;
+ for (ChooserTargetInfo info : mServiceTargets) {
+ if (info instanceof SelectableTargetInfo) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ public int getServiceTargetCount() {
+ if (mChooserListCommunicator.isSendAction(mChooserListCommunicator.getTargetIntent())
+ && !ActivityManager.isLowRamDeviceStatic()) {
+ return Math.min(mServiceTargets.size(), MAX_SERVICE_TARGETS);
+ }
+
+ return 0;
+ }
+
+ int getAlphaTargetCount() {
+ int standardCount = super.getCount();
+ return standardCount > mChooserListCommunicator.getMaxRankedTargets() ? standardCount : 0;
+ }
+
+ int getRankedTargetCount() {
+ int spacesAvailable =
+ mChooserListCommunicator.getMaxRankedTargets() - getCallerTargetCount();
+ return Math.min(spacesAvailable, super.getCount());
+ }
+
+ public int getPositionTargetType(int position) {
+ int offset = 0;
+
+ final int serviceTargetCount = getServiceTargetCount();
+ if (position < serviceTargetCount) {
+ return TARGET_SERVICE;
+ }
+ offset += serviceTargetCount;
+
+ final int callerTargetCount = getCallerTargetCount();
+ if (position - offset < callerTargetCount) {
+ return TARGET_CALLER;
+ }
+ offset += callerTargetCount;
+
+ final int rankedTargetCount = getRankedTargetCount();
+ if (position - offset < rankedTargetCount) {
+ return TARGET_STANDARD;
+ }
+ offset += rankedTargetCount;
+
+ final int standardTargetCount = getAlphaTargetCount();
+ if (position - offset < standardTargetCount) {
+ return TARGET_STANDARD_AZ;
+ }
+
+ return TARGET_BAD;
+ }
+
+ @Override
+ public TargetInfo getItem(int position) {
+ return targetInfoForPosition(position, true);
+ }
+
+
+ /**
+ * Find target info for a given position.
+ * Since ChooserActivity displays several sections of content, determine which
+ * section provides this item.
+ */
+ @Override
+ public TargetInfo targetInfoForPosition(int position, boolean filtered) {
+ int offset = 0;
+
+ // Direct share targets
+ final int serviceTargetCount = filtered ? getServiceTargetCount() :
+ getSelectableServiceTargetCount();
+ if (position < serviceTargetCount) {
+ return mServiceTargets.get(position);
+ }
+ offset += serviceTargetCount;
+
+ // Targets provided by calling app
+ final int callerTargetCount = getCallerTargetCount();
+ if (position - offset < callerTargetCount) {
+ return mCallerTargets.get(position - offset);
+ }
+ offset += callerTargetCount;
+
+ // Ranked standard app targets
+ final int rankedTargetCount = getRankedTargetCount();
+ if (position - offset < rankedTargetCount) {
+ return filtered ? super.getItem(position - offset)
+ : getDisplayResolveInfo(position - offset);
+ }
+ offset += rankedTargetCount;
+
+ // Alphabetical complete app target list.
+ if (position - offset < getAlphaTargetCount() && !mSortedList.isEmpty()) {
+ return mSortedList.get(position - offset);
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Evaluate targets for inclusion in the direct share area. May not be included
+ * if score is too low.
+ */
+ public void addServiceResults(DisplayResolveInfo origTarget, List<ChooserTarget> targets,
+ @ChooserActivity.ShareTargetType int targetType) {
+ if (DEBUG) {
+ Log.d(TAG, "addServiceResults " + origTarget + ", " + targets.size()
+ + " targets");
+ }
+
+ if (targets.size() == 0) {
+ return;
+ }
+
+ final float baseScore = getBaseScore(origTarget, targetType);
+ Collections.sort(targets, mBaseTargetComparator);
+
+ final boolean isShortcutResult =
+ (targetType == TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER
+ || targetType == TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE);
+ final int maxTargets = isShortcutResult ? mMaxShortcutTargetsPerApp
+ : MAX_CHOOSER_TARGETS_PER_APP;
+ float lastScore = 0;
+ boolean shouldNotify = false;
+ for (int i = 0, count = Math.min(targets.size(), maxTargets); i < count; i++) {
+ final ChooserTarget target = targets.get(i);
+ float targetScore = target.getScore();
+ targetScore *= baseScore;
+ if (i > 0 && targetScore >= lastScore) {
+ // Apply a decay so that the top app can't crowd out everything else.
+ // This incents ChooserTargetServices to define what's truly better.
+ targetScore = lastScore * 0.95f;
+ }
+ boolean isInserted = insertServiceTarget(new SelectableTargetInfo(
+ mContext, origTarget, target, targetScore, mSelectableTargetInfoComunicator));
+
+ if (isInserted && isShortcutResult) {
+ mNumShortcutResults++;
+ }
+
+ shouldNotify |= isInserted;
+
+ if (DEBUG) {
+ Log.d(TAG, " => " + target.toString() + " score=" + targetScore
+ + " base=" + target.getScore()
+ + " lastScore=" + lastScore
+ + " baseScore=" + baseScore);
+ }
+
+ lastScore = targetScore;
+ }
+
+ if (shouldNotify) {
+ notifyDataSetChanged();
+ }
+ }
+
+ int getNumShortcutResults() {
+ return mNumShortcutResults;
+ }
+
+ /**
+ * Use the scoring system along with artificial boosts to create up to 4 distinct buckets:
+ * <ol>
+ * <li>App-supplied targets
+ * <li>Shortcuts ranked via App Prediction Manager
+ * <li>Shortcuts ranked via legacy heuristics
+ * <li>Legacy direct share targets
+ * </ol>
+ */
+ public float getBaseScore(
+ DisplayResolveInfo target,
+ @ChooserActivity.ShareTargetType int targetType) {
+ if (target == null) {
+ return CALLER_TARGET_SCORE_BOOST;
+ }
+
+ if (targetType == TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE) {
+ return SHORTCUT_TARGET_SCORE_BOOST;
+ }
+
+ float score = super.getScore(target);
+ if (targetType == TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER) {
+ return score * SHORTCUT_TARGET_SCORE_BOOST;
+ }
+
+ return score;
+ }
+
+ /**
+ * Calling this marks service target loading complete, and will attempt to no longer
+ * update the direct share area.
+ */
+ public void completeServiceTargetLoading() {
+ mServiceTargets.removeIf(o -> o instanceof ChooserActivity.PlaceHolderTargetInfo);
+
+ if (mServiceTargets.isEmpty()) {
+ mServiceTargets.add(new ChooserActivity.EmptyTargetInfo());
+ }
+ notifyDataSetChanged();
+ }
+
+ private boolean insertServiceTarget(ChooserTargetInfo chooserTargetInfo) {
+ // Avoid inserting any potentially late results
+ if (mServiceTargets.size() == 1
+ && mServiceTargets.get(0) instanceof ChooserActivity.EmptyTargetInfo) {
+ return false;
+ }
+
+ // Check for duplicates and abort if found
+ for (ChooserTargetInfo otherTargetInfo : mServiceTargets) {
+ if (chooserTargetInfo.isSimilar(otherTargetInfo)) {
+ return false;
+ }
+ }
+
+ int currentSize = mServiceTargets.size();
+ final float newScore = chooserTargetInfo.getModifiedScore();
+ for (int i = 0; i < Math.min(currentSize, MAX_SERVICE_TARGETS); i++) {
+ final ChooserTargetInfo serviceTarget = mServiceTargets.get(i);
+ if (serviceTarget == null) {
+ mServiceTargets.set(i, chooserTargetInfo);
+ return true;
+ } else if (newScore > serviceTarget.getModifiedScore()) {
+ mServiceTargets.add(i, chooserTargetInfo);
+ return true;
+ }
+ }
+
+ if (currentSize < MAX_SERVICE_TARGETS) {
+ mServiceTargets.add(chooserTargetInfo);
+ return true;
+ }
+
+ return false;
+ }
+
+ public ChooserTarget getChooserTargetForValue(int value) {
+ return mServiceTargets.get(value).getChooserTarget();
+ }
+
+ /**
+ * Rather than fully sorting the input list, this sorting task will put the top k elements
+ * in the head of input list and fill the tail with other elements in undetermined order.
+ */
+ @Override
+ AsyncTask<List<ResolvedComponentInfo>,
+ Void,
+ List<ResolvedComponentInfo>> createSortingTask() {
+ return new AsyncTask<List<ResolvedComponentInfo>,
+ Void,
+ List<ResolvedComponentInfo>>() {
+ @Override
+ protected List<ResolvedComponentInfo> doInBackground(
+ List<ResolvedComponentInfo>... params) {
+ mResolverListController.topK(params[0],
+ mChooserListCommunicator.getMaxRankedTargets());
+ return params[0];
+ }
+ @Override
+ protected void onPostExecute(List<ResolvedComponentInfo> sortedComponents) {
+ processSortedList(sortedComponents);
+ mChooserListCommunicator.updateProfileViewButton();
+ notifyDataSetChanged();
+ }
+ };
+ }
+
+ /**
+ * Necessary methods to communicate between {@link ChooserListAdapter}
+ * and {@link ChooserActivity}.
+ */
+ interface ChooserListCommunicator extends ResolverListCommunicator {
+
+ int getMaxRankedTargets();
+
+ void sendListViewUpdateMessage();
+
+ boolean isSendAction(Intent targetIntent);
+ }
+}
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 7f18ae3..c1c6ac9 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -23,7 +23,6 @@
import android.annotation.UiThread;
import android.annotation.UnsupportedAppUsage;
import android.app.Activity;
-import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.ActivityThread;
import android.app.VoiceInteractor.PickOptionRequest;
@@ -35,26 +34,18 @@
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
-import android.content.pm.LabeledIntent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
import android.graphics.Insets;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PatternMatcher;
-import android.os.Process;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.UserHandle;
@@ -71,7 +62,6 @@
import android.view.WindowInsets;
import android.widget.AbsListView;
import android.widget.AdapterView;
-import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
@@ -81,6 +71,8 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.app.chooser.DisplayResolveInfo;
+import com.android.internal.app.chooser.TargetInfo;
import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
@@ -99,32 +91,33 @@
* which to go to. It is not normally used directly by application developers.
*/
@UiThread
-public class ResolverActivity extends Activity {
-
- // Temporary flag for new chooser delegate behavior.
- boolean mEnableChooserDelegate = true;
+public class ResolverActivity extends Activity implements
+ ResolverListAdapter.ResolverListCommunicator {
@UnsupportedAppUsage
- protected ResolveListAdapter mAdapter;
+ protected ResolverListAdapter mAdapter;
private boolean mSafeForwardingMode;
protected AbsListView mAdapterView;
private Button mAlwaysButton;
private Button mOnceButton;
protected View mProfileView;
- private int mIconDpi;
private int mLastSelected = AbsListView.INVALID_POSITION;
private boolean mResolvingHome = false;
private int mProfileSwitchMessageId = -1;
private int mLayoutId;
- private final ArrayList<Intent> mIntents = new ArrayList<>();
+ @VisibleForTesting
+ protected final ArrayList<Intent> mIntents = new ArrayList<>();
private PickTargetOptionRequest mPickOptionRequest;
private String mReferrerPackage;
private CharSequence mTitle;
private int mDefaultTitleResId;
- private boolean mUseLayoutForBrowsables;
+
+ @VisibleForTesting
+ protected boolean mUseLayoutForBrowsables;
// Whether or not this activity supports choosing a default handler for the intent.
- private boolean mSupportsAlwaysUseOption;
+ @VisibleForTesting
+ protected boolean mSupportsAlwaysUseOption;
protected ResolverDrawerLayout mResolverDrawerLayout;
@UnsupportedAppUsage
protected PackageManager mPm;
@@ -132,12 +125,9 @@
private static final String TAG = "ResolverActivity";
private static final boolean DEBUG = false;
- private Runnable mPostListReadyRunnable;
private boolean mRegistered;
- private ColorMatrixColorFilter mSuspendedMatrixColorFilter;
-
protected Insets mSystemWindowInsets = null;
private Space mFooterSpacer = null;
@@ -233,7 +223,7 @@
@Override
public void onSomePackagesChanged() {
mAdapter.handlePackagesChanged();
- bindProfileView();
+ updateProfileViewButton();
}
@Override
@@ -316,9 +306,6 @@
mRegistered = true;
mReferrerPackage = getReferrerPackageName();
- final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
- mIconDpi = am.getLauncherLargeIconDensity();
-
// Add our initial intent as the first item, regardless of what else has already been added.
mIntents.add(0, new Intent(intent));
mTitle = title;
@@ -330,7 +317,17 @@
mSupportsAlwaysUseOption = supportsAlwaysUseOption;
- if (configureContentView(mIntents, initialIntents, rList)) {
+ // The last argument of createAdapter is whether to do special handling
+ // of the last used choice to highlight it in the list. We need to always
+ // turn this off when running under voice interaction, since it results in
+ // a more complicated UI that the current voice interaction flow is not able
+ // to handle.
+ boolean filterLastUsed = mSupportsAlwaysUseOption && !isVoiceInteraction();
+ mAdapter = createAdapter(this, mIntents, initialIntents, rList,
+ filterLastUsed, mUseLayoutForBrowsables);
+ configureContentView();
+
+ if (rebuildList()) {
return;
}
@@ -356,11 +353,9 @@
mProfileView = findViewById(R.id.profile_button);
if (mProfileView != null) {
mProfileView.setOnClickListener(this::onProfileClick);
- bindProfileView();
+ updateProfileViewButton();
}
- initSuspendedColorMatrix();
-
final Set<String> categories = intent.getCategories();
MetricsLogger.action(this, mAdapter.hasFilteredItem()
? MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_APP_FEATURED
@@ -423,25 +418,7 @@
}
}
- private void initSuspendedColorMatrix() {
- int grayValue = 127;
- float scale = 0.5f; // half bright
-
- ColorMatrix tempBrightnessMatrix = new ColorMatrix();
- float[] mat = tempBrightnessMatrix.getArray();
- mat[0] = scale;
- mat[6] = scale;
- mat[12] = scale;
- mat[4] = grayValue;
- mat[9] = grayValue;
- mat[14] = grayValue;
-
- ColorMatrix matrix = new ColorMatrix();
- matrix.setSaturation(0.0f);
- matrix.preConcat(tempBrightnessMatrix);
- mSuspendedMatrixColorFilter = new ColorMatrixColorFilter(matrix);
- }
-
+ @Override // ResolverListCommunicator
public void sendVoiceChoicesIfNeeded() {
if (!isVoiceInteraction()) {
// Clearly not needed.
@@ -476,6 +453,7 @@
}
}
+ @Override // SelectableTargetInfoCommunicator ResolverListCommunicator
public Intent getTargetIntent() {
return mIntents.isEmpty() ? null : mIntents.get(0);
}
@@ -492,7 +470,8 @@
return R.layout.resolver_list;
}
- protected void bindProfileView() {
+ @Override // ResolverListCommunicator
+ public void updateProfileViewButton() {
if (mProfileView == null) {
return;
}
@@ -583,187 +562,6 @@
}
}
-
- /**
- * Loads the icon and label for the provided ApplicationInfo. Defaults to using the application
- * icon and label over any IntentFilter or Activity icon to increase user understanding, with an
- * exception for applications that hold the right permission. Always attempts to use available
- * resources over PackageManager loading mechanisms so badging can be done by iconloader. Uses
- * Strings to strip creative formatting.
- */
- private abstract static class TargetPresentationGetter {
- @Nullable abstract Drawable getIconSubstituteInternal();
- @Nullable abstract String getAppSubLabelInternal();
-
- private Context mCtx;
- private final int mIconDpi;
- private final boolean mHasSubstitutePermission;
- private final ApplicationInfo mAi;
-
- protected PackageManager mPm;
-
- TargetPresentationGetter(Context ctx, int iconDpi, ApplicationInfo ai) {
- mCtx = ctx;
- mPm = ctx.getPackageManager();
- mAi = ai;
- mIconDpi = iconDpi;
- mHasSubstitutePermission = PackageManager.PERMISSION_GRANTED == mPm.checkPermission(
- android.Manifest.permission.SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON,
- mAi.packageName);
- }
-
- public Drawable getIcon(UserHandle userHandle) {
- return new BitmapDrawable(mCtx.getResources(), getIconBitmap(userHandle));
- }
-
- public Bitmap getIconBitmap(UserHandle userHandle) {
- Drawable dr = null;
- if (mHasSubstitutePermission) {
- dr = getIconSubstituteInternal();
- }
-
- if (dr == null) {
- try {
- if (mAi.icon != 0) {
- dr = loadIconFromResource(mPm.getResourcesForApplication(mAi), mAi.icon);
- }
- } catch (NameNotFoundException ignore) {
- }
- }
-
- // Fall back to ApplicationInfo#loadIcon if nothing has been loaded
- if (dr == null) {
- dr = mAi.loadIcon(mPm);
- }
-
- SimpleIconFactory sif = SimpleIconFactory.obtain(mCtx);
- Bitmap icon = sif.createUserBadgedIconBitmap(dr, userHandle);
- sif.recycle();
-
- return icon;
- }
-
- public String getLabel() {
- String label = null;
- // Apps with the substitute permission will always show the sublabel as their label
- if (mHasSubstitutePermission) {
- label = getAppSubLabelInternal();
- }
-
- if (label == null) {
- label = (String) mAi.loadLabel(mPm);
- }
-
- return label;
- }
-
- public String getSubLabel() {
- // Apps with the substitute permission will never have a sublabel
- if (mHasSubstitutePermission) return null;
- return getAppSubLabelInternal();
- }
-
- protected String loadLabelFromResource(Resources res, int resId) {
- return res.getString(resId);
- }
-
- @Nullable
- protected Drawable loadIconFromResource(Resources res, int resId) {
- return res.getDrawableForDensity(resId, mIconDpi);
- }
-
- }
-
- /**
- * Loads the icon and label for the provided ResolveInfo.
- */
- @VisibleForTesting
- public static class ResolveInfoPresentationGetter extends ActivityInfoPresentationGetter {
- private final ResolveInfo mRi;
- public ResolveInfoPresentationGetter(Context ctx, int iconDpi, ResolveInfo ri) {
- super(ctx, iconDpi, ri.activityInfo);
- mRi = ri;
- }
-
- @Override
- Drawable getIconSubstituteInternal() {
- Drawable dr = null;
- try {
- // Do not use ResolveInfo#getIconResource() as it defaults to the app
- if (mRi.resolvePackageName != null && mRi.icon != 0) {
- dr = loadIconFromResource(
- mPm.getResourcesForApplication(mRi.resolvePackageName), mRi.icon);
- }
- } catch (NameNotFoundException e) {
- Log.e(TAG, "SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON permission granted but "
- + "couldn't find resources for package", e);
- }
-
- // Fall back to ActivityInfo if no icon is found via ResolveInfo
- if (dr == null) dr = super.getIconSubstituteInternal();
-
- return dr;
- }
-
- @Override
- String getAppSubLabelInternal() {
- // Will default to app name if no intent filter or activity label set, make sure to
- // check if subLabel matches label before final display
- return (String) mRi.loadLabel(mPm);
- }
- }
-
- ResolveInfoPresentationGetter makePresentationGetter(ResolveInfo ri) {
- return new ResolveInfoPresentationGetter(this, mIconDpi, ri);
- }
-
- /**
- * Loads the icon and label for the provided ActivityInfo.
- */
- @VisibleForTesting
- public static class ActivityInfoPresentationGetter extends TargetPresentationGetter {
- private final ActivityInfo mActivityInfo;
- public ActivityInfoPresentationGetter(Context ctx, int iconDpi,
- ActivityInfo activityInfo) {
- super(ctx, iconDpi, activityInfo.applicationInfo);
- mActivityInfo = activityInfo;
- }
-
- @Override
- Drawable getIconSubstituteInternal() {
- Drawable dr = null;
- try {
- // Do not use ActivityInfo#getIconResource() as it defaults to the app
- if (mActivityInfo.icon != 0) {
- dr = loadIconFromResource(
- mPm.getResourcesForApplication(mActivityInfo.applicationInfo),
- mActivityInfo.icon);
- }
- } catch (NameNotFoundException e) {
- Log.e(TAG, "SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON permission granted but "
- + "couldn't find resources for package", e);
- }
-
- return dr;
- }
-
- @Override
- String getAppSubLabelInternal() {
- // Will default to app name if no activity label set, make sure to check if subLabel
- // matches label before final display
- return (String) mActivityInfo.loadLabel(mPm);
- }
- }
-
- protected ActivityInfoPresentationGetter makePresentationGetter(ActivityInfo ai) {
- return new ActivityInfoPresentationGetter(this, mIconDpi, ai);
- }
-
- Drawable loadIconForResolveInfo(ResolveInfo ri) {
- // Load icons based on the current process. If in work profile icons should be badged.
- return makePresentationGetter(ri).getIcon(Process.myUserHandle());
- }
-
@Override
protected void onRestart() {
super.onRestart();
@@ -772,7 +570,7 @@
mRegistered = true;
}
mAdapter.handlePackagesChanged();
- bindProfileView();
+ updateProfileViewButton();
}
@Override
@@ -804,12 +602,8 @@
if (!isChangingConfigurations() && mPickOptionRequest != null) {
mPickOptionRequest.cancel();
}
- if (mPostListReadyRunnable != null) {
- getMainThreadHandler().removeCallbacks(mPostListReadyRunnable);
- mPostListReadyRunnable = null;
- }
- if (mAdapter != null && mAdapter.mResolverListController != null) {
- mAdapter.mResolverListController.destroy();
+ if (mAdapter != null) {
+ mAdapter.onDestroy();
}
}
@@ -950,10 +744,30 @@
/**
* Replace me in subclasses!
*/
+ @Override // ResolverListCommunicator
public Intent getReplacementIntent(ActivityInfo aInfo, Intent defIntent) {
return defIntent;
}
+ @Override // ResolverListCommunicator
+ public void onPostListReady() {
+ setHeader();
+ resetButtonBar();
+ onListRebuilt();
+ }
+
+ protected void onListRebuilt() {
+ int count = mAdapter.getUnfilteredCount();
+ if (count == 1 && mAdapter.getOtherProfile() == null) {
+ // Only one target, so we're a candidate to auto-launch!
+ final TargetInfo target = mAdapter.targetInfoForPosition(0, false);
+ if (shouldAutoLaunchSingleChoice(target)) {
+ safelyStartActivity(target);
+ finish();
+ }
+ }
+ }
+
protected boolean onTargetSelected(TargetInfo target, boolean alwaysCheck) {
final ResolveInfo ri = target.getResolveInfo();
final Intent intent = target != null ? target.getResolvedIntent() : null;
@@ -1049,8 +863,8 @@
// If we don't add back in the component for forwarding the intent to a managed
// profile, the preferred activity may not be updated correctly (as the set of
// components we tell it we knew about will have changed).
- final boolean needToAddBackProfileForwardingComponent
- = mAdapter.mOtherProfile != null;
+ final boolean needToAddBackProfileForwardingComponent =
+ mAdapter.getOtherProfile() != null;
if (!needToAddBackProfileForwardingComponent) {
set = new ComponentName[N];
} else {
@@ -1066,8 +880,8 @@
}
if (needToAddBackProfileForwardingComponent) {
- set[N] = mAdapter.mOtherProfile.getResolvedComponentName();
- final int otherProfileMatch = mAdapter.mOtherProfile.getResolveInfo().match;
+ set[N] = mAdapter.getOtherProfile().getResolvedComponentName();
+ final int otherProfileMatch = mAdapter.getOtherProfile().getResolveInfo().match;
if (otherProfileMatch > bestMatch) bestMatch = otherProfileMatch;
}
@@ -1169,7 +983,7 @@
}
- boolean startAsCallerImpl(Intent intent, Bundle options, boolean ignoreTargetSecurity,
+ public boolean startAsCallerImpl(Intent intent, Bundle options, boolean ignoreTargetSecurity,
int userId) {
// Pass intent to delegate chooser activity with permission token.
// TODO: This should move to a trampoline Activity in the system when the ChooserActivity
@@ -1205,6 +1019,7 @@
// Do nothing
}
+ @Override // ResolverListCommunicator
public boolean shouldGetActivityMetadata() {
return false;
}
@@ -1220,11 +1035,11 @@
startActivity(in);
}
- public ResolveListAdapter createAdapter(Context context, List<Intent> payloadIntents,
- Intent[] initialIntents, List<ResolveInfo> rList, int launchedFromUid,
- boolean filterLastUsed) {
- return new ResolveListAdapter(context, payloadIntents, initialIntents, rList,
- launchedFromUid, filterLastUsed, createListController());
+ public ResolverListAdapter createAdapter(Context context, List<Intent> payloadIntents,
+ Intent[] initialIntents, List<ResolveInfo> rList,
+ boolean filterLastUsed, boolean useLayoutForBrowsables) {
+ return new ResolverListAdapter(context, payloadIntents, initialIntents, rList,
+ filterLastUsed, createListController(), useLayoutForBrowsables, this);
}
@VisibleForTesting
@@ -1238,26 +1053,34 @@
}
/**
- * Returns true if the activity is finishing and creation should halt
+ * Sets up the content view.
*/
- public boolean configureContentView(List<Intent> payloadIntents, Intent[] initialIntents,
- List<ResolveInfo> rList) {
- // The last argument of createAdapter is whether to do special handling
- // of the last used choice to highlight it in the list. We need to always
- // turn this off when running under voice interaction, since it results in
- // a more complicated UI that the current voice interaction flow is not able
- // to handle.
- mAdapter = createAdapter(this, payloadIntents, initialIntents, rList,
- mLaunchedFromUid, mSupportsAlwaysUseOption && !isVoiceInteraction());
- boolean rebuildCompleted = mAdapter.rebuildList();
-
+ private void configureContentView() {
+ if (mAdapter == null) {
+ throw new IllegalStateException("mAdapter cannot be null.");
+ }
if (useLayoutWithDefault()) {
mLayoutId = R.layout.resolver_list_with_default;
} else {
mLayoutId = getLayoutResource();
}
setContentView(mLayoutId);
+ mAdapterView = findViewById(R.id.resolver_list);
+ }
+ /**
+ * Returns true if the activity is finishing and creation should halt.
+ * </p>Subclasses must call rebuildListInternal at the end of rebuildList.
+ */
+ protected boolean rebuildList() {
+ return rebuildListInternal();
+ }
+
+ /**
+ * Returns true if the activity is finishing and creation should halt.
+ */
+ final boolean rebuildListInternal() {
+ boolean rebuildCompleted = mAdapter.rebuildList();
int count = mAdapter.getUnfilteredCount();
// We only rebuild asynchronously when we have multiple elements to sort. In the case where
@@ -1276,10 +1099,7 @@
}
}
-
- mAdapterView = findViewById(R.id.resolver_list);
-
- if (count == 0 && mAdapter.mPlaceholderCount == 0) {
+ if (count == 0 && mAdapter.getPlaceholderCount() == 0) {
final TextView emptyView = findViewById(R.id.empty);
emptyView.setVisibility(View.VISIBLE);
mAdapterView.setVisibility(View.GONE);
@@ -1290,7 +1110,7 @@
return false;
}
- public void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter) {
+ public void onPrepareAdapterView(AbsListView adapterView, ResolverListAdapter adapter) {
final boolean useHeader = adapter.hasFilteredItem();
final ListView listView = adapterView instanceof ListView ? (ListView) adapterView : null;
@@ -1317,7 +1137,7 @@
* Configure the area above the app selection list (title, content preview, etc).
*/
public void setHeader() {
- if (mAdapter.getCount() == 0 && mAdapter.mPlaceholderCount == 0) {
+ if (mAdapter.getCount() == 0 && mAdapter.getPlaceholderCount() == 0) {
final TextView titleView = findViewById(R.id.title);
if (titleView != null) {
titleView.setVisibility(View.GONE);
@@ -1337,9 +1157,8 @@
}
final ImageView iconView = findViewById(R.id.icon);
- final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
- if (iconView != null && iconInfo != null) {
- new LoadIconTask(iconInfo, iconView).execute();
+ if (iconView != null) {
+ mAdapter.loadFilteredItemIconTaskAsync(iconView);
}
}
@@ -1382,7 +1201,8 @@
}
}
- private boolean useLayoutWithDefault() {
+ @Override // ResolverListCommunicator
+ public boolean useLayoutWithDefault() {
return mSupportsAlwaysUseOption && mAdapter.hasFilteredItem();
}
@@ -1397,695 +1217,22 @@
/**
* Check a simple match for the component of two ResolveInfos.
*/
- static boolean resolveInfoMatch(ResolveInfo lhs, ResolveInfo rhs) {
+ @Override // ResolverListCommunicator
+ public boolean resolveInfoMatch(ResolveInfo lhs, ResolveInfo rhs) {
return lhs == null ? rhs == null
: lhs.activityInfo == null ? rhs.activityInfo == null
: Objects.equals(lhs.activityInfo.name, rhs.activityInfo.name)
&& Objects.equals(lhs.activityInfo.packageName, rhs.activityInfo.packageName);
}
- public final class DisplayResolveInfo implements TargetInfo {
- private final ResolveInfo mResolveInfo;
- private final CharSequence mDisplayLabel;
- private Drawable mDisplayIcon;
- private Drawable mBadge;
- private final CharSequence mExtendedInfo;
- private final Intent mResolvedIntent;
- private final List<Intent> mSourceIntents = new ArrayList<>();
- private boolean mIsSuspended;
-
- public DisplayResolveInfo(Intent originalIntent, ResolveInfo pri, CharSequence pLabel,
- CharSequence pInfo, Intent pOrigIntent) {
- mSourceIntents.add(originalIntent);
- mResolveInfo = pri;
- mDisplayLabel = pLabel;
- mExtendedInfo = pInfo;
-
- final Intent intent = new Intent(pOrigIntent != null ? pOrigIntent :
- getReplacementIntent(pri.activityInfo, getTargetIntent()));
- intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT
- | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
- final ActivityInfo ai = mResolveInfo.activityInfo;
- intent.setComponent(new ComponentName(ai.applicationInfo.packageName, ai.name));
-
- mIsSuspended = (ai.applicationInfo.flags & ApplicationInfo.FLAG_SUSPENDED) != 0;
-
- mResolvedIntent = intent;
- }
-
- private DisplayResolveInfo(DisplayResolveInfo other, Intent fillInIntent, int flags) {
- mSourceIntents.addAll(other.getAllSourceIntents());
- mResolveInfo = other.mResolveInfo;
- mDisplayLabel = other.mDisplayLabel;
- mDisplayIcon = other.mDisplayIcon;
- mExtendedInfo = other.mExtendedInfo;
- mResolvedIntent = new Intent(other.mResolvedIntent);
- mResolvedIntent.fillIn(fillInIntent, flags);
- }
-
- public ResolveInfo getResolveInfo() {
- return mResolveInfo;
- }
-
- public CharSequence getDisplayLabel() {
- return mDisplayLabel;
- }
-
- public Drawable getDisplayIcon() {
- return mDisplayIcon;
- }
-
- @Override
- public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
- return new DisplayResolveInfo(this, fillInIntent, flags);
- }
-
- @Override
- public List<Intent> getAllSourceIntents() {
- return mSourceIntents;
- }
-
- public void addAlternateSourceIntent(Intent alt) {
- mSourceIntents.add(alt);
- }
-
- public void setDisplayIcon(Drawable icon) {
- mDisplayIcon = icon;
- }
-
- public boolean hasDisplayIcon() {
- return mDisplayIcon != null;
- }
-
- public CharSequence getExtendedInfo() {
- return mExtendedInfo;
- }
-
- public Intent getResolvedIntent() {
- return mResolvedIntent;
- }
-
- @Override
- public ComponentName getResolvedComponentName() {
- return new ComponentName(mResolveInfo.activityInfo.packageName,
- mResolveInfo.activityInfo.name);
- }
-
- @Override
- public boolean start(Activity activity, Bundle options) {
- activity.startActivity(mResolvedIntent, options);
- return true;
- }
-
- @Override
- public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
- if (mEnableChooserDelegate) {
- return activity.startAsCallerImpl(mResolvedIntent, options, false, userId);
- } else {
- activity.startActivityAsCaller(mResolvedIntent, options, null, false, userId);
- return true;
- }
- }
-
- @Override
- public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
- activity.startActivityAsUser(mResolvedIntent, options, user);
- return false;
- }
-
- public boolean isSuspended() {
- return mIsSuspended;
+ @Override // ResolverListCommunicator
+ public void onHandlePackagesChanged() {
+ if (mAdapter.getCount() == 0) {
+ // We no longer have any items... just finish the activity.
+ finish();
}
}
- List<DisplayResolveInfo> getDisplayList() {
- return mAdapter.mDisplayList;
- }
-
- /**
- * A single target as represented in the chooser.
- */
- public interface TargetInfo {
- /**
- * Get the resolved intent that represents this target. Note that this may not be the
- * intent that will be launched by calling one of the <code>start</code> methods provided;
- * this is the intent that will be credited with the launch.
- *
- * @return the resolved intent for this target
- */
- Intent getResolvedIntent();
-
- /**
- * Get the resolved component name that represents this target. Note that this may not
- * be the component that will be directly launched by calling one of the <code>start</code>
- * methods provided; this is the component that will be credited with the launch.
- *
- * @return the resolved ComponentName for this target
- */
- ComponentName getResolvedComponentName();
-
- /**
- * Start the activity referenced by this target.
- *
- * @param activity calling Activity performing the launch
- * @param options ActivityOptions bundle
- * @return true if the start completed successfully
- */
- boolean start(Activity activity, Bundle options);
-
- /**
- * Start the activity referenced by this target as if the ResolverActivity's caller
- * was performing the start operation.
- *
- * @param activity calling Activity (actually) performing the launch
- * @param options ActivityOptions bundle
- * @param userId userId to start as or {@link UserHandle#USER_NULL} for activity's caller
- * @return true if the start completed successfully
- */
- boolean startAsCaller(ResolverActivity activity, Bundle options, int userId);
-
- /**
- * Start the activity referenced by this target as a given user.
- *
- * @param activity calling activity performing the launch
- * @param options ActivityOptions bundle
- * @param user handle for the user to start the activity as
- * @return true if the start completed successfully
- */
- boolean startAsUser(Activity activity, Bundle options, UserHandle user);
-
- /**
- * Return the ResolveInfo about how and why this target matched the original query
- * for available targets.
- *
- * @return ResolveInfo representing this target's match
- */
- ResolveInfo getResolveInfo();
-
- /**
- * Return the human-readable text label for this target.
- *
- * @return user-visible target label
- */
- CharSequence getDisplayLabel();
-
- /**
- * Return any extended info for this target. This may be used to disambiguate
- * otherwise identical targets.
- *
- * @return human-readable disambig string or null if none present
- */
- CharSequence getExtendedInfo();
-
- /**
- * @return The drawable that should be used to represent this target including badge
- */
- Drawable getDisplayIcon();
-
- /**
- * Clone this target with the given fill-in information.
- */
- TargetInfo cloneFilledIn(Intent fillInIntent, int flags);
-
- /**
- * @return the list of supported source intents deduped against this single target
- */
- List<Intent> getAllSourceIntents();
-
- /**
- * @return true if this target can be selected by the user
- */
- boolean isSuspended();
- }
-
- public class ResolveListAdapter extends BaseAdapter {
- private final List<Intent> mIntents;
- private final Intent[] mInitialIntents;
- private final List<ResolveInfo> mBaseResolveList;
- protected ResolveInfo mLastChosen;
- private DisplayResolveInfo mOtherProfile;
- ResolverListController mResolverListController;
- private int mPlaceholderCount;
- private boolean mAllTargetsAreBrowsers = false;
-
- protected final LayoutInflater mInflater;
-
- // This one is the list that the Adapter will actually present.
- List<DisplayResolveInfo> mDisplayList;
- List<ResolvedComponentInfo> mUnfilteredResolveList;
-
- private int mLastChosenPosition = -1;
- private boolean mFilterLastUsed;
-
- public ResolveListAdapter(Context context, List<Intent> payloadIntents,
- Intent[] initialIntents, List<ResolveInfo> rList, int launchedFromUid,
- boolean filterLastUsed,
- ResolverListController resolverListController) {
- mIntents = payloadIntents;
- mInitialIntents = initialIntents;
- mBaseResolveList = rList;
- mLaunchedFromUid = launchedFromUid;
- mInflater = LayoutInflater.from(context);
- mDisplayList = new ArrayList<>();
- mFilterLastUsed = filterLastUsed;
- mResolverListController = resolverListController;
- }
-
- public void handlePackagesChanged() {
- rebuildList();
- if (getCount() == 0) {
- // We no longer have any items... just finish the activity.
- finish();
- }
- }
-
- public void setPlaceholderCount(int count) {
- mPlaceholderCount = count;
- }
-
- public int getPlaceholderCount() { return mPlaceholderCount; }
-
- @Nullable
- public DisplayResolveInfo getFilteredItem() {
- if (mFilterLastUsed && mLastChosenPosition >= 0) {
- // Not using getItem since it offsets to dodge this position for the list
- return mDisplayList.get(mLastChosenPosition);
- }
- return null;
- }
-
- public DisplayResolveInfo getOtherProfile() {
- return mOtherProfile;
- }
-
- public int getFilteredPosition() {
- if (mFilterLastUsed && mLastChosenPosition >= 0) {
- return mLastChosenPosition;
- }
- return AbsListView.INVALID_POSITION;
- }
-
- public boolean hasFilteredItem() {
- return mFilterLastUsed && mLastChosen != null;
- }
-
- public float getScore(DisplayResolveInfo target) {
- return mResolverListController.getScore(target);
- }
-
- public void updateModel(ComponentName componentName) {
- mResolverListController.updateModel(componentName);
- }
-
- public void updateChooserCounts(String packageName, int userId, String action) {
- mResolverListController.updateChooserCounts(packageName, userId, action);
- }
-
- /**
- * @return true if all items in the display list are defined as browsers by
- * ResolveInfo.handleAllWebDataURI
- */
- public boolean areAllTargetsBrowsers() {
- return mAllTargetsAreBrowsers;
- }
-
- /**
- * Rebuild the list of resolvers. In some cases some parts will need some asynchronous work
- * to complete.
- *
- * @return Whether or not the list building is completed.
- */
- protected boolean rebuildList() {
- List<ResolvedComponentInfo> currentResolveList = null;
- // Clear the value of mOtherProfile from previous call.
- mOtherProfile = null;
- mLastChosen = null;
- mLastChosenPosition = -1;
- mAllTargetsAreBrowsers = false;
- mDisplayList.clear();
- if (mBaseResolveList != null) {
- currentResolveList = mUnfilteredResolveList = new ArrayList<>();
- mResolverListController.addResolveListDedupe(currentResolveList,
- getTargetIntent(),
- mBaseResolveList);
- } else {
- currentResolveList = mUnfilteredResolveList =
- mResolverListController.getResolversForIntent(shouldGetResolvedFilter(),
- shouldGetActivityMetadata(),
- mIntents);
- if (currentResolveList == null) {
- processSortedList(currentResolveList);
- return true;
- }
- List<ResolvedComponentInfo> originalList =
- mResolverListController.filterIneligibleActivities(currentResolveList,
- true);
- if (originalList != null) {
- mUnfilteredResolveList = originalList;
- }
- }
-
- // So far we only support a single other profile at a time.
- // The first one we see gets special treatment.
- for (ResolvedComponentInfo info : currentResolveList) {
- if (info.getResolveInfoAt(0).targetUserId != UserHandle.USER_CURRENT) {
- mOtherProfile = new DisplayResolveInfo(info.getIntentAt(0),
- info.getResolveInfoAt(0),
- info.getResolveInfoAt(0).loadLabel(mPm),
- info.getResolveInfoAt(0).loadLabel(mPm),
- getReplacementIntent(info.getResolveInfoAt(0).activityInfo,
- info.getIntentAt(0)));
- currentResolveList.remove(info);
- break;
- }
- }
-
- if (mOtherProfile == null) {
- try {
- mLastChosen = mResolverListController.getLastChosen();
- } catch (RemoteException re) {
- Log.d(TAG, "Error calling getLastChosenActivity\n" + re);
- }
- }
-
- int N;
- if ((currentResolveList != null) && ((N = currentResolveList.size()) > 0)) {
- // We only care about fixing the unfilteredList if the current resolve list and
- // current resolve list are currently the same.
- List<ResolvedComponentInfo> originalList =
- mResolverListController.filterLowPriority(currentResolveList,
- mUnfilteredResolveList == currentResolveList);
- if (originalList != null) {
- mUnfilteredResolveList = originalList;
- }
-
- if (currentResolveList.size() > 1) {
- int placeholderCount = currentResolveList.size();
- if (useLayoutWithDefault()) {
- --placeholderCount;
- }
- setPlaceholderCount(placeholderCount);
- createSortingTask().execute(currentResolveList);
- postListReadyRunnable();
- return false;
- } else {
- processSortedList(currentResolveList);
- return true;
- }
- } else {
- processSortedList(currentResolveList);
- return true;
- }
- }
-
- AsyncTask<List<ResolvedComponentInfo>,
- Void,
- List<ResolvedComponentInfo>> createSortingTask() {
- return new AsyncTask<List<ResolvedComponentInfo>,
- Void,
- List<ResolvedComponentInfo>>() {
- @Override
- protected List<ResolvedComponentInfo> doInBackground(
- List<ResolvedComponentInfo>... params) {
- mResolverListController.sort(params[0]);
- return params[0];
- }
-
- @Override
- protected void onPostExecute(List<ResolvedComponentInfo> sortedComponents) {
- processSortedList(sortedComponents);
- bindProfileView();
- notifyDataSetChanged();
- }
- };
- }
-
- void processSortedList(List<ResolvedComponentInfo> sortedComponents) {
- int N;
- if (sortedComponents != null && (N = sortedComponents.size()) != 0) {
- mAllTargetsAreBrowsers = mUseLayoutForBrowsables;
-
- // First put the initial items at the top.
- if (mInitialIntents != null) {
- for (int i = 0; i < mInitialIntents.length; i++) {
- Intent ii = mInitialIntents[i];
- if (ii == null) {
- continue;
- }
- ActivityInfo ai = ii.resolveActivityInfo(
- getPackageManager(), 0);
- if (ai == null) {
- Log.w(TAG, "No activity found for " + ii);
- continue;
- }
- ResolveInfo ri = new ResolveInfo();
- ri.activityInfo = ai;
- UserManager userManager =
- (UserManager) getSystemService(Context.USER_SERVICE);
- if (ii instanceof LabeledIntent) {
- LabeledIntent li = (LabeledIntent) ii;
- ri.resolvePackageName = li.getSourcePackage();
- ri.labelRes = li.getLabelResource();
- ri.nonLocalizedLabel = li.getNonLocalizedLabel();
- ri.icon = li.getIconResource();
- ri.iconResourceId = ri.icon;
- }
- if (userManager.isManagedProfile()) {
- ri.noResourceId = true;
- ri.icon = 0;
- }
- mAllTargetsAreBrowsers &= ri.handleAllWebDataURI;
-
- addResolveInfo(new DisplayResolveInfo(ii, ri,
- ri.loadLabel(getPackageManager()), null, ii));
- }
- }
-
-
- for (ResolvedComponentInfo rci : sortedComponents) {
- final ResolveInfo ri = rci.getResolveInfoAt(0);
- if (ri != null) {
- mAllTargetsAreBrowsers &= ri.handleAllWebDataURI;
-
- ResolveInfoPresentationGetter pg = makePresentationGetter(ri);
- addResolveInfoWithAlternates(rci, pg.getSubLabel(), pg.getLabel());
- }
- }
- }
-
- sendVoiceChoicesIfNeeded();
- postListReadyRunnable();
- }
-
-
-
- /**
- * Some necessary methods for creating the list are initiated in onCreate and will also
- * determine the layout known. We therefore can't update the UI inline and post to the
- * handler thread to update after the current task is finished.
- */
- private void postListReadyRunnable() {
- if (mPostListReadyRunnable == null) {
- mPostListReadyRunnable = new Runnable() {
- @Override
- public void run() {
- setHeader();
- resetButtonBar();
- onListRebuilt();
- mPostListReadyRunnable = null;
- }
- };
- getMainThreadHandler().post(mPostListReadyRunnable);
- }
- }
-
- public void onListRebuilt() {
- int count = getUnfilteredCount();
- if (count == 1 && getOtherProfile() == null) {
- // Only one target, so we're a candidate to auto-launch!
- final TargetInfo target = targetInfoForPosition(0, false);
- if (shouldAutoLaunchSingleChoice(target)) {
- safelyStartActivity(target);
- finish();
- }
- }
- }
-
- public boolean shouldGetResolvedFilter() {
- return mFilterLastUsed;
- }
-
- private void addResolveInfoWithAlternates(ResolvedComponentInfo rci,
- CharSequence extraInfo, CharSequence roLabel) {
- final int count = rci.getCount();
- final Intent intent = rci.getIntentAt(0);
- final ResolveInfo add = rci.getResolveInfoAt(0);
- final Intent replaceIntent = getReplacementIntent(add.activityInfo, intent);
- final DisplayResolveInfo dri = new DisplayResolveInfo(intent, add, roLabel,
- extraInfo, replaceIntent);
- addResolveInfo(dri);
- if (replaceIntent == intent) {
- // Only add alternates if we didn't get a specific replacement from
- // the caller. If we have one it trumps potential alternates.
- for (int i = 1, N = count; i < N; i++) {
- final Intent altIntent = rci.getIntentAt(i);
- dri.addAlternateSourceIntent(altIntent);
- }
- }
- updateLastChosenPosition(add);
- }
-
- private void updateLastChosenPosition(ResolveInfo info) {
- // If another profile is present, ignore the last chosen entry.
- if (mOtherProfile != null) {
- mLastChosenPosition = -1;
- return;
- }
- if (mLastChosen != null
- && mLastChosen.activityInfo.packageName.equals(info.activityInfo.packageName)
- && mLastChosen.activityInfo.name.equals(info.activityInfo.name)) {
- mLastChosenPosition = mDisplayList.size() - 1;
- }
- }
-
- // We assume that at this point we've already filtered out the only intent for a different
- // targetUserId which we're going to use.
- private void addResolveInfo(DisplayResolveInfo dri) {
- if (dri != null && dri.mResolveInfo != null
- && dri.mResolveInfo.targetUserId == UserHandle.USER_CURRENT) {
- // Checks if this info is already listed in display.
- for (DisplayResolveInfo existingInfo : mDisplayList) {
- if (resolveInfoMatch(dri.mResolveInfo, existingInfo.mResolveInfo)) {
- return;
- }
- }
- mDisplayList.add(dri);
- }
- }
-
- @Nullable
- public ResolveInfo resolveInfoForPosition(int position, boolean filtered) {
- TargetInfo target = targetInfoForPosition(position, filtered);
- if (target != null) {
- return target.getResolveInfo();
- }
- return null;
- }
-
- @Nullable
- public TargetInfo targetInfoForPosition(int position, boolean filtered) {
- if (filtered) {
- return getItem(position);
- }
- if (mDisplayList.size() > position) {
- return mDisplayList.get(position);
- }
- return null;
- }
-
- public int getCount() {
- int totalSize = mDisplayList == null || mDisplayList.isEmpty() ? mPlaceholderCount :
- mDisplayList.size();
- if (mFilterLastUsed && mLastChosenPosition >= 0) {
- totalSize--;
- }
- return totalSize;
- }
-
- public int getUnfilteredCount() {
- return mDisplayList.size();
- }
-
- @Nullable
- public TargetInfo getItem(int position) {
- if (mFilterLastUsed && mLastChosenPosition >= 0 && position >= mLastChosenPosition) {
- position++;
- }
- if (mDisplayList.size() > position) {
- return mDisplayList.get(position);
- } else {
- return null;
- }
- }
-
- public long getItemId(int position) {
- return position;
- }
-
- public int getDisplayResolveInfoCount() {
- return mDisplayList.size();
- }
-
- public DisplayResolveInfo getDisplayResolveInfo(int index) {
- // Used to query services. We only query services for primary targets, not alternates.
- return mDisplayList.get(index);
- }
-
- public final View getView(int position, View convertView, ViewGroup parent) {
- View view = convertView;
- if (view == null) {
- view = createView(parent);
- }
- onBindView(view, getItem(position));
- return view;
- }
-
- public final View createView(ViewGroup parent) {
- final View view = onCreateView(parent);
- final ViewHolder holder = new ViewHolder(view);
- view.setTag(holder);
- return view;
- }
-
- public View onCreateView(ViewGroup parent) {
- return mInflater.inflate(
- com.android.internal.R.layout.resolve_list_item, parent, false);
- }
-
- public final void bindView(int position, View view) {
- onBindView(view, getItem(position));
- }
-
- protected void onBindView(View view, TargetInfo info) {
- final ViewHolder holder = (ViewHolder) view.getTag();
- if (info == null) {
- holder.icon.setImageDrawable(
- getDrawable(R.drawable.resolver_icon_placeholder));
- return;
- }
-
- final CharSequence label = info.getDisplayLabel();
- if (!TextUtils.equals(holder.text.getText(), label)) {
- holder.text.setText(info.getDisplayLabel());
- }
-
- // Always show a subLabel for visual consistency across list items. Show an empty
- // subLabel if the subLabel is the same as the label
- CharSequence subLabel = info.getExtendedInfo();
- if (TextUtils.equals(label, subLabel)) subLabel = null;
-
- if (!TextUtils.equals(holder.text2.getText(), subLabel)
- && !TextUtils.isEmpty(subLabel)) {
- holder.text2.setVisibility(View.VISIBLE);
- holder.text2.setText(subLabel);
- }
-
- if (info.isSuspended()) {
- holder.icon.setColorFilter(mSuspendedMatrixColorFilter);
- } else {
- holder.icon.setColorFilter(null);
- }
-
- if (info instanceof DisplayResolveInfo
- && !((DisplayResolveInfo) info).hasDisplayIcon()) {
- new LoadIconTask((DisplayResolveInfo) info, holder.icon).execute();
- } else {
- holder.icon.setImageDrawable(info.getDisplayIcon());
- }
- }
- }
-
-
@VisibleForTesting
public static final class ResolvedComponentInfo {
public final ComponentName name;
@@ -2133,23 +1280,6 @@
}
}
- static class ViewHolder {
- public View itemView;
- public Drawable defaultItemViewBackground;
-
- public TextView text;
- public TextView text2;
- public ImageView icon;
-
- public ViewHolder(View view) {
- itemView = view;
- defaultItemViewBackground = view.getBackground();
- text = (TextView) view.findViewById(com.android.internal.R.id.text1);
- text2 = (TextView) view.findViewById(com.android.internal.R.id.text2);
- icon = (ImageView) view.findViewById(R.id.icon);
- }
- }
-
class ItemClickListener implements AdapterView.OnItemClickListener,
AdapterView.OnItemLongClickListener {
@Override
@@ -2200,33 +1330,6 @@
}
- class LoadIconTask extends AsyncTask<Void, Void, Drawable> {
- protected final DisplayResolveInfo mDisplayResolveInfo;
- private final ResolveInfo mResolveInfo;
- private final ImageView mTargetView;
-
- LoadIconTask(DisplayResolveInfo dri, ImageView target) {
- mDisplayResolveInfo = dri;
- mResolveInfo = dri.getResolveInfo();
- mTargetView = target;
- }
-
- @Override
- protected Drawable doInBackground(Void... params) {
- return loadIconForResolveInfo(mResolveInfo);
- }
-
- @Override
- protected void onPostExecute(Drawable d) {
- if (mAdapter.getOtherProfile() == mDisplayResolveInfo) {
- bindProfileView();
- } else {
- mDisplayResolveInfo.setDisplayIcon(d);
- mTargetView.setImageDrawable(d);
- }
- }
- }
-
static final boolean isSpecificUriMatch(int match) {
match = match&IntentFilter.MATCH_CATEGORY_MASK;
return match >= IntentFilter.MATCH_CATEGORY_HOST
diff --git a/core/java/com/android/internal/app/ResolverListAdapter.java b/core/java/com/android/internal/app/ResolverListAdapter.java
new file mode 100644
index 0000000..4076dda
--- /dev/null
+++ b/core/java/com/android/internal/app/ResolverListAdapter.java
@@ -0,0 +1,862 @@
+/*
+ * 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.internal.app;
+
+import static android.content.Context.ACTIVITY_SERVICE;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.ActivityManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.LabeledIntent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.ColorMatrix;
+import android.graphics.ColorMatrixColorFilter;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.AsyncTask;
+import android.os.Process;
+import android.os.RemoteException;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.internal.R;
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.app.ResolverActivity.ResolvedComponentInfo;
+import com.android.internal.app.chooser.DisplayResolveInfo;
+import com.android.internal.app.chooser.TargetInfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ResolverListAdapter extends BaseAdapter {
+ private static final String TAG = "ResolverListAdapter";
+
+ private final List<Intent> mIntents;
+ private final Intent[] mInitialIntents;
+ private final List<ResolveInfo> mBaseResolveList;
+ private final PackageManager mPm;
+ protected final Context mContext;
+ private final ColorMatrixColorFilter mSuspendedMatrixColorFilter;
+ private final boolean mUseLayoutForBrowsables;
+ private final int mIconDpi;
+ protected ResolveInfo mLastChosen;
+ private DisplayResolveInfo mOtherProfile;
+ ResolverListController mResolverListController;
+ private int mPlaceholderCount;
+ private boolean mAllTargetsAreBrowsers = false;
+
+ protected final LayoutInflater mInflater;
+
+ // This one is the list that the Adapter will actually present.
+ List<DisplayResolveInfo> mDisplayList;
+ List<ResolvedComponentInfo> mUnfilteredResolveList;
+
+ private int mLastChosenPosition = -1;
+ private boolean mFilterLastUsed;
+ private final ResolverListCommunicator mResolverListCommunicator;
+ private Runnable mPostListReadyRunnable;
+
+ public ResolverListAdapter(Context context, List<Intent> payloadIntents,
+ Intent[] initialIntents, List<ResolveInfo> rList,
+ boolean filterLastUsed,
+ ResolverListController resolverListController,
+ boolean useLayoutForBrowsables,
+ ResolverListCommunicator resolverListCommunicator) {
+ mContext = context;
+ mIntents = payloadIntents;
+ mInitialIntents = initialIntents;
+ mBaseResolveList = rList;
+ mInflater = LayoutInflater.from(context);
+ mPm = context.getPackageManager();
+ mDisplayList = new ArrayList<>();
+ mFilterLastUsed = filterLastUsed;
+ mResolverListController = resolverListController;
+ mSuspendedMatrixColorFilter = createSuspendedColorMatrix();
+ mUseLayoutForBrowsables = useLayoutForBrowsables;
+ mResolverListCommunicator = resolverListCommunicator;
+ final ActivityManager am = (ActivityManager) mContext.getSystemService(ACTIVITY_SERVICE);
+ mIconDpi = am.getLauncherLargeIconDensity();
+ }
+
+ public void handlePackagesChanged() {
+ rebuildList();
+ mResolverListCommunicator.onHandlePackagesChanged();
+ }
+
+ public void setPlaceholderCount(int count) {
+ mPlaceholderCount = count;
+ }
+
+ public int getPlaceholderCount() {
+ return mPlaceholderCount;
+ }
+
+ @Nullable
+ public DisplayResolveInfo getFilteredItem() {
+ if (mFilterLastUsed && mLastChosenPosition >= 0) {
+ // Not using getItem since it offsets to dodge this position for the list
+ return mDisplayList.get(mLastChosenPosition);
+ }
+ return null;
+ }
+
+ public DisplayResolveInfo getOtherProfile() {
+ return mOtherProfile;
+ }
+
+ public int getFilteredPosition() {
+ if (mFilterLastUsed && mLastChosenPosition >= 0) {
+ return mLastChosenPosition;
+ }
+ return AbsListView.INVALID_POSITION;
+ }
+
+ public boolean hasFilteredItem() {
+ return mFilterLastUsed && mLastChosen != null;
+ }
+
+ public float getScore(DisplayResolveInfo target) {
+ return mResolverListController.getScore(target);
+ }
+
+ public void updateModel(ComponentName componentName) {
+ mResolverListController.updateModel(componentName);
+ }
+
+ public void updateChooserCounts(String packageName, int userId, String action) {
+ mResolverListController.updateChooserCounts(packageName, userId, action);
+ }
+
+ /**
+ * @return true if all items in the display list are defined as browsers by
+ * ResolveInfo.handleAllWebDataURI
+ */
+ public boolean areAllTargetsBrowsers() {
+ return mAllTargetsAreBrowsers;
+ }
+
+ /**
+ * Rebuild the list of resolvers. In some cases some parts will need some asynchronous work
+ * to complete.
+ *
+ * @return Whether or not the list building is completed.
+ */
+ protected boolean rebuildList() {
+ List<ResolvedComponentInfo> currentResolveList = null;
+ // Clear the value of mOtherProfile from previous call.
+ mOtherProfile = null;
+ mLastChosen = null;
+ mLastChosenPosition = -1;
+ mAllTargetsAreBrowsers = false;
+ mDisplayList.clear();
+ if (mBaseResolveList != null) {
+ currentResolveList = mUnfilteredResolveList = new ArrayList<>();
+ mResolverListController.addResolveListDedupe(currentResolveList,
+ mResolverListCommunicator.getTargetIntent(),
+ mBaseResolveList);
+ } else {
+ currentResolveList = mUnfilteredResolveList =
+ mResolverListController.getResolversForIntent(shouldGetResolvedFilter(),
+ mResolverListCommunicator.shouldGetActivityMetadata(),
+ mIntents);
+ if (currentResolveList == null) {
+ processSortedList(currentResolveList);
+ return true;
+ }
+ List<ResolvedComponentInfo> originalList =
+ mResolverListController.filterIneligibleActivities(currentResolveList,
+ true);
+ if (originalList != null) {
+ mUnfilteredResolveList = originalList;
+ }
+ }
+
+ // So far we only support a single other profile at a time.
+ // The first one we see gets special treatment.
+ for (ResolvedComponentInfo info : currentResolveList) {
+ ResolveInfo resolveInfo = info.getResolveInfoAt(0);
+ if (resolveInfo.targetUserId != UserHandle.USER_CURRENT) {
+ Intent pOrigIntent = mResolverListCommunicator.getReplacementIntent(
+ resolveInfo.activityInfo,
+ info.getIntentAt(0));
+ Intent replacementIntent = mResolverListCommunicator.getReplacementIntent(
+ resolveInfo.activityInfo,
+ mResolverListCommunicator.getTargetIntent());
+ mOtherProfile = new DisplayResolveInfo(info.getIntentAt(0),
+ resolveInfo,
+ resolveInfo.loadLabel(mPm),
+ resolveInfo.loadLabel(mPm),
+ pOrigIntent != null ? pOrigIntent : replacementIntent,
+ makePresentationGetter(resolveInfo));
+ currentResolveList.remove(info);
+ break;
+ }
+ }
+
+ if (mOtherProfile == null) {
+ try {
+ mLastChosen = mResolverListController.getLastChosen();
+ } catch (RemoteException re) {
+ Log.d(TAG, "Error calling getLastChosenActivity\n" + re);
+ }
+ }
+
+ int n;
+ if ((currentResolveList != null) && ((n = currentResolveList.size()) > 0)) {
+ // We only care about fixing the unfilteredList if the current resolve list and
+ // current resolve list are currently the same.
+ List<ResolvedComponentInfo> originalList =
+ mResolverListController.filterLowPriority(currentResolveList,
+ mUnfilteredResolveList == currentResolveList);
+ if (originalList != null) {
+ mUnfilteredResolveList = originalList;
+ }
+
+ if (currentResolveList.size() > 1) {
+ int placeholderCount = currentResolveList.size();
+ if (mResolverListCommunicator.useLayoutWithDefault()) {
+ --placeholderCount;
+ }
+ setPlaceholderCount(placeholderCount);
+ createSortingTask().execute(currentResolveList);
+ postListReadyRunnable();
+ return false;
+ } else {
+ processSortedList(currentResolveList);
+ return true;
+ }
+ } else {
+ processSortedList(currentResolveList);
+ return true;
+ }
+ }
+
+ AsyncTask<List<ResolvedComponentInfo>,
+ Void,
+ List<ResolvedComponentInfo>> createSortingTask() {
+ return new AsyncTask<List<ResolvedComponentInfo>,
+ Void,
+ List<ResolvedComponentInfo>>() {
+ @Override
+ protected List<ResolvedComponentInfo> doInBackground(
+ List<ResolvedComponentInfo>... params) {
+ mResolverListController.sort(params[0]);
+ return params[0];
+ }
+ @Override
+ protected void onPostExecute(List<ResolvedComponentInfo> sortedComponents) {
+ processSortedList(sortedComponents);
+ mResolverListCommunicator.updateProfileViewButton();
+ notifyDataSetChanged();
+ }
+ };
+ }
+
+
+ protected void processSortedList(List<ResolvedComponentInfo> sortedComponents) {
+ int n;
+ if (sortedComponents != null && (n = sortedComponents.size()) != 0) {
+ mAllTargetsAreBrowsers = mUseLayoutForBrowsables;
+
+ // First put the initial items at the top.
+ if (mInitialIntents != null) {
+ for (int i = 0; i < mInitialIntents.length; i++) {
+ Intent ii = mInitialIntents[i];
+ if (ii == null) {
+ continue;
+ }
+ ActivityInfo ai = ii.resolveActivityInfo(
+ mPm, 0);
+ if (ai == null) {
+ Log.w(TAG, "No activity found for " + ii);
+ continue;
+ }
+ ResolveInfo ri = new ResolveInfo();
+ ri.activityInfo = ai;
+ UserManager userManager =
+ (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+ if (ii instanceof LabeledIntent) {
+ LabeledIntent li = (LabeledIntent) ii;
+ ri.resolvePackageName = li.getSourcePackage();
+ ri.labelRes = li.getLabelResource();
+ ri.nonLocalizedLabel = li.getNonLocalizedLabel();
+ ri.icon = li.getIconResource();
+ ri.iconResourceId = ri.icon;
+ }
+ if (userManager.isManagedProfile()) {
+ ri.noResourceId = true;
+ ri.icon = 0;
+ }
+ mAllTargetsAreBrowsers &= ri.handleAllWebDataURI;
+
+ addResolveInfo(new DisplayResolveInfo(ii, ri,
+ ri.loadLabel(mPm), null, ii, makePresentationGetter(ri)));
+ }
+ }
+
+
+ for (ResolvedComponentInfo rci : sortedComponents) {
+ final ResolveInfo ri = rci.getResolveInfoAt(0);
+ if (ri != null) {
+ mAllTargetsAreBrowsers &= ri.handleAllWebDataURI;
+ addResolveInfoWithAlternates(rci);
+ }
+ }
+ }
+
+ mResolverListCommunicator.sendVoiceChoicesIfNeeded();
+ postListReadyRunnable();
+ }
+
+ /**
+ * Some necessary methods for creating the list are initiated in onCreate and will also
+ * determine the layout known. We therefore can't update the UI inline and post to the
+ * handler thread to update after the current task is finished.
+ */
+ private void postListReadyRunnable() {
+ if (mPostListReadyRunnable == null) {
+ mPostListReadyRunnable = new Runnable() {
+ @Override
+ public void run() {
+ mResolverListCommunicator.onPostListReady();
+ mPostListReadyRunnable = null;
+ }
+ };
+ mContext.getMainThreadHandler().post(mPostListReadyRunnable);
+ }
+ }
+
+ public boolean shouldGetResolvedFilter() {
+ return mFilterLastUsed;
+ }
+
+ private void addResolveInfoWithAlternates(ResolvedComponentInfo rci) {
+ final int count = rci.getCount();
+ final Intent intent = rci.getIntentAt(0);
+ final ResolveInfo add = rci.getResolveInfoAt(0);
+ final Intent replaceIntent =
+ mResolverListCommunicator.getReplacementIntent(add.activityInfo, intent);
+ final Intent defaultIntent = mResolverListCommunicator.getReplacementIntent(
+ add.activityInfo, mResolverListCommunicator.getTargetIntent());
+ final DisplayResolveInfo
+ dri = new DisplayResolveInfo(intent, add,
+ replaceIntent != null ? replaceIntent : defaultIntent, makePresentationGetter(add));
+ addResolveInfo(dri);
+ if (replaceIntent == intent) {
+ // Only add alternates if we didn't get a specific replacement from
+ // the caller. If we have one it trumps potential alternates.
+ for (int i = 1, n = count; i < n; i++) {
+ final Intent altIntent = rci.getIntentAt(i);
+ dri.addAlternateSourceIntent(altIntent);
+ }
+ }
+ updateLastChosenPosition(add);
+ }
+
+ private void updateLastChosenPosition(ResolveInfo info) {
+ // If another profile is present, ignore the last chosen entry.
+ if (mOtherProfile != null) {
+ mLastChosenPosition = -1;
+ return;
+ }
+ if (mLastChosen != null
+ && mLastChosen.activityInfo.packageName.equals(info.activityInfo.packageName)
+ && mLastChosen.activityInfo.name.equals(info.activityInfo.name)) {
+ mLastChosenPosition = mDisplayList.size() - 1;
+ }
+ }
+
+ // We assume that at this point we've already filtered out the only intent for a different
+ // targetUserId which we're going to use.
+ private void addResolveInfo(DisplayResolveInfo dri) {
+ if (dri != null && dri.getResolveInfo() != null
+ && dri.getResolveInfo().targetUserId == UserHandle.USER_CURRENT) {
+ // Checks if this info is already listed in display.
+ for (DisplayResolveInfo existingInfo : mDisplayList) {
+ if (mResolverListCommunicator
+ .resolveInfoMatch(dri.getResolveInfo(), existingInfo.getResolveInfo())) {
+ return;
+ }
+ }
+ mDisplayList.add(dri);
+ }
+ }
+
+ @Nullable
+ public ResolveInfo resolveInfoForPosition(int position, boolean filtered) {
+ TargetInfo target = targetInfoForPosition(position, filtered);
+ if (target != null) {
+ return target.getResolveInfo();
+ }
+ return null;
+ }
+
+ @Nullable
+ public TargetInfo targetInfoForPosition(int position, boolean filtered) {
+ if (filtered) {
+ return getItem(position);
+ }
+ if (mDisplayList.size() > position) {
+ return mDisplayList.get(position);
+ }
+ return null;
+ }
+
+ public int getCount() {
+ int totalSize = mDisplayList == null || mDisplayList.isEmpty() ? mPlaceholderCount :
+ mDisplayList.size();
+ if (mFilterLastUsed && mLastChosenPosition >= 0) {
+ totalSize--;
+ }
+ return totalSize;
+ }
+
+ public int getUnfilteredCount() {
+ return mDisplayList.size();
+ }
+
+ @Nullable
+ public TargetInfo getItem(int position) {
+ if (mFilterLastUsed && mLastChosenPosition >= 0 && position >= mLastChosenPosition) {
+ position++;
+ }
+ if (mDisplayList.size() > position) {
+ return mDisplayList.get(position);
+ } else {
+ return null;
+ }
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ public int getDisplayResolveInfoCount() {
+ return mDisplayList.size();
+ }
+
+ public DisplayResolveInfo getDisplayResolveInfo(int index) {
+ // Used to query services. We only query services for primary targets, not alternates.
+ return mDisplayList.get(index);
+ }
+
+ public final View getView(int position, View convertView, ViewGroup parent) {
+ View view = convertView;
+ if (view == null) {
+ view = createView(parent);
+ }
+ onBindView(view, getItem(position));
+ return view;
+ }
+
+ public final View createView(ViewGroup parent) {
+ final View view = onCreateView(parent);
+ final ViewHolder holder = new ViewHolder(view);
+ view.setTag(holder);
+ return view;
+ }
+
+ public View onCreateView(ViewGroup parent) {
+ return mInflater.inflate(
+ com.android.internal.R.layout.resolve_list_item, parent, false);
+ }
+
+ public final void bindView(int position, View view) {
+ onBindView(view, getItem(position));
+ }
+
+ protected void onBindView(View view, TargetInfo info) {
+ final ViewHolder holder = (ViewHolder) view.getTag();
+ if (info == null) {
+ holder.icon.setImageDrawable(
+ mContext.getDrawable(R.drawable.resolver_icon_placeholder));
+ return;
+ }
+
+ if (info instanceof DisplayResolveInfo
+ && !((DisplayResolveInfo) info).hasDisplayLabel()) {
+ getLoadLabelTask((DisplayResolveInfo) info, holder).execute();
+ } else {
+ holder.bindLabel(info.getDisplayLabel(), info.getExtendedInfo());
+ }
+
+ if (info.isSuspended()) {
+ holder.icon.setColorFilter(mSuspendedMatrixColorFilter);
+ } else {
+ holder.icon.setColorFilter(null);
+ }
+
+ if (info instanceof DisplayResolveInfo
+ && !((DisplayResolveInfo) info).hasDisplayIcon()) {
+ new ResolverListAdapter.LoadIconTask((DisplayResolveInfo) info, holder.icon).execute();
+ } else {
+ holder.icon.setImageDrawable(info.getDisplayIcon(mContext));
+ }
+ }
+
+ protected LoadLabelTask getLoadLabelTask(DisplayResolveInfo info, ViewHolder holder) {
+ return new LoadLabelTask(info, holder);
+ }
+
+ public void onDestroy() {
+ if (mPostListReadyRunnable != null) {
+ mContext.getMainThreadHandler().removeCallbacks(mPostListReadyRunnable);
+ mPostListReadyRunnable = null;
+ }
+ if (mResolverListController != null) {
+ mResolverListController.destroy();
+ }
+ }
+
+ private ColorMatrixColorFilter createSuspendedColorMatrix() {
+ int grayValue = 127;
+ float scale = 0.5f; // half bright
+
+ ColorMatrix tempBrightnessMatrix = new ColorMatrix();
+ float[] mat = tempBrightnessMatrix.getArray();
+ mat[0] = scale;
+ mat[6] = scale;
+ mat[12] = scale;
+ mat[4] = grayValue;
+ mat[9] = grayValue;
+ mat[14] = grayValue;
+
+ ColorMatrix matrix = new ColorMatrix();
+ matrix.setSaturation(0.0f);
+ matrix.preConcat(tempBrightnessMatrix);
+ return new ColorMatrixColorFilter(matrix);
+ }
+
+ ActivityInfoPresentationGetter makePresentationGetter(ActivityInfo ai) {
+ return new ActivityInfoPresentationGetter(mContext, mIconDpi, ai);
+ }
+
+ ResolveInfoPresentationGetter makePresentationGetter(ResolveInfo ri) {
+ return new ResolveInfoPresentationGetter(mContext, mIconDpi, ri);
+ }
+
+ Drawable loadIconForResolveInfo(ResolveInfo ri) {
+ // Load icons based on the current process. If in work profile icons should be badged.
+ return makePresentationGetter(ri).getIcon(Process.myUserHandle());
+ }
+
+ void loadFilteredItemIconTaskAsync(@NonNull ImageView iconView) {
+ final DisplayResolveInfo iconInfo = getFilteredItem();
+ if (iconView != null && iconInfo != null) {
+ new LoadIconTask(iconInfo, iconView).execute();
+ }
+ }
+
+ /**
+ * Necessary methods to communicate between {@link ResolverListAdapter}
+ * and {@link ResolverActivity}.
+ */
+ interface ResolverListCommunicator {
+
+ boolean resolveInfoMatch(ResolveInfo lhs, ResolveInfo rhs);
+
+ Intent getReplacementIntent(ActivityInfo activityInfo, Intent defIntent);
+
+ void onPostListReady();
+
+ void sendVoiceChoicesIfNeeded();
+
+ void updateProfileViewButton();
+
+ boolean useLayoutWithDefault();
+
+ boolean shouldGetActivityMetadata();
+
+ Intent getTargetIntent();
+
+ void onHandlePackagesChanged();
+ }
+
+ static class ViewHolder {
+ public View itemView;
+ public Drawable defaultItemViewBackground;
+
+ public TextView text;
+ public TextView text2;
+ public ImageView icon;
+
+ ViewHolder(View view) {
+ itemView = view;
+ defaultItemViewBackground = view.getBackground();
+ text = (TextView) view.findViewById(com.android.internal.R.id.text1);
+ text2 = (TextView) view.findViewById(com.android.internal.R.id.text2);
+ icon = (ImageView) view.findViewById(R.id.icon);
+ }
+
+ public void bindLabel(CharSequence label, CharSequence subLabel) {
+ if (!TextUtils.equals(text.getText(), label)) {
+ text.setText(label);
+ }
+
+ // Always show a subLabel for visual consistency across list items. Show an empty
+ // subLabel if the subLabel is the same as the label
+ if (TextUtils.equals(label, subLabel)) {
+ subLabel = null;
+ }
+
+ if (!TextUtils.equals(text2.getText(), subLabel)
+ && !TextUtils.isEmpty(subLabel)) {
+ text2.setVisibility(View.VISIBLE);
+ text2.setText(subLabel);
+ }
+ }
+ }
+
+ protected class LoadLabelTask extends AsyncTask<Void, Void, CharSequence[]> {
+ private final DisplayResolveInfo mDisplayResolveInfo;
+ private final ViewHolder mHolder;
+
+ protected LoadLabelTask(DisplayResolveInfo dri, ViewHolder holder) {
+ mDisplayResolveInfo = dri;
+ mHolder = holder;
+ }
+
+ @Override
+ protected CharSequence[] doInBackground(Void... voids) {
+ ResolveInfoPresentationGetter pg =
+ makePresentationGetter(mDisplayResolveInfo.getResolveInfo());
+ return new CharSequence[] {
+ pg.getLabel(),
+ pg.getSubLabel()
+ };
+ }
+
+ @Override
+ protected void onPostExecute(CharSequence[] result) {
+ mDisplayResolveInfo.setDisplayLabel(result[0]);
+ mDisplayResolveInfo.setExtendedInfo(result[1]);
+ mHolder.bindLabel(result[0], result[1]);
+ }
+ }
+
+ class LoadIconTask extends AsyncTask<Void, Void, Drawable> {
+ protected final com.android.internal.app.chooser.DisplayResolveInfo mDisplayResolveInfo;
+ private final ResolveInfo mResolveInfo;
+ private final ImageView mTargetView;
+
+ LoadIconTask(DisplayResolveInfo dri, ImageView target) {
+ mDisplayResolveInfo = dri;
+ mResolveInfo = dri.getResolveInfo();
+ mTargetView = target;
+ }
+
+ @Override
+ protected Drawable doInBackground(Void... params) {
+ return loadIconForResolveInfo(mResolveInfo);
+ }
+
+ @Override
+ protected void onPostExecute(Drawable d) {
+ if (getOtherProfile() == mDisplayResolveInfo) {
+ mResolverListCommunicator.updateProfileViewButton();
+ } else {
+ mDisplayResolveInfo.setDisplayIcon(d);
+ mTargetView.setImageDrawable(d);
+ }
+ }
+ }
+
+ /**
+ * Loads the icon and label for the provided ResolveInfo.
+ */
+ @VisibleForTesting
+ public static class ResolveInfoPresentationGetter extends ActivityInfoPresentationGetter {
+ private final ResolveInfo mRi;
+ public ResolveInfoPresentationGetter(Context ctx, int iconDpi, ResolveInfo ri) {
+ super(ctx, iconDpi, ri.activityInfo);
+ mRi = ri;
+ }
+
+ @Override
+ Drawable getIconSubstituteInternal() {
+ Drawable dr = null;
+ try {
+ // Do not use ResolveInfo#getIconResource() as it defaults to the app
+ if (mRi.resolvePackageName != null && mRi.icon != 0) {
+ dr = loadIconFromResource(
+ mPm.getResourcesForApplication(mRi.resolvePackageName), mRi.icon);
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(TAG, "SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON permission granted but "
+ + "couldn't find resources for package", e);
+ }
+
+ // Fall back to ActivityInfo if no icon is found via ResolveInfo
+ if (dr == null) dr = super.getIconSubstituteInternal();
+
+ return dr;
+ }
+
+ @Override
+ String getAppSubLabelInternal() {
+ // Will default to app name if no intent filter or activity label set, make sure to
+ // check if subLabel matches label before final display
+ return (String) mRi.loadLabel(mPm);
+ }
+ }
+
+ /**
+ * Loads the icon and label for the provided ActivityInfo.
+ */
+ @VisibleForTesting
+ public static class ActivityInfoPresentationGetter extends
+ TargetPresentationGetter {
+ private final ActivityInfo mActivityInfo;
+ public ActivityInfoPresentationGetter(Context ctx, int iconDpi,
+ ActivityInfo activityInfo) {
+ super(ctx, iconDpi, activityInfo.applicationInfo);
+ mActivityInfo = activityInfo;
+ }
+
+ @Override
+ Drawable getIconSubstituteInternal() {
+ Drawable dr = null;
+ try {
+ // Do not use ActivityInfo#getIconResource() as it defaults to the app
+ if (mActivityInfo.icon != 0) {
+ dr = loadIconFromResource(
+ mPm.getResourcesForApplication(mActivityInfo.applicationInfo),
+ mActivityInfo.icon);
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(TAG, "SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON permission granted but "
+ + "couldn't find resources for package", e);
+ }
+
+ return dr;
+ }
+
+ @Override
+ String getAppSubLabelInternal() {
+ // Will default to app name if no activity label set, make sure to check if subLabel
+ // matches label before final display
+ return (String) mActivityInfo.loadLabel(mPm);
+ }
+ }
+
+ /**
+ * Loads the icon and label for the provided ApplicationInfo. Defaults to using the application
+ * icon and label over any IntentFilter or Activity icon to increase user understanding, with an
+ * exception for applications that hold the right permission. Always attempts to use available
+ * resources over PackageManager loading mechanisms so badging can be done by iconloader. Uses
+ * Strings to strip creative formatting.
+ */
+ private abstract static class TargetPresentationGetter {
+ @Nullable abstract Drawable getIconSubstituteInternal();
+ @Nullable abstract String getAppSubLabelInternal();
+
+ private Context mCtx;
+ private final int mIconDpi;
+ private final boolean mHasSubstitutePermission;
+ private final ApplicationInfo mAi;
+
+ protected PackageManager mPm;
+
+ TargetPresentationGetter(Context ctx, int iconDpi, ApplicationInfo ai) {
+ mCtx = ctx;
+ mPm = ctx.getPackageManager();
+ mAi = ai;
+ mIconDpi = iconDpi;
+ mHasSubstitutePermission = PackageManager.PERMISSION_GRANTED == mPm.checkPermission(
+ android.Manifest.permission.SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON,
+ mAi.packageName);
+ }
+
+ public Drawable getIcon(UserHandle userHandle) {
+ return new BitmapDrawable(mCtx.getResources(), getIconBitmap(userHandle));
+ }
+
+ public Bitmap getIconBitmap(UserHandle userHandle) {
+ Drawable dr = null;
+ if (mHasSubstitutePermission) {
+ dr = getIconSubstituteInternal();
+ }
+
+ if (dr == null) {
+ try {
+ if (mAi.icon != 0) {
+ dr = loadIconFromResource(mPm.getResourcesForApplication(mAi), mAi.icon);
+ }
+ } catch (PackageManager.NameNotFoundException ignore) {
+ }
+ }
+
+ // Fall back to ApplicationInfo#loadIcon if nothing has been loaded
+ if (dr == null) {
+ dr = mAi.loadIcon(mPm);
+ }
+
+ SimpleIconFactory sif = SimpleIconFactory.obtain(mCtx);
+ Bitmap icon = sif.createUserBadgedIconBitmap(dr, userHandle);
+ sif.recycle();
+
+ return icon;
+ }
+
+ public String getLabel() {
+ String label = null;
+ // Apps with the substitute permission will always show the sublabel as their label
+ if (mHasSubstitutePermission) {
+ label = getAppSubLabelInternal();
+ }
+
+ if (label == null) {
+ label = (String) mAi.loadLabel(mPm);
+ }
+
+ return label;
+ }
+
+ public String getSubLabel() {
+ // Apps with the substitute permission will never have a sublabel
+ if (mHasSubstitutePermission) return null;
+ return getAppSubLabelInternal();
+ }
+
+ protected String loadLabelFromResource(Resources res, int resId) {
+ return res.getString(resId);
+ }
+
+ @Nullable
+ protected Drawable loadIconFromResource(Resources res, int resId) {
+ return res.getDrawableForDensity(resId, mIconDpi);
+ }
+
+ }
+}
diff --git a/core/java/com/android/internal/app/ResolverListController.java b/core/java/com/android/internal/app/ResolverListController.java
index b9a92b5..6cc60b7 100644
--- a/core/java/com/android/internal/app/ResolverListController.java
+++ b/core/java/com/android/internal/app/ResolverListController.java
@@ -31,6 +31,7 @@
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.app.chooser.DisplayResolveInfo;
import java.util.ArrayList;
import java.util.Collections;
@@ -274,6 +275,7 @@
// Fall into normal sort when number of ranked elements
// needed is not smaller than size of input list.
sort(inputList);
+ return;
}
try {
long beforeRank = System.currentTimeMillis();
@@ -331,7 +333,7 @@
}
@VisibleForTesting
- public float getScore(ResolverActivity.DisplayResolveInfo target) {
+ public float getScore(DisplayResolveInfo target) {
return mResolverComparator.getScore(target.getResolvedComponentName());
}
diff --git a/core/java/com/android/internal/app/SimpleIconFactory.java b/core/java/com/android/internal/app/SimpleIconFactory.java
index 7a4e76f..d618cdf 100644
--- a/core/java/com/android/internal/app/SimpleIconFactory.java
+++ b/core/java/com/android/internal/app/SimpleIconFactory.java
@@ -214,7 +214,7 @@
* @deprecated Do not use, functionality will be replaced by iconloader lib eventually.
*/
@Deprecated
- Bitmap createAppBadgedIconBitmap(@Nullable Drawable icon, Bitmap renderedAppIcon) {
+ public Bitmap createAppBadgedIconBitmap(@Nullable Drawable icon, Bitmap renderedAppIcon) {
// If no icon is provided use the system default
if (icon == null) {
icon = getFullResDefaultActivityIcon(mFillResIconDpi);
diff --git a/core/java/com/android/internal/app/chooser/ChooserTargetInfo.java b/core/java/com/android/internal/app/chooser/ChooserTargetInfo.java
new file mode 100644
index 0000000..a2d0953
--- /dev/null
+++ b/core/java/com/android/internal/app/chooser/ChooserTargetInfo.java
@@ -0,0 +1,53 @@
+/*
+ * 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.internal.app.chooser;
+
+import android.service.chooser.ChooserTarget;
+import android.text.TextUtils;
+
+/**
+ * A TargetInfo for Direct Share. Includes a {@link ChooserTarget} representing the
+ * Direct Share deep link into an application.
+ */
+public interface ChooserTargetInfo extends TargetInfo {
+ float getModifiedScore();
+
+ ChooserTarget getChooserTarget();
+
+ /**
+ * Do not label as 'equals', since this doesn't quite work
+ * as intended with java 8.
+ */
+ default boolean isSimilar(ChooserTargetInfo other) {
+ if (other == null) return false;
+
+ ChooserTarget ct1 = getChooserTarget();
+ ChooserTarget ct2 = other.getChooserTarget();
+
+ // If either is null, there is not enough info to make an informed decision
+ // about equality, so just exit
+ if (ct1 == null || ct2 == null) return false;
+
+ if (ct1.getComponentName().equals(ct2.getComponentName())
+ && TextUtils.equals(getDisplayLabel(), other.getDisplayLabel())
+ && TextUtils.equals(getExtendedInfo(), other.getExtendedInfo())) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java b/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java
new file mode 100644
index 0000000..c77444e
--- /dev/null
+++ b/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java
@@ -0,0 +1,182 @@
+/*
+ * 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.internal.app.chooser;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.ResolveInfo;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.UserHandle;
+
+import com.android.internal.app.ResolverActivity;
+import com.android.internal.app.ResolverListAdapter.ResolveInfoPresentationGetter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A TargetInfo plus additional information needed to render it (such as icon and label) and
+ * resolve it to an activity.
+ */
+public class DisplayResolveInfo implements TargetInfo {
+ // Temporary flag for new chooser delegate behavior.
+ private static final boolean ENABLE_CHOOSER_DELEGATE = true;
+
+ private final ResolveInfo mResolveInfo;
+ private CharSequence mDisplayLabel;
+ private Drawable mDisplayIcon;
+ private CharSequence mExtendedInfo;
+ private final Intent mResolvedIntent;
+ private final List<Intent> mSourceIntents = new ArrayList<>();
+ private boolean mIsSuspended;
+ private ResolveInfoPresentationGetter mResolveInfoPresentationGetter;
+
+ public DisplayResolveInfo(Intent originalIntent, ResolveInfo pri, Intent pOrigIntent,
+ ResolveInfoPresentationGetter resolveInfoPresentationGetter) {
+ this(originalIntent, pri, null /*mDisplayLabel*/, null /*mExtendedInfo*/, pOrigIntent,
+ resolveInfoPresentationGetter);
+ }
+
+ public DisplayResolveInfo(Intent originalIntent, ResolveInfo pri, CharSequence pLabel,
+ CharSequence pInfo, @NonNull Intent resolvedIntent,
+ @Nullable ResolveInfoPresentationGetter resolveInfoPresentationGetter) {
+ mSourceIntents.add(originalIntent);
+ mResolveInfo = pri;
+ mDisplayLabel = pLabel;
+ mExtendedInfo = pInfo;
+ mResolveInfoPresentationGetter = resolveInfoPresentationGetter;
+
+ final Intent intent = new Intent(resolvedIntent);
+ intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT
+ | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
+ final ActivityInfo ai = mResolveInfo.activityInfo;
+ intent.setComponent(new ComponentName(ai.applicationInfo.packageName, ai.name));
+
+ mIsSuspended = (ai.applicationInfo.flags & ApplicationInfo.FLAG_SUSPENDED) != 0;
+
+ mResolvedIntent = intent;
+ }
+
+ private DisplayResolveInfo(DisplayResolveInfo other, Intent fillInIntent, int flags,
+ ResolveInfoPresentationGetter resolveInfoPresentationGetter) {
+ mSourceIntents.addAll(other.getAllSourceIntents());
+ mResolveInfo = other.mResolveInfo;
+ mDisplayLabel = other.mDisplayLabel;
+ mDisplayIcon = other.mDisplayIcon;
+ mExtendedInfo = other.mExtendedInfo;
+ mResolvedIntent = new Intent(other.mResolvedIntent);
+ mResolvedIntent.fillIn(fillInIntent, flags);
+ mResolveInfoPresentationGetter = resolveInfoPresentationGetter;
+ }
+
+ public ResolveInfo getResolveInfo() {
+ return mResolveInfo;
+ }
+
+ public CharSequence getDisplayLabel() {
+ if (mDisplayLabel == null && mResolveInfoPresentationGetter != null) {
+ mDisplayLabel = mResolveInfoPresentationGetter.getLabel();
+ mExtendedInfo = mResolveInfoPresentationGetter.getSubLabel();
+ }
+ return mDisplayLabel;
+ }
+
+ public boolean hasDisplayLabel() {
+ return mDisplayLabel != null;
+ }
+
+ public void setDisplayLabel(CharSequence displayLabel) {
+ mDisplayLabel = displayLabel;
+ }
+
+ public void setExtendedInfo(CharSequence extendedInfo) {
+ mExtendedInfo = extendedInfo;
+ }
+
+ public Drawable getDisplayIcon(Context context) {
+ return mDisplayIcon;
+ }
+
+ @Override
+ public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
+ return new DisplayResolveInfo(this, fillInIntent, flags, mResolveInfoPresentationGetter);
+ }
+
+ @Override
+ public List<Intent> getAllSourceIntents() {
+ return mSourceIntents;
+ }
+
+ public void addAlternateSourceIntent(Intent alt) {
+ mSourceIntents.add(alt);
+ }
+
+ public void setDisplayIcon(Drawable icon) {
+ mDisplayIcon = icon;
+ }
+
+ public boolean hasDisplayIcon() {
+ return mDisplayIcon != null;
+ }
+
+ public CharSequence getExtendedInfo() {
+ return mExtendedInfo;
+ }
+
+ public Intent getResolvedIntent() {
+ return mResolvedIntent;
+ }
+
+ @Override
+ public ComponentName getResolvedComponentName() {
+ return new ComponentName(mResolveInfo.activityInfo.packageName,
+ mResolveInfo.activityInfo.name);
+ }
+
+ @Override
+ public boolean start(Activity activity, Bundle options) {
+ activity.startActivity(mResolvedIntent, options);
+ return true;
+ }
+
+ @Override
+ public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
+ if (ENABLE_CHOOSER_DELEGATE) {
+ return activity.startAsCallerImpl(mResolvedIntent, options, false, userId);
+ } else {
+ activity.startActivityAsCaller(mResolvedIntent, options, null, false, userId);
+ return true;
+ }
+ }
+
+ @Override
+ public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
+ activity.startActivityAsUser(mResolvedIntent, options, user);
+ return false;
+ }
+
+ public boolean isSuspended() {
+ return mIsSuspended;
+ }
+}
diff --git a/core/java/com/android/internal/app/chooser/NotSelectableTargetInfo.java b/core/java/com/android/internal/app/chooser/NotSelectableTargetInfo.java
new file mode 100644
index 0000000..22cbdaa6
--- /dev/null
+++ b/core/java/com/android/internal/app/chooser/NotSelectableTargetInfo.java
@@ -0,0 +1,88 @@
+/*
+ * 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.internal.app.chooser;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.os.UserHandle;
+import android.service.chooser.ChooserTarget;
+
+import com.android.internal.app.ResolverActivity;
+
+import java.util.List;
+
+/**
+ * Distinguish between targets that selectable by the user, vs those that are
+ * placeholders for the system while information is loading in an async manner.
+ */
+public abstract class NotSelectableTargetInfo implements ChooserTargetInfo {
+
+ public Intent getResolvedIntent() {
+ return null;
+ }
+
+ public ComponentName getResolvedComponentName() {
+ return null;
+ }
+
+ public boolean start(Activity activity, Bundle options) {
+ return false;
+ }
+
+ public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
+ return false;
+ }
+
+ public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
+ return false;
+ }
+
+ public ResolveInfo getResolveInfo() {
+ return null;
+ }
+
+ public CharSequence getDisplayLabel() {
+ return null;
+ }
+
+ public CharSequence getExtendedInfo() {
+ return null;
+ }
+
+ public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
+ return null;
+ }
+
+ public List<Intent> getAllSourceIntents() {
+ return null;
+ }
+
+ public float getModifiedScore() {
+ return -0.1f;
+ }
+
+ public ChooserTarget getChooserTarget() {
+ return null;
+ }
+
+ public boolean isSuspended() {
+ return false;
+ }
+}
diff --git a/core/java/com/android/internal/app/chooser/SelectableTargetInfo.java b/core/java/com/android/internal/app/chooser/SelectableTargetInfo.java
new file mode 100644
index 0000000..1cc4857
--- /dev/null
+++ b/core/java/com/android/internal/app/chooser/SelectableTargetInfo.java
@@ -0,0 +1,316 @@
+/*
+ * 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.internal.app.chooser;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.LauncherApps;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ShortcutInfo;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
+import android.os.Bundle;
+import android.os.UserHandle;
+import android.service.chooser.ChooserTarget;
+import android.text.SpannableStringBuilder;
+import android.util.Log;
+
+import com.android.internal.app.ChooserActivity;
+import com.android.internal.app.ChooserFlags;
+import com.android.internal.app.ResolverActivity;
+import com.android.internal.app.ResolverListAdapter.ActivityInfoPresentationGetter;
+import com.android.internal.app.SimpleIconFactory;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Live target, currently selectable by the user.
+ * @see NotSelectableTargetInfo
+ */
+public final class SelectableTargetInfo implements ChooserTargetInfo {
+ private static final String TAG = "SelectableTargetInfo";
+
+ private final Context mContext;
+ private final DisplayResolveInfo mSourceInfo;
+ private final ResolveInfo mBackupResolveInfo;
+ private final ChooserTarget mChooserTarget;
+ private final String mDisplayLabel;
+ private final PackageManager mPm;
+ private final SelectableTargetInfoCommunicator mSelectableTargetInfoCommunicator;
+ private Drawable mBadgeIcon = null;
+ private CharSequence mBadgeContentDescription;
+ private Drawable mDisplayIcon;
+ private final Intent mFillInIntent;
+ private final int mFillInFlags;
+ private final float mModifiedScore;
+ private boolean mIsSuspended = false;
+
+ public SelectableTargetInfo(Context context, DisplayResolveInfo sourceInfo,
+ ChooserTarget chooserTarget,
+ float modifiedScore, SelectableTargetInfoCommunicator selectableTargetInfoComunicator) {
+ mContext = context;
+ mSourceInfo = sourceInfo;
+ mChooserTarget = chooserTarget;
+ mModifiedScore = modifiedScore;
+ mPm = mContext.getPackageManager();
+ mSelectableTargetInfoCommunicator = selectableTargetInfoComunicator;
+ if (sourceInfo != null) {
+ final ResolveInfo ri = sourceInfo.getResolveInfo();
+ if (ri != null) {
+ final ActivityInfo ai = ri.activityInfo;
+ if (ai != null && ai.applicationInfo != null) {
+ final PackageManager pm = mContext.getPackageManager();
+ mBadgeIcon = pm.getApplicationIcon(ai.applicationInfo);
+ mBadgeContentDescription = pm.getApplicationLabel(ai.applicationInfo);
+ mIsSuspended =
+ (ai.applicationInfo.flags & ApplicationInfo.FLAG_SUSPENDED) != 0;
+ }
+ }
+ }
+ // TODO(b/121287224): do this in the background thread, and only for selected targets
+ mDisplayIcon = getChooserTargetIconDrawable(chooserTarget);
+
+ if (sourceInfo != null) {
+ mBackupResolveInfo = null;
+ } else {
+ mBackupResolveInfo =
+ mContext.getPackageManager().resolveActivity(getResolvedIntent(), 0);
+ }
+
+ mFillInIntent = null;
+ mFillInFlags = 0;
+
+ mDisplayLabel = sanitizeDisplayLabel(chooserTarget.getTitle());
+ }
+
+ private SelectableTargetInfo(SelectableTargetInfo other,
+ Intent fillInIntent, int flags) {
+ mContext = other.mContext;
+ mPm = other.mPm;
+ mSelectableTargetInfoCommunicator = other.mSelectableTargetInfoCommunicator;
+ mSourceInfo = other.mSourceInfo;
+ mBackupResolveInfo = other.mBackupResolveInfo;
+ mChooserTarget = other.mChooserTarget;
+ mBadgeIcon = other.mBadgeIcon;
+ mBadgeContentDescription = other.mBadgeContentDescription;
+ mDisplayIcon = other.mDisplayIcon;
+ mFillInIntent = fillInIntent;
+ mFillInFlags = flags;
+ mModifiedScore = other.mModifiedScore;
+
+ mDisplayLabel = sanitizeDisplayLabel(mChooserTarget.getTitle());
+ }
+
+ private String sanitizeDisplayLabel(CharSequence label) {
+ SpannableStringBuilder sb = new SpannableStringBuilder(label);
+ sb.clearSpans();
+ return sb.toString();
+ }
+
+ public boolean isSuspended() {
+ return mIsSuspended;
+ }
+
+ /**
+ * Since ShortcutInfos are returned by ShortcutManager, we can cache the shortcuts and skip
+ * the call to LauncherApps#getShortcuts(ShortcutQuery).
+ */
+ // TODO(121287224): Refactor code to apply the suggestion above
+ private Drawable getChooserTargetIconDrawable(ChooserTarget target) {
+ Drawable directShareIcon = null;
+
+ // First get the target drawable and associated activity info
+ final Icon icon = target.getIcon();
+ if (icon != null) {
+ directShareIcon = icon.loadDrawable(mContext);
+ } else if (ChooserFlags.USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS) {
+ Bundle extras = target.getIntentExtras();
+ if (extras != null && extras.containsKey(Intent.EXTRA_SHORTCUT_ID)) {
+ CharSequence shortcutId = extras.getCharSequence(Intent.EXTRA_SHORTCUT_ID);
+ LauncherApps launcherApps = (LauncherApps) mContext.getSystemService(
+ Context.LAUNCHER_APPS_SERVICE);
+ final LauncherApps.ShortcutQuery q = new LauncherApps.ShortcutQuery();
+ q.setPackage(target.getComponentName().getPackageName());
+ q.setShortcutIds(Arrays.asList(shortcutId.toString()));
+ q.setQueryFlags(LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC);
+ final List<ShortcutInfo> shortcuts =
+ launcherApps.getShortcuts(q, mContext.getUser());
+ if (shortcuts != null && shortcuts.size() > 0) {
+ directShareIcon = launcherApps.getShortcutIconDrawable(shortcuts.get(0), 0);
+ }
+ }
+ }
+
+ if (directShareIcon == null) return null;
+
+ ActivityInfo info = null;
+ try {
+ info = mPm.getActivityInfo(target.getComponentName(), 0);
+ } catch (PackageManager.NameNotFoundException error) {
+ Log.e(TAG, "Could not find activity associated with ChooserTarget");
+ }
+
+ if (info == null) return null;
+
+ // Now fetch app icon and raster with no badging even in work profile
+ Bitmap appIcon = mSelectableTargetInfoCommunicator.makePresentationGetter(info)
+ .getIconBitmap(UserHandle.getUserHandleForUid(UserHandle.myUserId()));
+
+ // Raster target drawable with appIcon as a badge
+ SimpleIconFactory sif = SimpleIconFactory.obtain(mContext);
+ Bitmap directShareBadgedIcon = sif.createAppBadgedIconBitmap(directShareIcon, appIcon);
+ sif.recycle();
+
+ return new BitmapDrawable(mContext.getResources(), directShareBadgedIcon);
+ }
+
+ public float getModifiedScore() {
+ return mModifiedScore;
+ }
+
+ @Override
+ public Intent getResolvedIntent() {
+ if (mSourceInfo != null) {
+ return mSourceInfo.getResolvedIntent();
+ }
+
+ final Intent targetIntent = new Intent(mSelectableTargetInfoCommunicator.getTargetIntent());
+ targetIntent.setComponent(mChooserTarget.getComponentName());
+ targetIntent.putExtras(mChooserTarget.getIntentExtras());
+ return targetIntent;
+ }
+
+ @Override
+ public ComponentName getResolvedComponentName() {
+ if (mSourceInfo != null) {
+ return mSourceInfo.getResolvedComponentName();
+ } else if (mBackupResolveInfo != null) {
+ return new ComponentName(mBackupResolveInfo.activityInfo.packageName,
+ mBackupResolveInfo.activityInfo.name);
+ }
+ return null;
+ }
+
+ private Intent getBaseIntentToSend() {
+ Intent result = getResolvedIntent();
+ if (result == null) {
+ Log.e(TAG, "ChooserTargetInfo: no base intent available to send");
+ } else {
+ result = new Intent(result);
+ if (mFillInIntent != null) {
+ result.fillIn(mFillInIntent, mFillInFlags);
+ }
+ result.fillIn(mSelectableTargetInfoCommunicator.getReferrerFillInIntent(), 0);
+ }
+ return result;
+ }
+
+ @Override
+ public boolean start(Activity activity, Bundle options) {
+ throw new RuntimeException("ChooserTargets should be started as caller.");
+ }
+
+ @Override
+ public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
+ final Intent intent = getBaseIntentToSend();
+ if (intent == null) {
+ return false;
+ }
+ intent.setComponent(mChooserTarget.getComponentName());
+ intent.putExtras(mChooserTarget.getIntentExtras());
+
+ // Important: we will ignore the target security checks in ActivityManager
+ // if and only if the ChooserTarget's target package is the same package
+ // where we got the ChooserTargetService that provided it. This lets a
+ // ChooserTargetService provide a non-exported or permission-guarded target
+ // to the chooser for the user to pick.
+ //
+ // If mSourceInfo is null, we got this ChooserTarget from the caller or elsewhere
+ // so we'll obey the caller's normal security checks.
+ final boolean ignoreTargetSecurity = mSourceInfo != null
+ && mSourceInfo.getResolvedComponentName().getPackageName()
+ .equals(mChooserTarget.getComponentName().getPackageName());
+ return activity.startAsCallerImpl(intent, options, ignoreTargetSecurity, userId);
+ }
+
+ @Override
+ public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
+ throw new RuntimeException("ChooserTargets should be started as caller.");
+ }
+
+ @Override
+ public ResolveInfo getResolveInfo() {
+ return mSourceInfo != null ? mSourceInfo.getResolveInfo() : mBackupResolveInfo;
+ }
+
+ @Override
+ public CharSequence getDisplayLabel() {
+ return mDisplayLabel;
+ }
+
+ @Override
+ public CharSequence getExtendedInfo() {
+ // ChooserTargets have badge icons, so we won't show the extended info to disambiguate.
+ return null;
+ }
+
+ @Override
+ public Drawable getDisplayIcon(Context context) {
+ return mDisplayIcon;
+ }
+
+ public ChooserTarget getChooserTarget() {
+ return mChooserTarget;
+ }
+
+ @Override
+ public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
+ return new SelectableTargetInfo(this, fillInIntent, flags);
+ }
+
+ @Override
+ public List<Intent> getAllSourceIntents() {
+ final List<Intent> results = new ArrayList<>();
+ if (mSourceInfo != null) {
+ // We only queried the service for the first one in our sourceinfo.
+ results.add(mSourceInfo.getAllSourceIntents().get(0));
+ }
+ return results;
+ }
+
+ /**
+ * Necessary methods to communicate between {@link SelectableTargetInfo}
+ * and {@link ResolverActivity} or {@link ChooserActivity}.
+ */
+ public interface SelectableTargetInfoCommunicator {
+
+ ActivityInfoPresentationGetter makePresentationGetter(ActivityInfo info);
+
+ Intent getTargetIntent();
+
+ Intent getReferrerFillInIntent();
+ }
+}
diff --git a/core/java/com/android/internal/app/chooser/TargetInfo.java b/core/java/com/android/internal/app/chooser/TargetInfo.java
new file mode 100644
index 0000000..b59def1
--- /dev/null
+++ b/core/java/com/android/internal/app/chooser/TargetInfo.java
@@ -0,0 +1,128 @@
+/*
+ * 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.internal.app.chooser;
+
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.UserHandle;
+
+import com.android.internal.app.ResolverActivity;
+
+import java.util.List;
+
+/**
+ * A single target as represented in the chooser.
+ */
+public interface TargetInfo {
+ /**
+ * Get the resolved intent that represents this target. Note that this may not be the
+ * intent that will be launched by calling one of the <code>start</code> methods provided;
+ * this is the intent that will be credited with the launch.
+ *
+ * @return the resolved intent for this target
+ */
+ Intent getResolvedIntent();
+
+ /**
+ * Get the resolved component name that represents this target. Note that this may not
+ * be the component that will be directly launched by calling one of the <code>start</code>
+ * methods provided; this is the component that will be credited with the launch.
+ *
+ * @return the resolved ComponentName for this target
+ */
+ ComponentName getResolvedComponentName();
+
+ /**
+ * Start the activity referenced by this target.
+ *
+ * @param activity calling Activity performing the launch
+ * @param options ActivityOptions bundle
+ * @return true if the start completed successfully
+ */
+ boolean start(Activity activity, Bundle options);
+
+ /**
+ * Start the activity referenced by this target as if the ResolverActivity's caller
+ * was performing the start operation.
+ *
+ * @param activity calling Activity (actually) performing the launch
+ * @param options ActivityOptions bundle
+ * @param userId userId to start as or {@link UserHandle#USER_NULL} for activity's caller
+ * @return true if the start completed successfully
+ */
+ boolean startAsCaller(ResolverActivity activity, Bundle options, int userId);
+
+ /**
+ * Start the activity referenced by this target as a given user.
+ *
+ * @param activity calling activity performing the launch
+ * @param options ActivityOptions bundle
+ * @param user handle for the user to start the activity as
+ * @return true if the start completed successfully
+ */
+ boolean startAsUser(Activity activity, Bundle options, UserHandle user);
+
+ /**
+ * Return the ResolveInfo about how and why this target matched the original query
+ * for available targets.
+ *
+ * @return ResolveInfo representing this target's match
+ */
+ ResolveInfo getResolveInfo();
+
+ /**
+ * Return the human-readable text label for this target.
+ *
+ * @return user-visible target label
+ */
+ CharSequence getDisplayLabel();
+
+ /**
+ * Return any extended info for this target. This may be used to disambiguate
+ * otherwise identical targets.
+ *
+ * @return human-readable disambig string or null if none present
+ */
+ CharSequence getExtendedInfo();
+
+ /**
+ * @return The drawable that should be used to represent this target including badge
+ * @param context
+ */
+ Drawable getDisplayIcon(Context context);
+
+ /**
+ * Clone this target with the given fill-in information.
+ */
+ TargetInfo cloneFilledIn(Intent fillInIntent, int flags);
+
+ /**
+ * @return the list of supported source intents deduped against this single target
+ */
+ List<Intent> getAllSourceIntents();
+
+ /**
+ * @return true if this target can be selected by the user
+ */
+ boolean isSuspended();
+}
diff --git a/core/java/com/android/internal/compat/IPlatformCompat.aidl b/core/java/com/android/internal/compat/IPlatformCompat.aidl
index 4099cfa..8391ad2 100644
--- a/core/java/com/android/internal/compat/IPlatformCompat.aidl
+++ b/core/java/com/android/internal/compat/IPlatformCompat.aidl
@@ -49,9 +49,10 @@
* you do not need to call this API directly. The change will be reported for you.
*
* @param changeId The ID of the compatibility change taking effect.
+ * @param userId The ID of the user that the operation is done for.
* @param packageName The package name of the app in question.
*/
- void reportChangeByPackageName(long changeId, in String packageName);
+ void reportChangeByPackageName(long changeId, in String packageName, int userId);
/**
* Reports that a compatibility change is affecting an app process now.
@@ -86,7 +87,7 @@
* be called when implementing functionality on behalf of the affected app.
*
* <p>Same as {@link #isChangeEnabled(long, ApplicationInfo)}, except it receives a package name
- * instead of an {@link ApplicationInfo}
+ * and userId instead of an {@link ApplicationInfo}
* object, and finds an app info object based on the package name. Returns {@code true} if
* there is no installed package by that name.
*
@@ -100,9 +101,10 @@
*
* @param changeId The ID of the compatibility change in question.
* @param packageName The package name of the app in question.
+ * @param userId The ID of the user that the operation is done for.
* @return {@code true} if the change is enabled for the current app.
*/
- boolean isChangeEnabledByPackageName(long changeId, in String packageName);
+ boolean isChangeEnabledByPackageName(long changeId, in String packageName, int userId);
/**
* Query if a given compatibility change is enabled for an app process. This method should
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 9bddd2a..d6b32b5 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -12668,23 +12668,23 @@
for (int i=0; i<NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
timeSignalStrengthTimeMs[i] = getWifiSignalStrengthTime(i, rawRealTime, which) / 1000;
}
- s.setLoggingDurationMs(computeBatteryRealtime(rawRealTime, which) / 1000);
- s.setKernelActiveTimeMs(getWifiActiveTime(rawRealTime, which) / 1000);
+ s.setLoggingDurationMillis(computeBatteryRealtime(rawRealTime, which) / 1000);
+ s.setKernelActiveTimeMillis(getWifiActiveTime(rawRealTime, which) / 1000);
s.setNumPacketsTx(getNetworkActivityPackets(NETWORK_WIFI_TX_DATA, which));
s.setNumBytesTx(getNetworkActivityBytes(NETWORK_WIFI_TX_DATA, which));
s.setNumPacketsRx(getNetworkActivityPackets(NETWORK_WIFI_RX_DATA, which));
s.setNumBytesRx(getNetworkActivityBytes(NETWORK_WIFI_RX_DATA, which));
- s.setSleepTimeMs(sleepTimeMs);
- s.setIdleTimeMs(idleTimeMs);
- s.setRxTimeMs(rxTimeMs);
- s.setTxTimeMs(txTimeMs);
- s.setScanTimeMs(scanTimeMs);
- s.setEnergyConsumedMaMs(energyConsumedMaMs);
+ s.setSleepTimeMillis(sleepTimeMs);
+ s.setIdleTimeMillis(idleTimeMs);
+ s.setRxTimeMillis(rxTimeMs);
+ s.setTxTimeMillis(txTimeMs);
+ s.setScanTimeMillis(scanTimeMs);
+ s.setEnergyConsumedMaMillis(energyConsumedMaMs);
s.setNumAppScanRequest(numAppScanRequest);
- s.setTimeInStateMs(timeInStateMs);
- s.setTimeInSupplicantStateMs(timeInSupplStateMs);
- s.setTimeInRxSignalStrengthLevelMs(timeSignalStrengthTimeMs);
- s.setMonitoredRailChargeConsumedMaMs(monitoredRailChargeConsumedMaMs);
+ s.setTimeInStateMillis(timeInStateMs);
+ s.setTimeInSupplicantStateMillis(timeInSupplStateMs);
+ s.setTimeInRxSignalStrengthLevelMillis(timeSignalStrengthTimeMs);
+ s.setMonitoredRailChargeConsumedMaMillis(monitoredRailChargeConsumedMaMs);
return s;
}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 363e549..865ec27 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -254,6 +254,18 @@
InputStream is;
try {
+ // If we are profiling the boot image, avoid preloading classes.
+ // Can't use device_config since we are the zygote.
+ String prop = SystemProperties.get(
+ "persist.device_config.runtime_native_boot.profilebootclasspath", "");
+ // Might be empty if the property is unset since the default is "".
+ if (prop.length() == 0) {
+ prop = SystemProperties.get("dalvik.vm.profilebootclasspath", "");
+ }
+ if ("true".equals(prop)) {
+ return;
+ }
+
is = new FileInputStream(PRELOADED_CLASSES);
} catch (FileNotFoundException e) {
Log.e(TAG, "Couldn't find " + PRELOADED_CLASSES + ".");
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl
index d9e2ba3..317469e 100644
--- a/core/java/com/android/internal/statusbar/IStatusBar.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl
@@ -155,12 +155,12 @@
// Used to show the authentication dialog (Biometrics, Device Credential)
void showAuthenticationDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver,
int biometricModality, boolean requireConfirmation, int userId, String opPackageName);
- // Used to notify the authentication dialog that a biometric has been authenticated or rejected
- void onBiometricAuthenticated(boolean authenticated, String failureReason);
+ // Used to notify the authentication dialog that a biometric has been authenticated
+ void onBiometricAuthenticated();
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
void onBiometricHelp(String message);
- // Used to set a message - the dialog will dismiss after a certain amount of time
- void onBiometricError(int errorCode, String error);
+ // Used to show an error - the dialog will dismiss after a certain amount of time
+ void onBiometricError(int modality, int error, int vendorCode);
// Used to hide the authentication dialog, e.g. when the application cancels authentication
void hideAuthenticationDialog();
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 659134a..499a4d2 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -104,12 +104,12 @@
// Used to show the authentication dialog (Biometrics, Device Credential)
void showAuthenticationDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver,
int biometricModality, boolean requireConfirmation, int userId, String opPackageName);
- // Used to notify the authentication dialog that a biometric has been authenticated or rejected
- void onBiometricAuthenticated(boolean authenticated, String failureReason);
+ // Used to notify the authentication dialog that a biometric has been authenticated
+ void onBiometricAuthenticated();
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
void onBiometricHelp(String message);
- // Used to set a message - the dialog will dismiss after a certain amount of time
- void onBiometricError(int errorCode, String error);
+ // Used to show an error - the dialog will dismiss after a certain amount of time
+ void onBiometricError(int modality, int error, int vendorCode);
// Used to hide the authentication dialog, e.g. when the application cancels authentication
void hideAuthenticationDialog();
}
diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl
index b626fc6..897b982 100644
--- a/core/java/com/android/internal/widget/ILockSettings.aidl
+++ b/core/java/com/android/internal/widget/ILockSettings.aidl
@@ -24,6 +24,7 @@
import android.security.keystore.recovery.KeyChainProtectionParams;
import android.security.keystore.recovery.RecoveryCertPath;
import com.android.internal.widget.ICheckCredentialProgressCallback;
+import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
import java.util.Map;
@@ -42,19 +43,16 @@
long getLong(in String key, in long defaultValue, in int userId);
@UnsupportedAppUsage
String getString(in String key, in String defaultValue, in int userId);
- boolean setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId, boolean allowUntrustedChange);
+ boolean setLockCredential(in LockscreenCredential credential, in LockscreenCredential savedCredential, int userId, boolean allowUntrustedChange);
void resetKeyStore(int userId);
- VerifyCredentialResponse checkCredential(in byte[] credential, int type, int userId,
+ VerifyCredentialResponse checkCredential(in LockscreenCredential credential, int userId,
in ICheckCredentialProgressCallback progressCallback);
- VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId);
- VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId);
+ VerifyCredentialResponse verifyCredential(in LockscreenCredential credential, long challenge, int userId);
+ VerifyCredentialResponse verifyTiedProfileChallenge(in LockscreenCredential credential, long challenge, int userId);
boolean checkVoldPassword(int userId);
- @UnsupportedAppUsage
- boolean havePattern(int userId);
- @UnsupportedAppUsage
- boolean havePassword(int userId);
- byte[] getHashFactor(in byte[] currentCredential, int userId);
- void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword);
+ int getCredentialType(int userId);
+ byte[] getHashFactor(in LockscreenCredential currentCredential, int userId);
+ void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in LockscreenCredential managedUserPassword);
boolean getSeparateProfileChallengeEnabled(int userId);
void registerStrongAuthTracker(in IStrongAuthTracker tracker);
void unregisterStrongAuthTracker(in IStrongAuthTracker tracker);
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 7a42985..b534213 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -17,9 +17,6 @@
package com.android.internal.widget;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_MANAGED;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
@@ -59,10 +56,10 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.LocalServices;
-import libcore.util.HexEncoding;
-
import com.google.android.collect.Lists;
+import libcore.util.HexEncoding;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.MessageDigest;
@@ -117,13 +114,19 @@
// NOTE: When modifying this, make sure credential sufficiency validation logic is intact.
public static final int CREDENTIAL_TYPE_NONE = -1;
public static final int CREDENTIAL_TYPE_PATTERN = 1;
- public static final int CREDENTIAL_TYPE_PASSWORD = 2;
+ // This is the legacy value persisted on disk. Never return it to clients, but internally
+ // we still need it to handle upgrade cases.
+ public static final int CREDENTIAL_TYPE_PASSWORD_OR_PIN = 2;
+ public static final int CREDENTIAL_TYPE_PIN = 3;
+ public static final int CREDENTIAL_TYPE_PASSWORD = 4;
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"CREDENTIAL_TYPE_"}, value = {
CREDENTIAL_TYPE_NONE,
CREDENTIAL_TYPE_PATTERN,
- CREDENTIAL_TYPE_PASSWORD, // Either pin or password.
+ CREDENTIAL_TYPE_PASSWORD,
+ CREDENTIAL_TYPE_PIN,
+ // CREDENTIAL_TYPE_PASSWORD_OR_PIN is missing on purpose.
})
public @interface CredentialType {}
@@ -169,6 +172,7 @@
public static final String SYNTHETIC_PASSWORD_HANDLE_KEY = "sp-handle";
public static final String SYNTHETIC_PASSWORD_ENABLED_KEY = "enable-sp";
+ public static final int SYNTHETIC_PASSWORD_ENABLED_BY_DEFAULT = 1;
private static final String HISTORY_DELIMITER = ",";
@UnsupportedAppUsage
@@ -372,8 +376,8 @@
*
* @param credential The credential to check.
* @param challenge The challenge to verify against the credential
- * @return the attestation that the challenge was verified, or null
* @param userId The user whose credential is being verified
+ * @return the attestation that the challenge was verified, or null
* @throws RequestThrottledException if credential verification is being throttled due to
* to many incorrect attempts.
* @throws IllegalStateException if called on the main thread.
@@ -383,7 +387,7 @@
throwIfCalledOnMainThread();
try {
VerifyCredentialResponse response = getLockSettings().verifyCredential(
- credential.getCredential(), credential.getType(), challenge, userId);
+ credential, challenge, userId);
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
return response.getPayload();
} else if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_RETRY) {
@@ -392,6 +396,7 @@
return null;
}
} catch (RemoteException re) {
+ Log.e(TAG, "failed to verify credential", re);
return null;
}
}
@@ -413,8 +418,7 @@
throwIfCalledOnMainThread();
try {
VerifyCredentialResponse response = getLockSettings().checkCredential(
- credential.getCredential(), credential.getType(),
- userId, wrapCallback(progressCallback));
+ credential, userId, wrapCallback(progressCallback));
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
return true;
@@ -424,6 +428,7 @@
return false;
}
} catch (RemoteException re) {
+ Log.e(TAG, "failed to check credential", re);
return false;
}
}
@@ -447,8 +452,7 @@
throwIfCalledOnMainThread();
try {
VerifyCredentialResponse response =
- getLockSettings().verifyTiedProfileChallenge(
- credential.getCredential(), credential.getType(), challenge, userId);
+ getLockSettings().verifyTiedProfileChallenge(credential, challenge, userId);
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
return response.getPayload();
@@ -458,6 +462,7 @@
return null;
}
} catch (RemoteException re) {
+ Log.e(TAG, "failed to verify tied profile credential", re);
return null;
}
}
@@ -471,6 +476,7 @@
try {
return getLockSettings().checkVoldPassword(userId);
} catch (RemoteException re) {
+ Log.e(TAG, "failed to check vold password", re);
return false;
}
}
@@ -482,7 +488,7 @@
public byte[] getPasswordHistoryHashFactor(@NonNull LockscreenCredential currentPassword,
int userId) {
try {
- return getLockSettings().getHashFactor(currentPassword.getCredential(), userId);
+ return getLockSettings().getHashFactor(currentPassword, userId);
} catch (RemoteException e) {
Log.e(TAG, "failed to get hash factor", e);
return null;
@@ -524,30 +530,6 @@
}
/**
- * Check to see if the user has stored a lock pattern.
- * @return Whether a saved pattern exists.
- */
- private boolean savedPatternExists(int userId) {
- try {
- return getLockSettings().havePattern(userId);
- } catch (RemoteException re) {
- return false;
- }
- }
-
- /**
- * Check to see if the user has stored a lock pattern.
- * @return Whether a saved pattern exists.
- */
- private boolean savedPasswordExists(int userId) {
- try {
- return getLockSettings().havePassword(userId);
- } catch (RemoteException re) {
- return false;
- }
- }
-
- /**
* Return true if the user has ever chosen a pattern. This is true even if the pattern is
* currently cleared.
*
@@ -568,22 +550,11 @@
/**
* Used by device policy manager to validate the current password
* information it has.
+ * @Deprecated use {@link #getKeyguardStoredPasswordQuality}
*/
@UnsupportedAppUsage
public int getActivePasswordQuality(int userId) {
- int quality = getKeyguardStoredPasswordQuality(userId);
-
- if (isLockPasswordEnabled(quality, userId)) {
- // Quality is a password and a password exists. Return the quality.
- return quality;
- }
-
- if (isLockPatternEnabled(quality, userId)) {
- // Quality is a pattern and a pattern exists. Return the quality.
- return quality;
- }
-
- return PASSWORD_QUALITY_UNSPECIFIED;
+ return getKeyguardStoredPasswordQuality(userId);
}
/**
@@ -641,6 +612,22 @@
return quality == PASSWORD_QUALITY_NUMERIC || quality == PASSWORD_QUALITY_NUMERIC_COMPLEX;
}
+ /** Returns the canonical password quality corresponding to the given credential type. */
+ public static int credentialTypeToPasswordQuality(int credentialType) {
+ switch (credentialType) {
+ case CREDENTIAL_TYPE_NONE:
+ return PASSWORD_QUALITY_UNSPECIFIED;
+ case CREDENTIAL_TYPE_PATTERN:
+ return PASSWORD_QUALITY_SOMETHING;
+ case CREDENTIAL_TYPE_PIN:
+ return PASSWORD_QUALITY_NUMERIC;
+ case CREDENTIAL_TYPE_PASSWORD:
+ return PASSWORD_QUALITY_ALPHABETIC;
+ default:
+ throw new IllegalStateException("Unknown type: " + credentialType);
+ }
+ }
+
/**
* Save a new lockscreen credential.
*
@@ -684,19 +671,12 @@
}
newCredential.checkLength();
- final int currentQuality = getKeyguardStoredPasswordQuality(userHandle);
- setKeyguardStoredPasswordQuality(newCredential.getQuality(), userHandle);
-
try {
if (!getLockSettings().setLockCredential(
- newCredential.getCredential(), newCredential.getType(),
- savedCredential.getCredential(),
- newCredential.getQuality(), userHandle, allowUntrustedChange)) {
- setKeyguardStoredPasswordQuality(currentQuality, userHandle);
+ newCredential, savedCredential, userHandle, allowUntrustedChange)) {
return false;
}
- } catch (RemoteException | RuntimeException e) {
- setKeyguardStoredPasswordQuality(currentQuality, userHandle);
+ } catch (RemoteException e) {
throw new RuntimeException("Unable to save lock password", e);
}
@@ -904,14 +884,12 @@
* @see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)
*
* @return stored password quality
+ * @deprecated use {@link #getCredentialTypeForUser(int)} instead
*/
@UnsupportedAppUsage
+ @Deprecated
public int getKeyguardStoredPasswordQuality(int userHandle) {
- return (int) getLong(PASSWORD_TYPE_KEY, PASSWORD_QUALITY_UNSPECIFIED, userHandle);
- }
-
- private void setKeyguardStoredPasswordQuality(int quality, int userHandle) {
- setLong(PASSWORD_TYPE_KEY, quality, userHandle);
+ return credentialTypeToPasswordQuality(getCredentialTypeForUser(userHandle));
}
/**
@@ -920,17 +898,17 @@
*
* @param userHandle Managed profile user id
* @param enabled True if separate challenge is enabled
- * @param managedUserPassword Managed profile previous password. Null when {@code enabled} is
+ * @param profilePassword Managed profile previous password. Null when {@code enabled} is
* true
*/
public void setSeparateProfileChallengeEnabled(int userHandle, boolean enabled,
- LockscreenCredential managedUserPassword) {
+ LockscreenCredential profilePassword) {
if (!isManagedProfile(userHandle)) {
return;
}
try {
getLockSettings().setSeparateProfileChallengeEnabled(userHandle, enabled,
- managedUserPassword.getCredential());
+ profilePassword);
reportEnabledTrustAgentsChanged(userHandle);
} catch (RemoteException e) {
Log.e(TAG, "Couldn't update work profile challenge enabled");
@@ -1098,28 +1076,33 @@
}
/**
+ * Returns the credential type of the user, can be one of {@link #CREDENTIAL_TYPE_NONE},
+ * {@link #CREDENTIAL_TYPE_PATTERN}, {@link #CREDENTIAL_TYPE_PIN} and
+ * {@link #CREDENTIAL_TYPE_PASSWORD}
+ */
+ public @CredentialType int getCredentialTypeForUser(int userHandle) {
+ try {
+ return getLockSettings().getCredentialType(userHandle);
+ } catch (RemoteException re) {
+ Log.e(TAG, "failed to get credential type", re);
+ return CREDENTIAL_TYPE_NONE;
+ }
+ }
+
+ /**
* @param userId the user for which to report the value
* @return Whether the lock screen is secured.
*/
@UnsupportedAppUsage
public boolean isSecure(int userId) {
- int mode = getKeyguardStoredPasswordQuality(userId);
- return isLockPatternEnabled(mode, userId) || isLockPasswordEnabled(mode, userId);
+ int type = getCredentialTypeForUser(userId);
+ return type != CREDENTIAL_TYPE_NONE;
}
@UnsupportedAppUsage
public boolean isLockPasswordEnabled(int userId) {
- return isLockPasswordEnabled(getKeyguardStoredPasswordQuality(userId), userId);
- }
-
- private boolean isLockPasswordEnabled(int mode, int userId) {
- final boolean passwordEnabled = mode == PASSWORD_QUALITY_ALPHABETIC
- || mode == PASSWORD_QUALITY_NUMERIC
- || mode == PASSWORD_QUALITY_NUMERIC_COMPLEX
- || mode == PASSWORD_QUALITY_ALPHANUMERIC
- || mode == PASSWORD_QUALITY_COMPLEX
- || mode == PASSWORD_QUALITY_MANAGED;
- return passwordEnabled && savedPasswordExists(userId);
+ int type = getCredentialTypeForUser(userId);
+ return type == CREDENTIAL_TYPE_PASSWORD || type == CREDENTIAL_TYPE_PIN;
}
/**
@@ -1127,7 +1110,8 @@
*/
@UnsupportedAppUsage
public boolean isLockPatternEnabled(int userId) {
- return isLockPatternEnabled(getKeyguardStoredPasswordQuality(userId), userId);
+ int type = getCredentialTypeForUser(userId);
+ return type == CREDENTIAL_TYPE_PATTERN;
}
@Deprecated
@@ -1143,10 +1127,6 @@
setBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, true, userId);
}
- private boolean isLockPatternEnabled(int mode, int userId) {
- return mode == PASSWORD_QUALITY_SOMETHING && savedPatternExists(userId);
- }
-
/**
* @return Whether the visible pattern is enabled.
*/
@@ -1543,8 +1523,8 @@
* @param userHandle The user who's lock credential to be changed
* @return {@code true} if the operation is successful.
*/
- public boolean setLockCredentialWithToken(LockscreenCredential credential, long tokenHandle,
- byte[] token, int userHandle) {
+ public boolean setLockCredentialWithToken(@NonNull LockscreenCredential credential,
+ long tokenHandle, byte[] token, int userHandle) {
if (!hasSecureLockScreen()) {
throw new UnsupportedOperationException(
"This operation requires the lock screen feature.");
@@ -1552,19 +1532,8 @@
credential.checkLength();
LockSettingsInternal localService = getLockSettingsInternal();
- final int currentQuality = getKeyguardStoredPasswordQuality(userHandle);
- setKeyguardStoredPasswordQuality(credential.getQuality(), userHandle);
-
- try {
- if (!localService.setLockCredentialWithToken(credential.getCredential(),
- credential.getType(),
- tokenHandle, token, credential.getQuality(), userHandle)) {
- setKeyguardStoredPasswordQuality(currentQuality, userHandle);
- return false;
- }
- } catch (RuntimeException e) {
- setKeyguardStoredPasswordQuality(currentQuality, userHandle);
- throw new RuntimeException("Unable to save lock credential", e);
+ if (!localService.setLockCredentialWithToken(credential, tokenHandle, token, userHandle)) {
+ return false;
}
onPostPasswordChanged(credential, userHandle);
@@ -1765,7 +1734,8 @@
}
public boolean isSyntheticPasswordEnabled() {
- return getLong(SYNTHETIC_PASSWORD_ENABLED_KEY, 0, UserHandle.USER_SYSTEM) != 0;
+ return getLong(SYNTHETIC_PASSWORD_ENABLED_KEY, SYNTHETIC_PASSWORD_ENABLED_BY_DEFAULT,
+ UserHandle.USER_SYSTEM) != 0;
}
/**
diff --git a/core/java/com/android/internal/widget/LockSettingsInternal.java b/core/java/com/android/internal/widget/LockSettingsInternal.java
index aab2f4b..dd05576 100644
--- a/core/java/com/android/internal/widget/LockSettingsInternal.java
+++ b/core/java/com/android/internal/widget/LockSettingsInternal.java
@@ -59,8 +59,8 @@
*
* @return true if password is set.
*/
- public abstract boolean setLockCredentialWithToken(byte[] credential, int type,
- long tokenHandle, byte[] token, int requestedQuality, int userId);
+ public abstract boolean setLockCredentialWithToken(LockscreenCredential credential,
+ long tokenHandle, byte[] token, int userId);
public abstract boolean unlockUserWithToken(long tokenHandle, byte[] token, int userId);
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/core/java/com/android/internal/widget/LockscreenCredential.aidl
similarity index 75%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to core/java/com/android/internal/widget/LockscreenCredential.aidl
index d2ec357..22501ff 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/core/java/com/android/internal/widget/LockscreenCredential.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -14,6 +14,10 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package com.android.internal.widget;
-parcelable TimeSignal;
\ No newline at end of file
+/**
+ * A class representing a lockscreen credential.
+ */
+parcelable LockscreenCredential;
+
diff --git a/core/java/com/android/internal/widget/LockscreenCredential.java b/core/java/com/android/internal/widget/LockscreenCredential.java
index 19e6d97..f456349 100644
--- a/core/java/com/android/internal/widget/LockscreenCredential.java
+++ b/core/java/com/android/internal/widget/LockscreenCredential.java
@@ -16,14 +16,11 @@
package com.android.internal.widget;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
-
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -61,9 +58,6 @@
// Stores raw credential bytes, or null if credential has been zeroized. An empty password
// is represented as a byte array of length 0.
private byte[] mCredential;
- // Store the quality of the password, this is used to distinguish between pin
- // (PASSWORD_QUALITY_NUMERIC) and password (PASSWORD_QUALITY_ALPHABETIC).
- private final int mQuality;
/**
* Private constructor, use static builder methods instead.
@@ -72,15 +66,18 @@
* LockscreenCredential will only store the reference internally without copying. This is to
* minimize the number of extra copies introduced.
*/
- private LockscreenCredential(int type, int quality, byte[] credential) {
+ private LockscreenCredential(int type, byte[] credential) {
Preconditions.checkNotNull(credential);
if (type == CREDENTIAL_TYPE_NONE) {
Preconditions.checkArgument(credential.length == 0);
} else {
+ // Do not allow constructing a CREDENTIAL_TYPE_PASSWORD_OR_PIN object.
+ Preconditions.checkArgument(type == CREDENTIAL_TYPE_PIN
+ || type == CREDENTIAL_TYPE_PASSWORD
+ || type == CREDENTIAL_TYPE_PATTERN);
Preconditions.checkArgument(credential.length > 0);
}
mType = type;
- mQuality = quality;
mCredential = credential;
}
@@ -88,8 +85,7 @@
* Creates a LockscreenCredential object representing empty password.
*/
public static LockscreenCredential createNone() {
- return new LockscreenCredential(CREDENTIAL_TYPE_NONE, PASSWORD_QUALITY_UNSPECIFIED,
- new byte[0]);
+ return new LockscreenCredential(CREDENTIAL_TYPE_NONE, new byte[0]);
}
/**
@@ -97,7 +93,6 @@
*/
public static LockscreenCredential createPattern(@NonNull List<LockPatternView.Cell> pattern) {
return new LockscreenCredential(CREDENTIAL_TYPE_PATTERN,
- PASSWORD_QUALITY_SOMETHING,
LockPatternUtils.patternToByteArray(pattern));
}
@@ -106,16 +101,25 @@
*/
public static LockscreenCredential createPassword(@NonNull CharSequence password) {
return new LockscreenCredential(CREDENTIAL_TYPE_PASSWORD,
- PASSWORD_QUALITY_ALPHABETIC,
charSequenceToByteArray(password));
}
/**
+ * Creates a LockscreenCredential object representing a managed password for profile with
+ * unified challenge. This credentiall will have type {@code CREDENTIAL_TYPE_PASSWORD} for now.
+ * TODO: consider add a new credential type for this. This can then supersede the
+ * isLockTiedToParent argument in various places in LSS.
+ */
+ public static LockscreenCredential createManagedPassword(@NonNull byte[] password) {
+ return new LockscreenCredential(CREDENTIAL_TYPE_PASSWORD,
+ Arrays.copyOf(password, password.length));
+ }
+
+ /**
* Creates a LockscreenCredential object representing the given numeric PIN.
*/
public static LockscreenCredential createPin(@NonNull CharSequence pin) {
- return new LockscreenCredential(CREDENTIAL_TYPE_PASSWORD,
- PASSWORD_QUALITY_NUMERIC,
+ return new LockscreenCredential(CREDENTIAL_TYPE_PIN,
charSequenceToByteArray(pin));
}
@@ -143,27 +147,13 @@
}
}
- /**
- * Create a LockscreenCredential object based on raw credential and type
- * TODO: Remove once LSS.setUserPasswordMetrics accepts a LockscreenCredential
- */
- public static LockscreenCredential createRaw(int type, byte[] credential) {
- if (type == CREDENTIAL_TYPE_NONE) {
- return createNone();
- } else {
- return new LockscreenCredential(type, PASSWORD_QUALITY_UNSPECIFIED, credential);
- }
- }
-
private void ensureNotZeroized() {
Preconditions.checkState(mCredential != null, "Credential is already zeroized");
}
/**
* Returns the type of this credential. Can be one of {@link #CREDENTIAL_TYPE_NONE},
- * {@link #CREDENTIAL_TYPE_PATTERN} or {@link #CREDENTIAL_TYPE_PASSWORD}.
- *
- * TODO: Remove once credential type is internal. Callers should use {@link #isNone},
- * {@link #isPattern} and {@link #isPassword} instead.
+ * {@link #CREDENTIAL_TYPE_PATTERN}, {@link #CREDENTIAL_TYPE_PIN} or
+ * {@link #CREDENTIAL_TYPE_PASSWORD}.
*/
public int getType() {
ensureNotZeroized();
@@ -171,14 +161,6 @@
}
/**
- * Returns the quality type of the credential
- */
- public int getQuality() {
- ensureNotZeroized();
- return mQuality;
- }
-
- /**
* Returns the credential bytes. This is a direct reference of the internal field so
* callers should not modify it.
*
@@ -200,9 +182,11 @@
if (isPattern()) {
return StorageManager.CRYPT_TYPE_PATTERN;
}
+ if (isPin()) {
+ return StorageManager.CRYPT_TYPE_PIN;
+ }
if (isPassword()) {
- return mQuality == PASSWORD_QUALITY_NUMERIC
- ? StorageManager.CRYPT_TYPE_PIN : StorageManager.CRYPT_TYPE_PASSWORD;
+ return StorageManager.CRYPT_TYPE_PASSWORD;
}
throw new IllegalStateException("Unhandled credential type");
}
@@ -219,7 +203,13 @@
return mType == CREDENTIAL_TYPE_PATTERN;
}
- /** Returns whether this is a password credential */
+ /** Returns whether this is a numeric pin credential */
+ public boolean isPin() {
+ ensureNotZeroized();
+ return mType == CREDENTIAL_TYPE_PIN;
+ }
+
+ /** Returns whether this is an alphabetic password credential */
public boolean isPassword() {
ensureNotZeroized();
return mType == CREDENTIAL_TYPE_PASSWORD;
@@ -233,7 +223,7 @@
/** Create a copy of the credential */
public LockscreenCredential duplicate() {
- return new LockscreenCredential(mType, mQuality,
+ return new LockscreenCredential(mType,
mCredential != null ? Arrays.copyOf(mCredential, mCredential.length) : null);
}
@@ -263,7 +253,7 @@
}
return;
}
- if (isPassword()) {
+ if (isPassword() || isPin()) {
if (size() < LockPatternUtils.MIN_LOCK_PASSWORD_SIZE) {
throw new IllegalArgumentException("password must not be null and at least "
+ "of length " + LockPatternUtils.MIN_LOCK_PASSWORD_SIZE);
@@ -272,10 +262,22 @@
}
}
+ /**
+ * Check if this credential's type matches one that's retrieved from disk. The nuance here is
+ * that the framework used to not distinguish between PIN and password, so this method will
+ * allow a PIN/Password LockscreenCredential to match against the legacy
+ * {@link #CREDENTIAL_TYPE_PASSWORD_OR_PIN} stored on disk.
+ */
+ public boolean checkAgainstStoredType(int storedCredentialType) {
+ if (storedCredentialType == CREDENTIAL_TYPE_PASSWORD_OR_PIN) {
+ return getType() == CREDENTIAL_TYPE_PASSWORD || getType() == CREDENTIAL_TYPE_PIN;
+ }
+ return getType() == storedCredentialType;
+ }
+
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mType);
- dest.writeInt(mQuality);
dest.writeByteArray(mCredential);
}
@@ -284,8 +286,7 @@
@Override
public LockscreenCredential createFromParcel(Parcel source) {
- return new LockscreenCredential(source.readInt(), source.readInt(),
- source.createByteArray());
+ return new LockscreenCredential(source.readInt(), source.createByteArray());
}
@Override
@@ -307,7 +308,7 @@
@Override
public int hashCode() {
// Effective Java — Item 9
- return ((17 + mType) * 31 + mQuality) * 31 + mCredential.hashCode();
+ return (17 + mType) * 31 + mCredential.hashCode();
}
@Override
@@ -315,8 +316,7 @@
if (o == this) return true;
if (!(o instanceof LockscreenCredential)) return false;
final LockscreenCredential other = (LockscreenCredential) o;
- return mType == other.mType && mQuality == other.mQuality
- && Arrays.equals(mCredential, other.mCredential);
+ return mType == other.mType && Arrays.equals(mCredential, other.mCredential);
}
/**
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index ea0389f..b752396 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -26,6 +26,7 @@
import android.os.Environment;
import android.os.Process;
import android.os.SystemProperties;
+import android.os.Trace;
import android.os.storage.StorageManager;
import android.permission.PermissionManager.SplitPermissionInfo;
import android.text.TextUtils;
@@ -33,6 +34,7 @@
import android.util.ArraySet;
import android.util.Slog;
import android.util.SparseArray;
+import android.util.TimingsTraceLog;
import android.util.Xml;
import com.android.internal.annotations.VisibleForTesting;
@@ -411,7 +413,13 @@
}
SystemConfig() {
- readAllPermissions();
+ TimingsTraceLog log = new TimingsTraceLog(TAG, Trace.TRACE_TAG_SYSTEM_SERVER);
+ log.traceBegin("readAllPermissions");
+ try {
+ readAllPermissions();
+ } finally {
+ log.traceEnd();
+ }
}
private void readAllPermissions() {
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index bb57805..c0e4e1f 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -59,6 +59,10 @@
return instance_;
}
+static bool IsMemfd(const std::string& path) {
+ return android::base::StartsWith(path, "/memfd:");
+}
+
bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
// Check the static whitelist path.
for (const auto& whitelist_path : kPathWhitelist) {
@@ -87,6 +91,11 @@
return true;
}
+ // In-memory files created through memfd_create are allowed.
+ if (IsMemfd(path)) {
+ return true;
+ }
+
// Whitelist files needed for Runtime Resource Overlay, like these:
// /system/vendor/overlay/framework-res.apk
// /system/vendor/overlay-subdir/pg/framework-res.apk
@@ -312,6 +321,11 @@
return DetachSocket(fail_fn);
}
+ // Children can directly use in-memory files created through memfd_create.
+ if (IsMemfd(file_path)) {
+ return;
+ }
+
// NOTE: This might happen if the file was unlinked after being opened.
// It's a common pattern in the case of temporary files and the like but
// we should not allow such usage from the zygote.
diff --git a/core/proto/android/app/settings_enums.proto b/core/proto/android/app/settings_enums.proto
index 94be61f..97dae59 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -2406,6 +2406,11 @@
// CATEGORY: SETTINGS
// OS: Q
SETTINGS_AWARE_DISPLAY = 1750;
+
+ // OPEN: Settings > System > Input & Gesture > tap gesture
+ // CATEGORY: SETTINGS
+ // OS: Q
+ SETTINGS_GESTURE_TAP = 1751;
// ---- End Q Constants, all Q constants go above this line ----
// OPEN: Settings > Network & Internet > Wi-Fi > Click new network
// CATEGORY: SETTINGS
@@ -2426,4 +2431,9 @@
// and under gesture navigation mode.
DIALOG_TOGGLE_SCREEN_MAGNIFICATION_GESTURE_NAVIGATION = 1802;
+ // OPEN: Settings > Security & screen lock -> Encryption & credentials > Install a certificate
+ // CATEGORY: SETTINGS
+ // OS: R
+ INSTALL_CERTIFICATE_FROM_STORAGE = 1803;
+
}
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index a568c13..31c19ca 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -281,6 +281,7 @@
optional SettingProto force_rtl = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto emulate_display_cutout = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto force_desktop_mode_on_external_displays = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto enable_sizecompat_freeform = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
optional Development development = 39;
@@ -853,6 +854,7 @@
optional SettingProto low_battery_sounds_enabled = 12 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto trusted = 13;
optional SettingProto unlock = 14;
+ optional SettingProto wireless_charging_started = 15;
}
optional Sounds sounds = 110;
diff --git a/core/proto/android/server/notificationhistory.proto b/core/proto/android/server/notificationhistory.proto
new file mode 100644
index 0000000..1e6ee3f
--- /dev/null
+++ b/core/proto/android/server/notificationhistory.proto
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+syntax = "proto2";
+package com.android.server.notification;
+
+import "frameworks/base/core/proto/android/server/enums.proto";
+
+option java_multiple_files = true;
+
+// On disk data store for historical notifications
+message NotificationHistoryProto {
+ message StringPool {
+ optional int32 size = 1;
+ repeated string strings = 2;
+ }
+
+ message Notification {
+ // The package that posted the notification
+ optional string package = 1;
+ // package_index contains the index + 1 of the package name in the string pool
+ optional int32 package_index = 2;
+
+ // The name of the NotificationChannel this notification was posted to
+ optional string channel_name = 3;
+ // channel_name_index contains the index + 1 of the channel name in the string pool
+ optional int32 channel_name_index = 4;
+
+ // The id of the NotificationChannel this notification was posted to
+ optional string channel_id = 5;
+ // channel_id_index contains the index + 1 of the channel id in the string pool
+ optional int32 channel_id_index = 6;
+
+ // The uid of the package that posted the notification
+ optional int32 uid = 7;
+ // The user id that the notification was posted to
+ optional int32 user_id = 8;
+ // The time at which the notification was posted
+ optional int64 posted_time_ms = 9;
+ // The title of the notification
+ optional string title = 10;
+ // The text of the notification
+ optional string text = 11;
+ // The small icon of the notification
+ optional Icon icon = 12;
+
+ // Matches the constants of android.graphics.drawable.Icon
+ enum ImageTypeEnum {
+ TYPE_UNKNOWN = 0;
+ TYPE_BITMAP = 1;
+ TYPE_RESOURCE = 2;
+ TYPE_DATA = 3;
+ TYPE_URI = 4;
+ TYPE_ADAPTIVE_BITMAP = 5;
+ }
+
+ message Icon {
+ optional ImageTypeEnum image_type = 1;
+ optional string image_bitmap_filename = 2;
+ optional int32 image_resource_id = 3;
+ optional string image_resource_id_package = 4;
+ optional bytes image_data = 5;
+ optional int32 image_data_length = 6;
+ optional int32 image_data_offset = 7;
+ optional string image_uri = 8;
+ }
+ }
+
+ // Pool of strings to save space
+ optional StringPool string_pool = 1;
+ // Versioning fields
+ optional int32 major_version = 2;
+
+ // List of historical notifications
+ repeated Notification notification = 3;
+}
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto
index fd10503..a346a63 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -216,7 +216,8 @@
optional bool fills_parent = 4;
optional .android.graphics.RectProto bounds = 5;
optional .android.graphics.RectProto displayed_bounds = 6;
- optional bool defer_removal = 7;
+ // Will be removed soon.
+ optional bool defer_removal = 7 [deprecated=true];
optional int32 surface_width = 8;
optional int32 surface_height = 9;
}
diff --git a/core/proto/android/service/usb.proto b/core/proto/android/service/usb.proto
index 2e1de79..40c5a85 100644
--- a/core/proto/android/service/usb.proto
+++ b/core/proto/android/service/usb.proto
@@ -32,6 +32,7 @@
optional UsbPortManagerProto port_manager = 3;
optional UsbAlsaManagerProto alsa_manager = 4;
optional UsbSettingsManagerProto settings_manager = 5;
+ optional UsbPermissionsManagerProto permissions_manager = 6;
}
message UsbDeviceManagerProto {
@@ -309,26 +310,12 @@
option (android.msg_privacy).dest = DEST_AUTOMATIC;
optional int32 user_id = 1;
- repeated UsbSettingsDevicePermissionProto device_permissions = 2;
- repeated UsbSettingsAccessoryPermissionProto accessory_permissions = 3;
+ reserved 2; // previously device_permissions, now unused
+ reserved 3; // previously accessory_permissions, now unused
repeated UsbDeviceAttachedActivities device_attached_activities = 4;
repeated UsbAccessoryAttachedActivities accessory_attached_activities = 5;
}
-message UsbSettingsDevicePermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional string device_name = 1;
- repeated int32 uids = 2;
-}
-
-message UsbSettingsAccessoryPermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional string accessory_description = 1;
- repeated int32 uids = 2;
-}
-
message UsbProfileGroupSettingsManagerProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -345,6 +332,63 @@
optional UserPackageProto user_package = 2;
}
+message UsbPermissionsManagerProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ repeated UsbUserPermissionsManagerProto user_permissions = 1;
+}
+
+message UsbUserPermissionsManagerProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional int32 user_id = 1;
+
+ repeated UsbDevicePermissionProto device_permissions = 2;
+ repeated UsbAccessoryPermissionProto accessory_permissions = 3;
+
+ repeated UsbDevicePersistentPermissionProto device_persistent_permissions = 4;
+ repeated UsbAccessoryPersistentPermissionProto accessory_persistent_permissions = 5;
+}
+
+message UsbDevicePermissionProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Name of device set by manufacturer
+ // All devices of the same model have the same name
+ optional string device_name = 1;
+ repeated int32 uids = 2;
+}
+
+message UsbAccessoryPermissionProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Description of accessory set by manufacturer
+ // All accessories of the same model have the same description
+ optional string accessory_description = 1;
+ repeated int32 uids = 2;
+}
+
+message UsbDevicePersistentPermissionProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional UsbDeviceFilterProto device_filter = 1;
+ repeated UsbUidPermissionProto permission_values = 2;
+}
+
+message UsbAccessoryPersistentPermissionProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional UsbAccessoryFilterProto accessory_filter = 1;
+ repeated UsbUidPermissionProto permission_values = 2;
+}
+
+message UsbUidPermissionProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional int32 uid = 1;
+ optional bool is_granted = 2;
+}
+
message UsbDeviceFilterProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c365aae..11a5062 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -4511,9 +4511,9 @@
android:protectionLevel="signature" />
<!-- @SystemApi Allows an application to turn on / off quiet mode.
- @hide <p>Not for use by third-party applications. -->
+ @hide -->
<permission android:name="android.permission.MODIFY_QUIET_MODE"
- android:protectionLevel="signature|privileged" />
+ android:protectionLevel="signature|privileged|wellbeing" />
<!-- Allows internal management of the camera framework
@hide -->
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 4ca0df4..7f72a13 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> het geen internettoegang nie"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tik vir opsies"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Selnetwerk het nie internettoegang nie"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Netwerk het nie internettoegang nie"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Daar kan nie by private DNS-bediener ingegaan word nie"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Gekoppel"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> het beperkte konnektiwiteit"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tik om in elk geval te koppel"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Stoor"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nee, dankie"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Dateer op"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Gaan voort"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"wagwoord"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adres"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredietkaart"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debietkaart"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"betaalkaart"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kaart"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"gebruikernaam"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-posadres"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Bly kalm en soek skuiling naby."</string>
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index eb5265e..f576d04 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ምንም የበይነ መረብ መዳረሻ የለም"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ለአማራጮች መታ ያድርጉ"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"የተንቀሳቃሽ ስልክ አውታረ መረብ የበይነመረብ መዳረሻ የለውም"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"አውታረ መረብ የበይነመረብ መዳረሻ የለውም"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"የግል ዲኤንኤስ አገልጋይ ሊደረስበት አይችልም"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"ተገናኝቷል"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> የተገደበ ግንኙነት አለው"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ለማንኛውም ለማገናኘት መታ ያድርጉ"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"አስቀምጥ"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"አይ፣ አመሰግናለሁ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"አዘምን"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ቀጥል"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"የይለፍ ቃል"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"አድራሻ"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ክሬዲት ካርድ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ዴቢት ካርድ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"የክፍያ ካርድ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ካርድ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"የተጠቃሚ ስም"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"የኢሜይል አድራሻ"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ረጋ ይበሉና በአቅራቢያ ያለ መጠለያ ይፈልጉ።"</string>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index c9067e5..7974a08 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -1362,6 +1362,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"لا يتوفّر في <xliff:g id="NETWORK_SSID">%1$s</xliff:g> إمكانية الاتصال بالإنترنت."</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"انقر للحصول على الخيارات."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"شبكة الجوّال هذه غير متصلة بالإنترنت"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"الشبكة غير متصلة بالإنترنت"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"لا يمكن الوصول إلى خادم أسماء نظام نطاقات خاص"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"تمّ الاتصال."</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"إمكانية اتصال <xliff:g id="NETWORK_SSID">%1$s</xliff:g> محدودة."</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"يمكنك النقر للاتصال على أي حال."</string>
@@ -2101,9 +2104,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"حفظ"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"لا، شكرًا"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"تعديل"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"متابعة"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"كلمة مرور"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"عنوان"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"بطاقة ائتمان"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"بطاقة السحب الآلي"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"بطاقة الدفع"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"بطاقة"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"اسم المستخدم"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"عنوان البريد الإلكتروني"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"يُرجى الثبات والبحث عن ملاذ بالجوار."</string>
diff --git a/core/res/res/values-as/strings.xml b/core/res/res/values-as/strings.xml
index 7a89b65..018ca7e 100644
--- a/core/res/res/values-as/strings.xml
+++ b/core/res/res/values-as/strings.xml
@@ -1274,6 +1274,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>ৰ ইণ্টাৰনেটৰ এক্সেছ নাই"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"অধিক বিকল্পৰ বাবে টিপক"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"সংযোগ কৰা হ’ল"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>ৰ সকলো সেৱাৰ এক্সেছ নাই"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"যিকোনো প্ৰকাৰে সংযোগ কৰিবলৈ টিপক"</string>
@@ -1961,9 +1967,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"ছেভ কৰক"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"নালাগে, ধন্যবাদ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"আপডে’ট কৰক"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"অব্যাহত ৰাখক"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"পাছৱৰ্ড"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ঠিকনা"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ক্ৰেডিট কাৰ্ড"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ডেবিট কাৰ্ড"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"পৰিশোধৰ বাবে ব্যৱহাৰ কৰা কার্ড"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"কাৰ্ড"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ব্যৱহাৰকাৰীৰ নাম"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ইমেইল ঠিকনা"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"শান্ত হৈ থাকক আৰু ওচৰৰ ক\'ৰবাত আশ্ৰয় বিচাৰক।"</string>
diff --git a/core/res/res/values-az/strings.xml b/core/res/res/values-az/strings.xml
index 21dbf03..5b135cf 100644
--- a/core/res/res/values-az/strings.xml
+++ b/core/res/res/values-az/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> üçün internet girişi əlçatan deyil"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Seçimlər üçün tıklayın"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobil şəbəkənin internetə girişi yoxdur"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Şəbəkənin internetə girişi yoxdur"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Özəl DNS serverinə giriş mümkün deyil"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Qoşuldu"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> bağlantını məhdudlaşdırdı"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"İstənilən halda klikləyin"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Yadda saxlayın"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Xeyr, çox sağ olun"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Yeniləyin"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Davam edin"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"parol"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ünvan"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredit kartı"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debet kart"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ödəniş kartı"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kart"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"istifadəçi adı"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-poçt ünvanı"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Sakit qalın və yaxınlıqda sığınacaq axtarın."</string>
diff --git a/core/res/res/values-b+sr+Latn/strings.xml b/core/res/res/values-b+sr+Latn/strings.xml
index dbb788d..02b098f 100644
--- a/core/res/res/values-b+sr+Latn/strings.xml
+++ b/core/res/res/values-b+sr+Latn/strings.xml
@@ -1296,6 +1296,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nema pristup internetu"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Dodirnite za opcije"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilna mreža nema pristup internetu"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Mreža nema pristup internetu"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Pristup privatnom DNS serveru nije uspeo"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Povezano je"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ima ograničenu vezu"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Dodirnite da biste se ipak povezali"</string>
@@ -1996,9 +1999,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Sačuvaj"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ne, hvala"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Ažuriraj"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Nastavi"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"lozinka"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresa"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditna kartica"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debitna kartica"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"platna kartica"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kartica"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"korisničko ime"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"imejl adresa"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Ostanite mirni i potražite sklonište u okolini."</string>
diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml
index bae2640..4060ed7 100644
--- a/core/res/res/values-be/strings.xml
+++ b/core/res/res/values-be/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> не мае доступу ў інтэрнэт"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Дакраніцеся, каб убачыць параметры"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мабільная сетка не мае доступу ў інтэрнэт"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Сетка не мае доступу ў інтэрнэт"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Не ўдалося атрымаць доступ да прыватнага DNS-сервера"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Падключана"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> мае абмежаваную магчымасць падключэння"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Націсніце, каб падключыцца"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Захаваць"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Не, дзякуй"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Абнавіць"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Працягнуць"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"пароль"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"адрас"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"крэдытная картка"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дэбетовая картка"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"плацежная картка"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"картка"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"карыстальнік"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"адрас электроннай пошты"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Заставайцеся спакойнымі і пашукайце прытулак паблізу."</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index e7b3090..b0cea11e 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> няма достъп до интернет"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Докоснете за опции"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобилната мрежа няма достъп до интернет"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Мрежата няма достъп до интернет"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Не може да се осъществи достъп до частния DNS сървър"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Установена е връзка"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> има ограничена свързаност"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Докоснете, за да се свържете въпреки това"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Запазване"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Не, благодаря"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Актуализиране"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Напред"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"Паролата"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"Адресът"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"Кредитната карта"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебитна карта"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"карта за плащане"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"карта"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"потребителско име"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"имейл адрес"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Запазете спокойствие и потърсете убежище в района."</string>
diff --git a/core/res/res/values-bn/strings.xml b/core/res/res/values-bn/strings.xml
index beb08b2..514a6ce 100644
--- a/core/res/res/values-bn/strings.xml
+++ b/core/res/res/values-bn/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>-এর ইন্টারনেটে অ্যাক্সেস নেই"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"বিকল্পগুলির জন্য আলতো চাপুন"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"মোবাইল নেটওয়ার্কে কোনও ইন্টারনেট অ্যাক্সেস নেই"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"নেটওয়ার্কে কোনও ইন্টারনেট অ্যাক্সেস নেই"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"ব্যক্তিগত ডিএনএস সার্ভার অ্যাক্সেস করা যাবে না"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"কানেক্ট করা হয়েছে"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>-এর সীমিত কানেক্টিভিটি আছে"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"তবুও কানেক্ট করতে ট্যাপ করুন"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"সেভ করুন"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"না থাক"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"আপডেট করুন"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"চালিয়ে যান"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"পাসওয়ার্ড"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ঠিকানা"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ক্রেডিট কার্ড"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ডেবিট কার্ড"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"পেমেন্টের কার্ড"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"কার্ড"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ইউজারনেম"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ইমেল ঠিকানা"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"শান্ত থাকুন, আশেপাশে আশ্রয় খুঁজুন।"</string>
diff --git a/core/res/res/values-bs/strings.xml b/core/res/res/values-bs/strings.xml
index 862beee..1ddc0e2 100644
--- a/core/res/res/values-bs/strings.xml
+++ b/core/res/res/values-bs/strings.xml
@@ -1298,6 +1298,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Mreža <xliff:g id="NETWORK_SSID">%1$s</xliff:g> nema pristup internetu"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Dodirnite za opcije"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilna mreža nema pristup internetu"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Mreža nema pristup internetu"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Nije moguće pristupiti privatnom DNS serveru"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Povezano"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Mreža <xliff:g id="NETWORK_SSID">%1$s</xliff:g> ima ograničenu povezivost"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Dodirnite da se ipak povežete"</string>
@@ -1998,9 +2001,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Sačuvaj"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ne, hvala"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Ažuriraj"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Nastavi"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"lozinka"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresa"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditna kartica"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debitna kartica"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kartica za plaćanje"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kartica"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"korisničko ime"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adresa e-pošte"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Ostanite smireni i potražite sklonište u blizini."</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 28b9a16..fe7f87c 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -532,21 +532,21 @@
<string name="biometric_not_recognized" msgid="5770511773560736082">"No s\'ha reconegut"</string>
<string name="biometric_error_canceled" msgid="349665227864885880">"S\'ha cancel·lat l\'autenticació"</string>
<string name="biometric_error_device_not_secured" msgid="6583143098363528349">"No s\'ha establert cap PIN, patró o contrasenya"</string>
- <string name="fingerprint_acquired_partial" msgid="735082772341716043">"S\'ha detectat una empremta dactilar parcial. Torna-ho a provar."</string>
- <string name="fingerprint_acquired_insufficient" msgid="4596546021310923214">"No s\'ha pogut processar l\'empremta dactilar. Torna-ho a provar."</string>
+ <string name="fingerprint_acquired_partial" msgid="735082772341716043">"S\'ha detectat una empremta digital parcial. Torna-ho a provar."</string>
+ <string name="fingerprint_acquired_insufficient" msgid="4596546021310923214">"No s\'ha pogut processar l\'empremta digital. Torna-ho a provar."</string>
<string name="fingerprint_acquired_imager_dirty" msgid="1087209702421076105">"El sensor d\'empremtes dactilars està brut. Neteja\'l i torna-ho a provar."</string>
<string name="fingerprint_acquired_too_fast" msgid="6470642383109155969">"El dit s\'ha mogut massa ràpid. Torna-ho a provar."</string>
<string name="fingerprint_acquired_too_slow" msgid="59250885689661653">"El dit s\'ha mogut massa lentament. Torna-ho a provar."</string>
<string-array name="fingerprint_acquired_vendor">
</string-array>
- <string name="fingerprint_authenticated" msgid="5309333983002526448">"L\'empremta dactilar s\'ha autenticat"</string>
+ <string name="fingerprint_authenticated" msgid="5309333983002526448">"L\'empremta digital s\'ha autenticat"</string>
<string name="face_authenticated_no_confirmation_required" msgid="4018680978348659031">"Cara autenticada"</string>
<string name="face_authenticated_confirmation_required" msgid="8778347003507633610">"Cara autenticada; prem el botó per confirmar"</string>
<string name="fingerprint_error_hw_not_available" msgid="7955921658939936596">"El maquinari per a empremtes dactilars no està disponible."</string>
- <string name="fingerprint_error_no_space" msgid="1055819001126053318">"L\'empremta dactilar no es pot desar. Suprimeix-ne una."</string>
- <string name="fingerprint_error_timeout" msgid="3927186043737732875">"S\'ha esgotat el temps d\'espera per a l\'empremta dactilar. Torna-ho a provar."</string>
- <string name="fingerprint_error_canceled" msgid="4402024612660774395">"S\'ha cancel·lat l\'operació d\'empremta dactilar."</string>
- <string name="fingerprint_error_user_canceled" msgid="7999639584615291494">"L\'usuari ha cancel·lat l\'operació d\'empremta dactilar."</string>
+ <string name="fingerprint_error_no_space" msgid="1055819001126053318">"L\'empremta digital no es pot desar. Suprimeix-ne una."</string>
+ <string name="fingerprint_error_timeout" msgid="3927186043737732875">"S\'ha esgotat el temps d\'espera per a l\'empremta digital. Torna-ho a provar."</string>
+ <string name="fingerprint_error_canceled" msgid="4402024612660774395">"S\'ha cancel·lat l\'operació d\'empremta digital."</string>
+ <string name="fingerprint_error_user_canceled" msgid="7999639584615291494">"L\'usuari ha cancel·lat l\'operació d\'empremta digital."</string>
<string name="fingerprint_error_lockout" msgid="5536934748136933450">"S\'han produït massa intents. Torna-ho a provar més tard."</string>
<string name="fingerprint_error_lockout_permanent" msgid="5033251797919508137">"S\'han fet massa intents. S\'ha desactivat el sensor d\'empremtes dactilars."</string>
<string name="fingerprint_error_unable_to_process" msgid="6107816084103552441">"Torna-ho a provar."</string>
@@ -555,7 +555,7 @@
<string name="fingerprint_name_template" msgid="5870957565512716938">"Dit <xliff:g id="FINGERID">%d</xliff:g>"</string>
<string-array name="fingerprint_error_vendor">
</string-array>
- <string name="fingerprint_icon_content_description" msgid="2340202869968465936">"Icona d\'empremta dactilar"</string>
+ <string name="fingerprint_icon_content_description" msgid="2340202869968465936">"Icona d\'empremta digital"</string>
<string name="permlab_manageFace" msgid="7262837876352591553">"gestiona el maquinari de desbloqueig facial"</string>
<string name="permdesc_manageFace" msgid="8919637120670185330">"Permet que l\'aplicació afegeixi i suprimeixi plantilles de cares que es puguin fer servir."</string>
<string name="permlab_useFaceAuthentication" msgid="2565716575739037572">"utilitza el maquinari de desbloqueig facial"</string>
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> no té accés a Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Toca per veure les opcions"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"La xarxa mòbil no té accés a Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"La xarxa no té accés a Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"No es pot accedir al servidor DNS privat"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connectat"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> té una connectivitat limitada"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Toca per connectar igualment"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Desa"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, gràcies"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Actualitza"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continua"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"contrasenya"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adreça"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"targeta de crèdit"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"targeta de dèbit"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"targeta de pagament"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"targeta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nom d\'usuari"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adreça electrònica"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Mantén la calma i busca refugi a prop."</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 8ba6f34..b684193 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Síť <xliff:g id="NETWORK_SSID">%1$s</xliff:g> nemá přístup k internetu"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Klepnutím zobrazíte možnosti"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilní síť nemá přístup k internetu"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Síť nemá přístup k internetu"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Nelze získat přístup k soukromému serveru DNS"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Připojeno"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Síť <xliff:g id="NETWORK_SSID">%1$s</xliff:g> umožňuje jen omezené připojení"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Klepnutím se i přesto připojíte"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Uložit"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ne, děkuji"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Aktualizovat"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Pokračovat"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"heslo"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresa"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"platební karta"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debetní karta"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"platební karta"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"karta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"uživatelské jméno"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-mailová adresa"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Zachovejte klid a přesuňte se na bezpečné místo v okolí."</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 0d40688..22f1e5d 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> har ingen internetforbindelse"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tryk for at se valgmuligheder"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilnetværket har ingen internetadgang"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Netværket har ingen internetadgang"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Der er ikke adgang til den private DNS-server"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Der er oprettet forbindelse"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> har begrænset forbindelse"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tryk for at oprette forbindelse alligevel"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Gem"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nej tak"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Opdater"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Fortsæt"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"adgangskode"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresse"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditkort"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"betalingskort"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"betalingskort"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kort"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"brugernavn"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"mailadresse"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Bevar roen, og søg ly i nærheden."</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index f051345..b74cd7e 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> hat keinen Internetzugriff"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Für Optionen tippen"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobiles Netzwerk hat keinen Internetzugriff"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Netzwerk hat keinen Internetzugriff"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Auf den privaten DNS-Server kann nicht zugegriffen werden"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Verbunden"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Schlechte Verbindung mit <xliff:g id="NETWORK_SSID">%1$s</xliff:g>"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tippen, um die Verbindung trotzdem herzustellen"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Speichern"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nein danke"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Aktualisieren"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Fortsetzen"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"Passwort"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"Adresse"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"Kreditkarte"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"Debitkarte"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"Zahlungskarte"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"Karte"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"Nutzername"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"E-Mail-Adresse"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Bleibe ruhig und suche in der Nähe Schutz."</string>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index a360de0..4fb03d6 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Η εφαρμογή <xliff:g id="NETWORK_SSID">%1$s</xliff:g> δεν έχει πρόσβαση στο διαδίκτυο"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Πατήστε για να δείτε τις επιλογές"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Το δίκτυο κινητής τηλεφωνίας δεν έχει πρόσβαση στο διαδίκτυο."</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Το δίκτυο δεν έχει πρόσβαση στο διαδίκτυο."</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Δεν είναι δυνατή η πρόσβαση στον ιδιωτικό διακομιστή DNS."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Συνδέθηκε"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Το δίκτυο <xliff:g id="NETWORK_SSID">%1$s</xliff:g> έχει περιορισμένη συνδεσιμότητα"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Πατήστε για σύνδεση ούτως ή άλλως"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Αποθήκευση"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Όχι, ευχαριστώ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Ενημέρωση"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Συνέχεια"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"κωδικός πρόσβασης"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"διεύθυνση"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"πιστωτική κάρτα"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"χρεωστική κάρτα"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"κάρτα πληρωμής"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"κάρτα"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"όνομα χρήστη"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"διεύθυνση email"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Μείνετε ψύχραιμοι και αναζητήστε κάποιο κοντινό καταφύγιο."</string>
diff --git a/core/res/res/values-en-rAU/strings.xml b/core/res/res/values-en-rAU/strings.xml
index 1e0e93a..88fb0fd 100644
--- a/core/res/res/values-en-rAU/strings.xml
+++ b/core/res/res/values-en-rAU/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has no Internet access"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tap for options"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobile network has no Internet access"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Network has no Internet access"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Private DNS server cannot be accessed"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connected"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has limited connectivity"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tap to connect anyway"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Save"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, thanks"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continue"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"address"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"credit card"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit card"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"payment card"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"username"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email address"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Stay calm and seek shelter nearby."</string>
diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml
index 4deaf2e..8a1c2c4 100644
--- a/core/res/res/values-en-rCA/strings.xml
+++ b/core/res/res/values-en-rCA/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has no Internet access"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tap for options"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobile network has no Internet access"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Network has no Internet access"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Private DNS server cannot be accessed"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connected"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has limited connectivity"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tap to connect anyway"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Save"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, thanks"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continue"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"address"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"credit card"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit card"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"payment card"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"username"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email address"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Stay calm and seek shelter nearby."</string>
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index 1e0e93a..88fb0fd 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has no Internet access"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tap for options"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobile network has no Internet access"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Network has no Internet access"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Private DNS server cannot be accessed"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connected"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has limited connectivity"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tap to connect anyway"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Save"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, thanks"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continue"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"address"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"credit card"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit card"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"payment card"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"username"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email address"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Stay calm and seek shelter nearby."</string>
diff --git a/core/res/res/values-en-rIN/strings.xml b/core/res/res/values-en-rIN/strings.xml
index 1e0e93a..88fb0fd 100644
--- a/core/res/res/values-en-rIN/strings.xml
+++ b/core/res/res/values-en-rIN/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has no Internet access"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tap for options"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobile network has no Internet access"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Network has no Internet access"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Private DNS server cannot be accessed"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connected"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has limited connectivity"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tap to connect anyway"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Save"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, thanks"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continue"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"address"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"credit card"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit card"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"payment card"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"username"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email address"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Stay calm and seek shelter nearby."</string>
diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml
index 5fe1bb1..fbb1cc7 100644
--- a/core/res/res/values-en-rXC/strings.xml
+++ b/core/res/res/values-en-rXC/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has no internet access"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tap for options"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobile network has no internet access"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Network has no internet access"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Private DNS server cannot be accessed"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connected"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> has limited connectivity"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tap to connect anyway"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Save"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No thanks"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continue"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"address"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"credit card"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit card"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"payment card"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"username"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email address"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Stay calm and seek shelter nearby."</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index feb4aee..7fe219e 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>no tiene acceso a Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Presiona para ver opciones"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"La red móvil no tiene acceso a Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"La red no tiene acceso a Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"No se puede acceder al servidor DNS privado"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Se estableció conexión"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tiene conectividad limitada"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Presiona para conectarte de todas formas"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Guardar"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, gracias"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Actualizar"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuar"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"contraseña"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"dirección"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"tarjeta de crédito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"tarjeta de débito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"tarjeta de pago"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"tarjeta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nombre de usuario"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"dirección de correo electrónico"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Mantén la calma y busca un refugio cercano."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index 75510b3..35e2c38 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> no tiene acceso a Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Toca para ver opciones"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"La red móvil no tiene acceso a Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"La red no tiene acceso a Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"No se ha podido acceder al servidor DNS privado"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Conectado"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tiene una conectividad limitada"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Toca para conectarte de todas formas"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Guardar"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, gracias"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Actualizar"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuar"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"contraseña"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"dirección"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"tarjeta de crédito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"tarjeta de débito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"tarjeta de pago"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"tarjeta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nombre de usuario"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"dirección de correo electrónico"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Mantén la calma y busca refugio en algún lugar cercano."</string>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index 0e7befd..a8f546d 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Võrgul <xliff:g id="NETWORK_SSID">%1$s</xliff:g> puudub Interneti-ühendus"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Puudutage valikute nägemiseks"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobiilsidevõrgul puudub Interneti-ühendus"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Võrgul puudub Interneti-ühendus"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Privaatsele DNS-serverile ei pääse juurde"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Ühendatud"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Võrgu <xliff:g id="NETWORK_SSID">%1$s</xliff:g> ühendus on piiratud"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Puudutage, kui soovite siiski ühenduse luua"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Salvesta"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Tänan, ei"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Värskenda"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Jätka"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"parool"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"aadress"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"krediitkaart"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"deebetkaart"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"maksekaart"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kaart"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"kasutajanimi"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-posti aadress"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Jääge rahulikuks ja otsige lähedusest peavarju."</string>
diff --git a/core/res/res/values-eu/strings.xml b/core/res/res/values-eu/strings.xml
index 22391dc..d87bdfb 100644
--- a/core/res/res/values-eu/strings.xml
+++ b/core/res/res/values-eu/strings.xml
@@ -861,7 +861,7 @@
<string name="lockscreen_forgot_pattern_button_text" msgid="2626999449610695930">"Eredua ahaztu zaizu?"</string>
<string name="lockscreen_glogin_forgot_pattern" msgid="2588521501166032747">"Kontua desblokeatzea"</string>
<string name="lockscreen_glogin_too_many_attempts" msgid="2751368605287288808">"Eredua marrazteko saiakera gehiegi egin dira"</string>
- <string name="lockscreen_glogin_instructions" msgid="3931816256100707784">"Desblokeatzeko, hasi saioa Google kontuarekin."</string>
+ <string name="lockscreen_glogin_instructions" msgid="3931816256100707784">"Desblokeatzeko, hasi saioa Google-ko kontuarekin."</string>
<string name="lockscreen_glogin_username_hint" msgid="8846881424106484447">"Erabiltzaile-izena (helbide elektronikoa)"</string>
<string name="lockscreen_glogin_password_hint" msgid="5958028383954738528">"Pasahitza"</string>
<string name="lockscreen_glogin_submit_button" msgid="7130893694795786300">"Hasi saioa"</string>
@@ -1133,7 +1133,7 @@
<string name="whichApplication" msgid="4533185947064773386">"Gauzatu ekintza hau erabilita:"</string>
<string name="whichApplicationNamed" msgid="8260158865936942783">"Osatu ekintza %1$s erabiliz"</string>
<string name="whichApplicationLabel" msgid="7425855495383818784">"Osatu ekintza"</string>
- <string name="whichViewApplication" msgid="3272778576700572102">"Ireki honekin:"</string>
+ <string name="whichViewApplication" msgid="3272778576700572102">"Ireki honekin"</string>
<string name="whichViewApplicationNamed" msgid="2286418824011249620">"Irekin %1$s aplikazioarekin"</string>
<string name="whichViewApplicationLabel" msgid="2666774233008808473">"Ireki"</string>
<string name="whichOpenHostLinksWith" msgid="3788174881117226583">"Ireki <xliff:g id="HOST">%1$s</xliff:g> ostalariko estekak honekin:"</string>
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Ezin da konektatu Internetera <xliff:g id="NETWORK_SSID">%1$s</xliff:g> sarearen bidez"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Sakatu aukerak ikusteko"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Sare mugikorra ezin da konektatu Internetera"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Sarea ezin da konektatu Internetera"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Ezin da atzitu DNS zerbitzari pribatua"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Konektatuta"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> sareak konektagarritasun murriztua du"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Sakatu hala ere konektatzeko"</string>
@@ -1645,7 +1648,7 @@
<string name="kg_invalid_puk" msgid="3638289409676051243">"Idatzi berriro PUK kode zuzena. Hainbat saiakera oker eginez gero, betiko desgaituko da SIMa."</string>
<string name="kg_invalid_confirm_pin_hint" product="default" msgid="7003469261464593516">"PIN kodeak ez datoz bat"</string>
<string name="kg_login_too_many_attempts" msgid="6486842094005698475">"Eredua marrazteko saiakera gehiegi egin dira"</string>
- <string name="kg_login_instructions" msgid="1100551261265506448">"Desblokeatzeko, hasi saioa Google kontuarekin."</string>
+ <string name="kg_login_instructions" msgid="1100551261265506448">"Desblokeatzeko, hasi saioa Google-ko kontuarekin."</string>
<string name="kg_login_username_hint" msgid="5718534272070920364">"Erabiltzaile-izena (helbide elektronikoa)"</string>
<string name="kg_login_password_hint" msgid="9057289103827298549">"Pasahitza"</string>
<string name="kg_login_submit_button" msgid="5355904582674054702">"Hasi saioa"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Gorde"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ez, eskerrik asko"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Eguneratu"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Egin aurrera"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"pasahitza"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"helbidea"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditu-txartela"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"zordunketa-txartela"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ordainketa-txartela"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"txartela"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"erabiltzaile-izena"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"helbide elektronikoa"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Ez larritu eta bilatu babesleku bat inguruan."</string>
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 33421c0..16382638 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> به اینترنت دسترسی ندارد"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"برای گزینهها ضربه بزنید"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"شبکه تلفن همراه به اینترنت دسترسی ندارد"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"شبکه به اینترنت دسترسی ندارد"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"سرور DNS خصوصی قابل دسترسی نیست"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"متصل"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> اتصال محدودی دارد"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"بههرصورت، برای اتصال ضربه بزنید"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"ذخیره"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"نه سپاسگزارم"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"بهروزرسانی"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ادامه"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"گذرواژه"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"نشانی"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"کارت اعتباری"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"کارت نقدی"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"کارت پرداخت"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"کارت"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"نام کاربری"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"نشانی ایمیل"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"آرام باشید و پناهگاهی در این اطراف پیدا کنید."</string>
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index 124a160..5b050c3 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ei ole yhteydessä internetiin"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Näytä vaihtoehdot napauttamalla."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobiiliverkko ei ole yhteydessä internetiin"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Verkko ei ole yhteydessä internetiin"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Ei pääsyä yksityiselle DNS-palvelimelle"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Yhdistetty"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> toimii rajoitetulla yhteydellä"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Yhdistä napauttamalla"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Tallenna"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ei kiitos"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Muuta"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Jatka"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"salasana"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"osoite"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"luottokortti"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit-kortti"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"maksukortti"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kortti"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"käyttäjänimi"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"sähköpostiosoite"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Pysy rauhallisena ja hakeudu lähimpään suojapaikkaan."</string>
diff --git a/core/res/res/values-fr-rCA/strings.xml b/core/res/res/values-fr-rCA/strings.xml
index ecfdcd2..32530d3 100644
--- a/core/res/res/values-fr-rCA/strings.xml
+++ b/core/res/res/values-fr-rCA/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Le réseau <xliff:g id="NETWORK_SSID">%1$s</xliff:g> n\'offre aucun accès à Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Touchez pour afficher les options"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Le réseau cellulaire n\'offre aucun accès à Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Le réseau n\'offre aucun accès à Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Impossible d\'accéder au serveur DNS privé"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connecté"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Le réseau <xliff:g id="NETWORK_SSID">%1$s</xliff:g> offre une connectivité limitée"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Touchez pour vous connecter quand même"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Enregistrer"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Non, merci"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Mettre à jour"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuer"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"mot de passe"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresse"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"carte de crédit"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"carte de débit"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"carte de paiement"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"carte"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nom d\'utilisateur"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adresse de courriel"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Restez calme et cherchez un abri à proximité."</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 1a44b79..b5b0a56 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Aucune connexion à Internet pour <xliff:g id="NETWORK_SSID">%1$s</xliff:g>"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Appuyez ici pour afficher des options."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Le réseau mobile ne dispose d\'aucun accès à Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Le réseau ne dispose d\'aucun accès à Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Impossible d\'accéder au serveur DNS privé"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connecté"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"La connectivité de <xliff:g id="NETWORK_SSID">%1$s</xliff:g> est limitée"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Appuyer pour se connecter quand même"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Enregistrer"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Non, merci"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Mettre à jour"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuer"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"mot de passe"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresse"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"carte de paiement"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"carte de débit"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"carte de paiement"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"carte"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nom d\'utilisateur"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adresse e-mail"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Restez calme et cherchez un abri à proximité."</string>
diff --git a/core/res/res/values-gl/strings.xml b/core/res/res/values-gl/strings.xml
index 933fbab..bf3b3bd 100644
--- a/core/res/res/values-gl/strings.xml
+++ b/core/res/res/values-gl/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> non ten acceso a Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Toca para ver opcións."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"A rede de telefonía móbil non ten acceso a Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"A rede non ten acceso a Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Non se puido acceder ao servidor DNS privado"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Estableceuse conexión"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"A conectividade de <xliff:g id="NETWORK_SSID">%1$s</xliff:g> é limitada"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Toca para conectarte de todas formas"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Gardar"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Non, grazas"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Actualizar"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuar"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"contrasinal"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"enderezo"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"tarxeta de crédito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"tarxeta de débito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"tarxeta de pago"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"tarxeta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nome de usuario"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"enderezo de correo electrónico"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Mantén a calma e busca refuxio cerca."</string>
diff --git a/core/res/res/values-gu/strings.xml b/core/res/res/values-gu/strings.xml
index 05e5a4e..66bba23 100644
--- a/core/res/res/values-gu/strings.xml
+++ b/core/res/res/values-gu/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ઇન્ટરનેટ ઍક્સેસ ધરાવતું નથી"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"વિકલ્પો માટે ટૅપ કરો"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"મોબાઇલ નેટવર્ક કોઈ ઇન્ટરનેટ ઍક્સેસ ધરાવતું નથી"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"નેટવર્ક કોઈ ઇન્ટરનેટ ઍક્સેસ ધરાવતું નથી"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"ખાનગી DNS સર્વર ઍક્સેસ કરી શકાતા નથી"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"કનેક્ટેડ"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> મર્યાદિત કનેક્ટિવિટી ધરાવે છે"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"છતાં કનેક્ટ કરવા માટે ટૅપ કરો"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"સાચવો"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ના, આભાર"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"અપડેટ કરો"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ચાલુ રાખો"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"પાસવર્ડ"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"સરનામું"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ક્રેડિટ કાર્ડ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ડેબિટ કાર્ડ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ચુકવણી કાર્ડ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"કાર્ડ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"વપરાશકર્તાનામ"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ઇમેઇલ સરનામું"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"શાંત રહો અને નજીકમાં આશ્રય લો."</string>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index f16ad65..717c7ae 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> का इंटरनेट नहीं चल रहा है"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"विकल्पों के लिए टैप करें"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"मोबाइल नेटवर्क पर इंटरनेट ऐक्सेस नहीं है"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"इस नेटवर्क पर इंटरनेट ऐक्सेस नहीं है"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"निजी डीएनएस सर्वर को ऐक्सेस नहीं किया जा सकता"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"जुड़ गया है"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> की कनेक्टिविटी सीमित है"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"फिर भी कनेक्ट करने के लिए टैप करें"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"सेव करें"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"नहीं, धन्यवाद"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"अपडेट करें"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"जारी रखें"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"पासवर्ड"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"पता"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"क्रेडिट कार्ड"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"डेबिट कार्ड"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"भुगतान कार्ड"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"कार्ड"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"उपयोगकर्ता का नाम"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ईमेल पता"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"शांत रहें और आस-पास शरण लेने की जगह तलाशें."</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index 45c39f2..00da024 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -1296,6 +1296,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nema pristup internetu"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Dodirnite za opcije"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilna mreža nema pristup internetu"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Mreža nema pristup internetu"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Nije moguće pristupiti privatnom DNS poslužitelju"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Povezano"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ima ograničenu povezivost"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Dodirnite da biste se ipak povezali"</string>
@@ -1996,9 +1999,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Spremi"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ne, hvala"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Ažuriraj"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Nastavi"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"zaporku"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresu"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditnu karticu"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debitna kartica"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kartica za plaćanje"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kartica"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"korisničko ime"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-adresa"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Ostanite mirni i potražite sklonište u blizini."</string>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index aac2d76..2958ca6 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"A(z) <xliff:g id="NETWORK_SSID">%1$s</xliff:g> hálózaton nincs internet-hozzáférés"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Koppintson a beállítások megjelenítéséhez"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"A mobilhálózaton nincs internet-hozzáférés"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"A hálózaton nincs internet-hozzáférés"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"A privát DNS-kiszolgálóhoz nem lehet hozzáférni"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Csatlakozva"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"A(z) <xliff:g id="NETWORK_SSID">%1$s</xliff:g> hálózat korlátozott kapcsolatot biztosít"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Koppintson, ha mindenképpen csatlakozni szeretne"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Mentés"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nem, köszönöm"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Frissítés"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Tovább"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"jelszó"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"cím"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"hitelkártya"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"bankkártya"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"fizetőkártya"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kártya"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"felhasználónév"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-mail-cím"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Őrizze meg nyugalmát, és keressen menedéket a közelben."</string>
diff --git a/core/res/res/values-hy/strings.xml b/core/res/res/values-hy/strings.xml
index a5b4e30..73db059 100644
--- a/core/res/res/values-hy/strings.xml
+++ b/core/res/res/values-hy/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ցանցը չունի մուտք ինտերնետին"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Հպեք՝ ընտրանքները տեսնելու համար"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Բջջային ցանցում ինտերնետ կապ չկա"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Ցանցում ինտերնետ կապ չկա"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Մասնավոր DNS սերվերն անհասանելի է"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Միացված է"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ցանցի կապը սահմանափակ է"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Հպեք՝ միանալու համար"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Պահել"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ոչ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Թարմացնել"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Շարունակել"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"գաղտնաբառ"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"հասցե"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"վարկային քարտ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"դեբետային քարտ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"վճարային քարտ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"քարտ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"օգտանուն"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"էլ․ հասցե"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Պահպանեք հանգստությունը և մոտակայքում ապաստարան փնտրեք:"</string>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 228da88..662a654 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tidak memiliki akses internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Ketuk untuk melihat opsi"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Jaringan seluler tidak memiliki akses internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Jaringan tidak memiliki akses internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Server DNS pribadi tidak dapat diakses"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Tersambung"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> memiliki konektivitas terbatas"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Ketuk untuk tetap menyambungkan"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Simpan"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Lain kali"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Lanjutkan"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"sandi"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"alamat"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kartu kredit"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"kartu debit"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kartu pembayaran"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kartu"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nama pengguna"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"alamat email"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Tetap tenang dan cari tempat berlindung terdekat."</string>
diff --git a/core/res/res/values-is/strings.xml b/core/res/res/values-is/strings.xml
index d0f8028..9ae165d 100644
--- a/core/res/res/values-is/strings.xml
+++ b/core/res/res/values-is/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> er ekki með internetaðgang"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Ýttu til að sjá valkosti"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Farsímakerfið er ekki tengt við internetið"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Netkerfið er ekki tengt við internetið"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Ekki næst í DNS-einkaþjón"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Tengt"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Tengigeta <xliff:g id="NETWORK_SSID">%1$s</xliff:g> er takmörkuð"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Ýttu til að tengjast samt"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Vista"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nei, takk"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Uppfæra"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Áfram"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"aðgangsorð"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"heimilisfang"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditkort"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debetkort"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"greiðslukort"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kort"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"notandanafn"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"netfang"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Sýndu stillingu og leitaðu skjóls."</string>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 747d918..77eafcc 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -283,7 +283,7 @@
<string name="permgrouprequest_contacts" msgid="6032805601881764300">"Consentire all\'app <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di accedere ai tuoi contatti?"</string>
<string name="permgrouplab_location" msgid="7275582855722310164">"Geolocalizz."</string>
<string name="permgroupdesc_location" msgid="1346617465127855033">"accedere alla posizione di questo dispositivo"</string>
- <string name="permgrouprequest_location" msgid="3788275734953323491">"Consentire all\'app <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di accedere alla posizione del dispositivo?"</string>
+ <string name="permgrouprequest_location" msgid="3788275734953323491">"Consentire a <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di accedere alla posizione del dispositivo?"</string>
<string name="permgrouprequestdetail_location" msgid="1347189607421252902">"L\'app avrà accesso alla posizione soltanto quando la usi"</string>
<string name="permgroupbackgroundrequest_location" msgid="5039063878675613235">"Consentire a <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di accedere <b>sempre</b> alla posizione di questo dispositivo?"</string>
<string name="permgroupbackgroundrequestdetail_location" msgid="4597006851453417387">"L\'app al momento può accedere alla posizione soltanto mentre la usi"</string>
@@ -301,7 +301,7 @@
<string name="permgrouprequest_microphone" msgid="9167492350681916038">"Consentire all\'app <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di registrare audio?"</string>
<string name="permgrouplab_activityRecognition" msgid="1565108047054378642">"Attività fisica"</string>
<string name="permgroupdesc_activityRecognition" msgid="6949472038320473478">"Consente di accedere all\'attività fisica"</string>
- <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"Vuoi consentire a <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di accedere alla tua attività fisica?"</string>
+ <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"Consentire a <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di accedere alla tua attività fisica?"</string>
<string name="permgrouplab_camera" msgid="4820372495894586615">"Fotocamera"</string>
<string name="permgroupdesc_camera" msgid="3250611594678347720">"scattare foto e registrare video"</string>
<string name="permgrouprequest_camera" msgid="1299833592069671756">"Consentire all\'app <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> di scattare foto e registrare video?"</string>
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> non ha accesso a Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tocca per le opzioni"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"La rete mobile non ha accesso a Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"La rete non ha accesso a Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Non è possibile accedere al server DNS privato"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Connesso"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ha una connettività limitata"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tocca per connettere comunque"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Salva"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"No, grazie"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Aggiorna"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continua"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"indirizzo"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"carta di credito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"carta di debito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"carta di pagamento"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"carta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nome utente"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"indirizzo email"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Mantieni la calma e cerca riparo nelle vicinanze."</string>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 4c12e432..462ee36 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -1318,6 +1318,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"ל-<xliff:g id="NETWORK_SSID">%1$s</xliff:g> אין גישה לאינטרנט"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"הקש לקבלת אפשרויות"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"הרשת מחוברת"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"הקישוריות של <xliff:g id="NETWORK_SSID">%1$s</xliff:g> מוגבלת"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"כדי להתחבר למרות זאת יש להקיש"</string>
@@ -2031,9 +2037,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"שמירה"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"לא, תודה"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"עדכון"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"המשך"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"סיסמה"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"כתובת"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"כרטיס אשראי"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"כרטיס חיוב"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"כרטיס תשלום"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"כרטיס"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"שם משתמש"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"כתובת אימייל"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"הישאר רגוע וחפש מחסה בקרבת מקום."</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 98600b8..2a2b71b 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -301,7 +301,7 @@
<string name="permgrouprequest_microphone" msgid="9167492350681916038">"音声の録音を「<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>」に許可しますか?"</string>
<string name="permgrouplab_activityRecognition" msgid="1565108047054378642">"身体活動"</string>
<string name="permgroupdesc_activityRecognition" msgid="6949472038320473478">"身体活動にアクセス"</string>
- <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"身体活動へのアクセスを「<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>」に許可しますか?"</string>
+ <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"身体活動データへのアクセスを「<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>」に許可しますか?"</string>
<string name="permgrouplab_camera" msgid="4820372495894586615">"カメラ"</string>
<string name="permgroupdesc_camera" msgid="3250611594678347720">"写真と動画の撮影"</string>
<string name="permgrouprequest_camera" msgid="1299833592069671756">"写真と動画の撮影を「<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>」に許可しますか?"</string>
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> はインターネットにアクセスできません"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"タップしてその他のオプションを表示"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"モバイル ネットワークがインターネットに接続されていません"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"ネットワークがインターネットに接続されていません"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"プライベート DNS サーバーにアクセスできません"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"接続しました"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> の接続が制限されています"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"接続するにはタップしてください"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"はい"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"いいえ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"更新"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"続行"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"パスワード"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"住所"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"クレジット カード"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"デビットカード"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"支払いカード"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"カード"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ユーザー名"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"メールアドレス"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"強い揺れに備えてください"</string>
diff --git a/core/res/res/values-ka/strings.xml b/core/res/res/values-ka/strings.xml
index cc8ecc2..ebc7f2a 100644
--- a/core/res/res/values-ka/strings.xml
+++ b/core/res/res/values-ka/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>-ს არ აქვს ინტერნეტზე წვდომა"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"შეეხეთ ვარიანტების სანახავად"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"მობილურ ქსელს არ აქვს ინტერნეტზე წვდომა"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"ქსელს არ აქვს ინტერნეტზე წვდომა"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"პირად DNS სერვერზე წვდომა შეუძლებელია"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"დაკავშირებულია"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>-ის კავშირები შეზღუდულია"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"შეეხეთ, თუ მაინც გსურთ დაკავშირება"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"შენახვა"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"არა, გმადლობთ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"განახლება"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"გაგრძელება"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"პაროლი"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"მისამართი"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"საკრედიტო ბარათი"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"სადებეტო ბარათი"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"გადახდის ბარათი"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ბარათი"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"მომხმარებლის სახელი"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ელფოსტის მისამართი"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"შეინარჩუნეთ სიმშვიდე და იპოვეთ ახლომდებარე თავშესაფარი."</string>
diff --git a/core/res/res/values-kk/strings.xml b/core/res/res/values-kk/strings.xml
index db9fad2..281db7a 100644
--- a/core/res/res/values-kk/strings.xml
+++ b/core/res/res/values-kk/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> желісінің интернетті пайдалану мүмкіндігі шектеулі."</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Опциялар үшін түртіңіз"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобильдік желі интернетке қосылмаған."</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Желі интернетке қосылмаған."</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Жеке DNS серверіне кіру мүмкін емес."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Жалғанды"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> желісінің қосылу мүмкіндігі шектеулі."</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Бәрібір жалғау үшін түртіңіз."</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Сақтау"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Жоқ, рақмет"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Жаңарту"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Жалғастыру"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"құпия сөз"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"мекенжай"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"несие картасы"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебеттік карта"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"төлем картасы"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"карта"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"пайдаланушы аты"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"электрондық пошта мекенжайы"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Сабыр сақтап, жақын жерден баспана іздеңіз."</string>
diff --git a/core/res/res/values-km/strings.xml b/core/res/res/values-km/strings.xml
index 021da3e..532e3c7 100644
--- a/core/res/res/values-km/strings.xml
+++ b/core/res/res/values-km/strings.xml
@@ -1276,6 +1276,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> មិនមានការតភ្ជាប់អ៊ីនធឺណិតទេ"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ប៉ះសម្រាប់ជម្រើស"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"បណ្ដាញទូរសព្ទចល័តមិនមានការតភ្ជាប់អ៊ីនធឺណិតទេ"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"បណ្ដាញមិនមានការតភ្ជាប់អ៊ីនធឺណិតទេ"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"មិនអាចចូលប្រើម៉ាស៊ីនមេ DNS ឯកជនបានទេ"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"បានភ្ជាប់"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> មានការតភ្ជាប់មានកម្រិត"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"មិនអីទេ ចុចភ្ជាប់ចុះ"</string>
@@ -1963,9 +1966,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"រក្សាទុក"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ទេ អរគុណ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"ធ្វើបច្ចុប្បន្នភាព"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"បន្ត"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"ពាក្យសម្ងាត់"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"អាសយដ្ឋាន"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"បណ្ណឥណទាន"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"បណ្ណឥណពន្ធ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"កាតទូទាត់ប្រាក់"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"កាត"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ឈ្មោះអ្នកប្រើប្រាស់"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"អាសយដ្ឋានអ៊ីមែល"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"សូមរក្សាភាពស្ងប់ស្ងាត់ ហើយស្វែងរកជម្រកសុវត្ថិភាពដែលនៅជិត។"</string>
diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml
index edcb6d1..d1317e9 100644
--- a/core/res/res/values-kn/strings.xml
+++ b/core/res/res/values-kn/strings.xml
@@ -1274,6 +1274,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ಯಾವುದೇ ಇಂಟರ್ನೆಟ್ ಸಂಪರ್ಕವನ್ನು ಹೊಂದಿಲ್ಲ"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ಆಯ್ಕೆಗಳಿಗೆ ಟ್ಯಾಪ್ ಮಾಡಿ"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"ಸಂಪರ್ಕಿಸಲಾಗಿದೆ"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ಸೀಮಿತ ಸಂಪರ್ಕ ಕಲ್ಪಿಸುವಿಕೆಯನ್ನು ಹೊಂದಿದೆ"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ಹೇಗಾದರೂ ಸಂಪರ್ಕಿಸಲು ಟ್ಯಾಪ್ ಮಾಡಿ"</string>
@@ -1962,9 +1968,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"ಉಳಿಸಿ"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ಬೇಡ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"ಅಪ್ಡೇಟ್"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ಮುಂದುವರಿಯಿರಿ"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"ಪಾಸ್ವರ್ಡ್"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ವಿಳಾಸ"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ಡೆಬಿಟ್ ಕಾರ್ಡ್"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ಪಾವತಿ ಕಾರ್ಡ್"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ಕಾರ್ಡ್"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ಬಳಕೆದಾರರ ಹೆಸರು"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ಇಮೇಲ್ ವಿಳಾಸ"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ಶಾಂತರಾಗಿರಿ ಮತ್ತು ಸಮೀಪದಲ್ಲೆಲ್ಲಾದರೂ ಆಶ್ರಯ ಪಡೆದುಕೊಳ್ಳಿ."</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 2f06bee..acc6e95 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>이(가) 인터넷에 액세스할 수 없습니다."</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"탭하여 옵션 보기"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"모바일 네트워크에 인터넷이 연결되어 있지 않습니다."</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"네트워크에 인터넷이 연결되어 있지 않습니다."</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"비공개 DNS 서버에 액세스할 수 없습니다."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"연결되었습니다."</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>에서 연결을 제한했습니다."</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"계속 연결하려면 탭하세요."</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"저장"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"사용 안함"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"업데이트"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"계속"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"비밀번호"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"주소"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"신용카드"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"체크카드"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"결제 카드"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"카드"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"사용자 이름"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"이메일 주소"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"침착하게 가까운 대피소를 찾으세요."</string>
diff --git a/core/res/res/values-ky/strings.xml b/core/res/res/values-ky/strings.xml
index 2353ed0..dcb766d 100644
--- a/core/res/res/values-ky/strings.xml
+++ b/core/res/res/values-ky/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> Интернетке туташуусу жок"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Параметрлерди ачуу үчүн таптап коюңуз"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобилдик Интернет жок"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Тармактын Интернет байланышы жок"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Жеке DNS сервери жеткиликсиз"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Туташты"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> байланышы чектелген"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Баары бир туташуу үчүн таптаңыз"</string>
@@ -1668,7 +1671,7 @@
<string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
<string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Алып салуу"</string>
<string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"Сунушталган деңгээлден да катуулатып уккуңуз келеби?\n\nМузыканы узакка чейин катуу уксаңыз, угууңуз начарлап кетиши мүмкүн."</string>
- <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Атайын мүмкүнчүлүктөр функциясынын кыска жолу колдонулсунбу?"</string>
+ <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Ыкчам иштетесизби?"</string>
<string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Атайын мүмкүнчүлүктөр функциясын пайдалануу үчүн, ал күйгүзүлгөндө, үндү катуулатып/акырындаткан эки баскычты тең үч секунддай кое бербей басып туруңуз.\n\n Учурдагы атайын мүмкүнчүлүктөрдүн жөндөөлөрү:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\nЖөндөөлөр > Атайын мүмкүнчүлүктөр бөлүмүнөн өзгөртө аласыз."</string>
<string name="disable_accessibility_shortcut" msgid="627625354248453445">"Кыска жолду өчүрүү"</string>
<string name="leave_accessibility_shortcut_on" msgid="7653111894438512680">"Кыска жолду колдонуу"</string>
@@ -1963,9 +1966,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Сактоо"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Жок, рахмат"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Жаңыртуу"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Улантуу"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"сырсөз"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"дарек"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"насыя картасы"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебет картасы"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"төлөм картасы"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"карта"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"колдонуучунун аты"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"электрондук почта дареги"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Эс алып, жакын жерден калканч издеңиз."</string>
diff --git a/core/res/res/values-lo/strings.xml b/core/res/res/values-lo/strings.xml
index a83fae1..6ef4cca 100644
--- a/core/res/res/values-lo/strings.xml
+++ b/core/res/res/values-lo/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ບໍ່ມີການເຊື່ອມຕໍ່ອິນເຕີເນັດ"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ແຕະເພື່ອເບິ່ງຕົວເລືອກ"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"ເຄືອຂ່າຍມືຖືບໍ່ສາມາດເຂົ້າເຖິງອິນເຕີເນັດໄດ້"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"ເຄືອຂ່າຍບໍ່ສາມາດເຂົ້າເຖິງອິນເຕີເນັດໄດ້"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"ບໍ່ສາມາດເຂົ້າເຖິງເຊີບເວີ DNS ສ່ວນຕົວໄດ້"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"ເຊື່ອມຕໍ່ແລ້ວ"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ມີການເຊື່ອມຕໍ່ທີ່ຈຳກັດ"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ແຕະເພື່ອຢືນຢັນການເຊື່ອມຕໍ່"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"ບັນທຶກ"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ບໍ່, ຂອບໃຈ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"ອັບເດດ"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ສືບຕໍ່"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"ລະຫັດຜ່ານ"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ທີ່ຢູ່"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ບັດເຄຣດິດ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ບັດເດບິດ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ບັດຈ່າຍເງິນ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ບັດ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ຊື່ຜູ້ໃຊ້"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ທີ່ຢູ່ອີເມລ"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ໃຈເຢັນໆ ແລະ ຊອກຫາບ່ອນພັກຢູ່ໃກ້ໆ."</string>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index fdd5d2a..f2c17c3 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"„<xliff:g id="NETWORK_SSID">%1$s</xliff:g>“ negali pasiekti interneto"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Palieskite, kad būtų rodomos parinktys."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobiliojo ryšio tinkle nėra prieigos prie interneto"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Tinkle nėra prieigos prie interneto"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Privataus DNS serverio negalima pasiekti"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Prisijungta"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"„<xliff:g id="NETWORK_SSID">%1$s</xliff:g>“ ryšys apribotas"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Palieskite, jei vis tiek norite prisijungti"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Išsaugoti"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ne, ačiū"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Atnaujinti"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Tęsti"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"slaptažodį"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresą"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredito kortelę"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debeto kortelė"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"mokėjimo kortelė"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kortelė"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"naudotojo vardas"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"el. pašto adresas"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Nesijaudinkite ir ieškokite prieglobsčio netoliese."</string>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index d1b7764..be8d5d1 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -1296,6 +1296,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Tīklā <xliff:g id="NETWORK_SSID">%1$s</xliff:g> nav piekļuves internetam"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Pieskarieties, lai skatītu iespējas."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilajā tīklā nav piekļuves internetam."</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Tīklā nav piekļuves internetam."</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Nevar piekļūt privātam DNS serverim."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Izveidots savienojums"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Tīklā <xliff:g id="NETWORK_SSID">%1$s</xliff:g> ir ierobežota savienojamība"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Lai tik un tā izveidotu savienojumu, pieskarieties"</string>
@@ -1996,9 +1999,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Saglabāt"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nē, paldies"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Atjaunināt"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Turpināt"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"paroli"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresi"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredītkartes informāciju"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debetkarte"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"maksājumu karte"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"karte"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"lietotājvārds"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-pasta adrese"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Saglabājiet mieru un meklējiet tuvumā patvērumu."</string>
diff --git a/core/res/res/values-mcc208-mnc10-fr/strings.xml b/core/res/res/values-mcc208-mnc10-fr/strings.xml
new file mode 100644
index 0000000..a1a2c8f
--- /dev/null
+++ b/core/res/res/values-mcc208-mnc10-fr/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="wifi_calling_off_summary" msgid="8720659586041656098">Utiliser les appels Wi-Fi lorsque le service est disponible</string>
+</resources>
diff --git a/core/res/res/values-mk/strings.xml b/core/res/res/values-mk/strings.xml
index d30c8f2..ea9a6b4 100644
--- a/core/res/res/values-mk/strings.xml
+++ b/core/res/res/values-mk/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> нема интернет-пристап"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Допрете за опции"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобилната мрежа нема интернет-пристап"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Мрежата нема интернет-пристап"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Не може да се пристапи до приватниот DNS-сервер"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Поврзано"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> има ограничена поврзливост"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Допрете за да се поврзете и покрај тоа"</string>
@@ -1964,9 +1967,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Зачувај"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Не, фала"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Ажурирај"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Продолжи"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"лозинка"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"адреса"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"кредитна картичка"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебитна картичка"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"платежна картичка"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"картичка"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"корисничко име"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"адреса на е-пошта"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Бидете смирени и побарајте засолниште во близина."</string>
diff --git a/core/res/res/values-ml/strings.xml b/core/res/res/values-ml/strings.xml
index 5a604fb..9d87652 100644
--- a/core/res/res/values-ml/strings.xml
+++ b/core/res/res/values-ml/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> എന്നതിന് ഇന്റർനെറ്റ് ആക്സസ് ഇല്ല"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ഓപ്ഷനുകൾക്ക് ടാപ്പുചെയ്യുക"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"മൊബെെൽ നെറ്റ്വർക്കിന് ഇന്റർനെറ്റ് ആക്സസ് ഇല്ല"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"നെറ്റ്വർക്കിന് ഇന്റർനെറ്റ് ആക്സസ് ഇല്ല"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"സ്വകാര്യ DNS സെർവർ ആക്സസ് ചെയ്യാനാവില്ല"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"കണക്റ്റ് ചെയ്തു"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> എന്നതിന് പരിമിതമായ കണക്റ്റിവിറ്റി ഉണ്ട്"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ഏതുവിധേനയും കണക്റ്റ് ചെയ്യാൻ ടാപ്പ് ചെയ്യുക"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"സംരക്ഷിക്കുക"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"വേണ്ട, നന്ദി"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"അപ്ഡേറ്റ് ചെയ്യുക"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"തുടരുക"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"പാസ്വേഡ്"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"വിലാസം"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ക്രെഡിറ്റ് കാർഡ്"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ഡെബിറ്റ് കാർഡ്"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"പെയ്മെന്റ് കാർഡ്"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"കാർഡ്"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ഉപയോക്തൃനാമം"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"വിലാസം നൽകുക"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"പരിഭ്രമിക്കാതിരിക്കുക, അടുത്തുള്ള അഭയകേന്ദ്രം തേടുക."</string>
diff --git a/core/res/res/values-mn/strings.xml b/core/res/res/values-mn/strings.xml
index f4c6b60..9a4ffae 100644
--- a/core/res/res/values-mn/strings.xml
+++ b/core/res/res/values-mn/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>-д интернэтийн хандалт алга"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Сонголт хийхийн тулд товшино уу"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобайл сүлжээнд интернэт хандалт байхгүй байна"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Сүлжээнд интернэт хандалт байхгүй байна"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Хувийн DNS серверт хандах боломжгүй байна"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Холбогдсон"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> зарим үйлчилгээнд хандах боломжгүй байна"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Ямар ч тохиолдолд холбогдохын тулд товших"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Хадгалах"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Үгүй, баярлалаа"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Шинэчлэх"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Үргэлжлүүлэх"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"нууц үг"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"хаяг"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"кредит карт"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебит карт"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"төлбөрийн карт"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"карт"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"хэрэглэгчийн нэр"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"имэйл хаяг"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Тайван байж, ойролцоох нуугдах газар хайна уу."</string>
diff --git a/core/res/res/values-mr/strings.xml b/core/res/res/values-mr/strings.xml
index 4fb2347..03b973b 100644
--- a/core/res/res/values-mr/strings.xml
+++ b/core/res/res/values-mr/strings.xml
@@ -345,7 +345,7 @@
<string name="permlab_receiveMms" msgid="1821317344668257098">"मजकूर मेसेज मिळवा (MMS)"</string>
<string name="permdesc_receiveMms" msgid="533019437263212260">"MMS मेसेज प्राप्त करण्यास आणि त्यावर प्रक्रिया करण्यास अॅप ला अनुमती देते. म्हणजेच अॅप आपल्या डिव्हाइसवर पाठविलेले मेसेज तुम्हाला न दर्शवता त्यांचे परीक्षण करू किंवा ते हटवू शकतो."</string>
<string name="permlab_bindCellBroadcastService" msgid="4468585041824555604">"सेल प्रसारण मेसेज फॉरवर्ड करा"</string>
- <string name="permdesc_bindCellBroadcastService" msgid="9073440260695196089">"सेल प्रसारण मेसेज मिळाल्यानंतर ते फॉरवर्ड करण्यासाठी अॅपला सेल प्रसारण मॉड्यूलमध्ये प्रतिबद्ध करण्याची अनुमती देते. काही स्थानांमध्ये तुम्हाला आणीबाणीच्या परिस्थीतींची चेतावणी देण्यासाठी सेल प्रसारण सूचना वितरित केल्या जातात. दुर्भावनापूर्ण अॅप्स आणीबाणी सेल प्रसारण मिळवतात तेव्हा ती तुमच्या डिव्हाइसच्या परफॉर्मन्समध्ये किंवा कामामध्ये कदाचित व्यत्यय आणू शकतात."</string>
+ <string name="permdesc_bindCellBroadcastService" msgid="9073440260695196089">"सेल प्रसारण मेसेज मिळाल्यानंतर ते फॉरवर्ड करण्यासाठी अॅपला सेल प्रसारण मॉड्यूलमध्ये प्रतिबद्ध करण्याची अनुमती देते. काही स्थानांमध्ये तुम्हाला आणीबाणीच्या परिस्थीतींची चेतावणी देण्यासाठी सेल प्रसारण सूचना वितरित केल्या जातात. दुर्भावनापूर्ण अॅप्स आणीबाणी सेल प्रसारण मिळवतात तेव्हा ती तुमच्या डिव्हाइसच्या परफॉर्मन्समध्ये किंवा कामामध्ये कदाचित व्यत्यय आणू शकतात."</string>
<string name="permlab_readCellBroadcasts" msgid="1598328843619646166">"सेल प्रसारण मेसेज वाचा"</string>
<string name="permdesc_readCellBroadcasts" msgid="6361972776080458979">"आपल्या डिव्हाइसद्वारे प्राप्त केलेले सेल प्रसारण मेसेज वाचण्यासाठी अॅप ला अनुमती देते. काही स्थानांमध्ये तुम्हाला आणीबाणीच्या परिस्थितीची चेतावणी देण्यासाठी सेल प्रसारण सूचना वितरीत केल्या जातात. आणीबाणी सेल प्रसारण प्राप्त होते तेव्हा आपल्या डिव्हाइसच्या कार्यप्रदर्शनात किंवा कार्यात दुर्भावनापूर्ण अॅप्स व्यत्यय आणू शकतात."</string>
<string name="permlab_subscribedFeedsRead" msgid="4756609637053353318">"सदस्यता घेतलेली फीड वाचा"</string>
@@ -394,7 +394,7 @@
<string name="permdesc_broadcastSticky" product="default" msgid="2825803764232445091">"रोचक प्रसारणे पाठविण्यासाठी अॅप ला अनुमती देते, जे प्रसारण समाप्त झाल्यानंतर देखील तसेच राहते. अत्याधिक वापरामुळे बरीच मेमरी वापरली जाऊन तो फोनला धीमा किंवा अस्थिर करू शकतो."</string>
<string name="permlab_readContacts" msgid="8348481131899886131">"तुमचे संपर्क वाचा"</string>
<string name="permdesc_readContacts" product="tablet" msgid="5294866856941149639">"तुम्ही कॉल केलेल्या, ईमेल केलेल्या किंवा विशिष्ट लोकांशी अन्य मार्गांनी संवाद प्रस्थापित केलेल्या लोकांच्या फ्रिक्वेन्सीसह, आपल्या टॅब्लेटवर स्टोअर केलेल्या आपल्या संपर्कांविषयीचा डेटा वाचण्यासाठी अॅप ला अनुमती देते. ही परवानगी तुमचा संपर्क डेटा सेव्ह करण्याची अॅप्स ला अनुमती देते आणि दुर्भावनापूर्ण अॅप्स आपल्या माहितीशिवाय संपर्क डेटा शेअर करू शकतात."</string>
- <string name="permdesc_readContacts" product="tv" msgid="3890061004911027912">"तुम्ही केलेले कॉल, केलेले ईमेल किंवा विशिष्ट संपर्कांसह अन्य मार्गांनी केलेले कम्युनिकेशन यांची वारंवारता, यासह तुमच्या Android TV डिव्हाइसवर स्टोअर केलेल्या तुमच्या संपर्कांविषयीचा डेटा वाचण्याची अॅपला अनुमती देते. ही परवानगी अॅप्सना तुमचा संपर्क डेटा सेव्ह करण्याची अनुमती देते आणि ही दुर्भावनापूर्ण अॅप्स तुम्हाला न कळवता संपर्क डेटा शेअर करू शकतात."</string>
+ <string name="permdesc_readContacts" product="tv" msgid="3890061004911027912">"तुम्ही केलेले कॉल, केलेले ईमेल किंवा विशिष्ट संपर्कांसह अन्य मार्गांनी केलेले कम्युनिकेशन यांची वारंवारता, यासह तुमच्या Android TV डिव्हाइसवर स्टोअर केलेल्या तुमच्या संपर्कांविषयीचा डेटा वाचण्याची अॅपला अनुमती देते. ही परवानगी अॅप्सना तुमचा संपर्क डेटा सेव्ह करण्याची अनुमती देते आणि ही दुर्भावनापूर्ण अॅप्स तुम्हाला न कळवता संपर्क डेटा शेअर करू शकतात."</string>
<string name="permdesc_readContacts" product="default" msgid="8440654152457300662">"तुम्ही कॉल केलेल्या, ईमेल केलेल्या किंवा विशिष्ट लोकांशी अन्य मार्गांनी संवाद प्रस्थापित केलेल्या लोकांच्या फ्रिक्वेन्सीसह, आपल्या फोनवर स्टोअर केलेल्या आपल्या संपर्कांविषयीचा डेटा वाचण्यासाठी अॅप ला अनुमती देते. ही परवानगी तुमचा संपर्क डेटा सेव्ह करण्याची अॅप्स ला अनुमती देते आणि दुर्भावनापूर्ण अॅप्स आपल्या माहितीशिवाय संपर्क डेटा शेअर करू शकतात."</string>
<string name="permlab_writeContacts" msgid="5107492086416793544">"तुमचे संपर्क सुधारित करा"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="897243932521953602">"तुम्ही विशिष्ट संपर्कांशी अन्य मार्गांनी कॉल केलेल्या, ईमेल केलेल्या किंवा संवाद प्रस्थापित केलेल्या फ्रिक्वेन्सीसह, आपल्या टॅब्लेटवर स्टोअर केलेल्या आपल्या संपर्कांविषयीचा डेटा सुधारित करण्यासाठी अॅप ला अनुमती देते. ही परवानगी संपर्क डेटा हटविण्यासाठी अॅप ला अनुमती देते."</string>
@@ -404,7 +404,7 @@
<string name="permdesc_readCallLog" msgid="3204122446463552146">"हा अॅप तुमचा कॉल इतिहास वाचू शकता."</string>
<string name="permlab_writeCallLog" msgid="8552045664743499354">"कॉल लॉग लिहा"</string>
<string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"येणार्या आणि केल्या जाणार्या कॉलविषयीच्या डेटासह, आपल्या टॅब्लेटचा कॉल लॉग सुधारित करण्यासाठी अॅप ला अनुमती देते. दुर्भावनापूर्ण अॅप्स तुमचा कॉल लॉग मिटवण्यासाठी किंवा सुधारित करण्यासाठी याचा वापर करू शकतात."</string>
- <string name="permdesc_writeCallLog" product="tv" msgid="7939219462637746280">"येणार्या आणि केल्या जाणार्या कॉलविषयीच्या डेटासह, तुमच्या Android TV डिव्हाइसचा कॉल लॉग सुधारित करण्यासाठी अॅपला अनुमती देते. दुर्भावनापूर्ण अॅप्स तुमचा कॉल लॉग मिटवण्यासाठी किंवा सुधारित करण्यासाठी याचा वापर करू शकतात."</string>
+ <string name="permdesc_writeCallLog" product="tv" msgid="7939219462637746280">"येणार्या आणि केल्या जाणार्या कॉलविषयीच्या डेटासह, तुमच्या Android TV डिव्हाइसचा कॉल लॉग सुधारित करण्यासाठी अॅपला अनुमती देते. दुर्भावनापूर्ण अॅप्स तुमचा कॉल लॉग मिटवण्यासाठी किंवा सुधारित करण्यासाठी याचा वापर करू शकतात."</string>
<string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"येणार्या आणि केल्या जाणार्या कॉलविषयीच्या डेटासह, आपल्या फोनचा कॉल लॉग सुधारित करण्यासाठी अॅप ला अनुमती देते. दुर्भावनापूर्ण अॅप्स तुमचा कॉल लॉग मिटवण्यासाठी किंवा सुधारित करण्यासाठी याचा वापर करू शकतात."</string>
<string name="permlab_bodySensors" msgid="4683341291818520277">"शरीर सेंसर (हृदय गती मॉनिटरसारखे) अॅक्सेस करा"</string>
<string name="permdesc_bodySensors" product="default" msgid="4380015021754180431">"हृदय गती सारख्या, आपल्या शारीरिक स्थितीचे नियंत्रण करणार्या सेन्सरवरून डेटामध्ये प्रवेश करण्यासाठी अॅपला अनुमती देते."</string>
@@ -1274,6 +1274,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ला इंटरनेट अॅक्सेस नाही"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"पर्यायांसाठी टॅप करा"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"कनेक्ट केले"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ला मर्यादित कनेक्टिव्हिटी आहे"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"तरीही कनेक्ट करण्यासाठी टॅप करा"</string>
@@ -1962,9 +1968,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"सेव्ह करा"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"नाही, नको"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"अपडेट करा"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"पुढे सुरू ठेवा"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"पासवर्ड"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"पत्ता"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"क्रेडिट कार्ड"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"डेबिट कार्ड"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"पेमेंट कार्ड"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"कार्ड"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"वापरकर्तानाव"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ईमेल अॅड्रेस"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"शांत रहा आणि जवळपास निवारा शोधा."</string>
diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml
index 4c811fd..bfe6f2b 100644
--- a/core/res/res/values-ms/strings.xml
+++ b/core/res/res/values-ms/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tiada akses Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Ketik untuk mendapatkan pilihan"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Rangkaian mudah alih tiada akses Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Rangkaian tiada akses Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Pelayan DNS peribadi tidak boleh diakses"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Disambungkan"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> mempunyai kesambungan terhad"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Ketik untuk menyambung juga"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Simpan"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Tidak, terima kasih"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Kemas kini"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Teruskan"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"kata laluan"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"alamat"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kad kredit"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"kad debit"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kad pembayaran"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kad"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nama pengguna"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"alamat e-mel"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Bertenang dan cari perlindungan di kawasan yang berdekatan."</string>
diff --git a/core/res/res/values-my/strings.xml b/core/res/res/values-my/strings.xml
index 38a33bf..d7375e2 100644
--- a/core/res/res/values-my/strings.xml
+++ b/core/res/res/values-my/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> တွင် အင်တာနက်အသုံးပြုခွင့် မရှိပါ"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"အခြားရွေးချယ်စရာများကိုကြည့်ရန် တို့ပါ"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"မိုဘိုင်းကွန်ရက်တွင် အင်တာနက်ချိတ်ဆက်မှု မရှိပါ"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"ကွန်ရက်တွင် အင်တာနက်အသုံးပြုခွင့် မရှိပါ"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"သီးသန့် ဒီအန်အက်စ် (DNS) ဆာဗာကို သုံး၍မရပါ။"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"ချိတ်ဆက်ထားသည်"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> တွင် ချိတ်ဆက်မှုကို ကန့်သတ်ထားသည်"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"မည်သို့ပင်ဖြစ်စေ ချိတ်ဆက်ရန် တို့ပါ"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"သိမ်းရန်"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"မလိုပါ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"အပ်ဒိတ်လုပ်ရန်"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ရှေ့ဆက်ရန်"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"စကားဝှက်"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"လိပ်စာ"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ခရက်တစ်ကတ်"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ဒက်ဘစ် ကတ်"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ငွေပေးချေမှုကတ်"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ကတ်"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"အသုံးပြုသူအမည်"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"အီးမေးလ်လိပ်စာ"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"စိတ်ငြိမ်ငြိမ်ထားပြီး အနီးအနားတဝိုက်တွင် ခိုနားစရာ နေရာရှာပါ။"</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index 2d4a5f5..3a78f79 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> har ingen internettilkobling"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Trykk for å få alternativer"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilnettverket har ingen internettilgang"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Nettverket har ingen internettilgang"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Den private DNS-tjeneren kan ikke nås"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Tilkoblet"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> har begrenset tilkobling"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Trykk for å koble til likevel"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Lagre"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nei takk"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Oppdater"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Fortsett"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"passord"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresse"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredittkort"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debetkort"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"betalingskort"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kort"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"brukernavn"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-postadresse"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Hold deg rolig og søk ly i nærheten."</string>
diff --git a/core/res/res/values-ne/strings.xml b/core/res/res/values-ne/strings.xml
index dc44d2a..d3eb0c3 100644
--- a/core/res/res/values-ne/strings.xml
+++ b/core/res/res/values-ne/strings.xml
@@ -1280,6 +1280,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> को इन्टरनेटमाथि पहुँच छैन"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"विकल्पहरूका लागि ट्याप गर्नुहोस्"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"मोबाइल नेटवर्कको इन्टरनेटमाथि पहुँच छैन"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"नेटवर्कको इन्टरनेटमाथि पहुँच छैन"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"निजी DNS सर्भरमाथि पहुँच प्राप्त गर्न सकिँदैन"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"जोडियो"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> को जडान सीमित छ"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"जसरी भए पनि जडान गर्न ट्याप गर्नुहोस्"</string>
@@ -1967,9 +1970,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"सुरक्षित गर्नुहोस्"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"पर्दैन, धन्यवाद"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"अद्यावधिक गर्नुहोस्"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"जारी राख्नुहोस्"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"पासवर्ड"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ठेगाना"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"क्रेडिट कार्ड"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"डेबिट कार्ड"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"भुक्तानी कार्ड"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"कार्ड"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"प्रयोगकर्ताको नाम"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"इमेल ठेगाना"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"शान्त रहनुहोस् र नजिकै आश्रयस्थल खोज्नुहोस्।"</string>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index 5c30c41..9300f74 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> heeft geen internettoegang"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tik voor opties"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobiel netwerk heeft geen internettoegang"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Netwerk heeft geen internettoegang"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Geen toegang tot privé-DNS-server"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Verbonden"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> heeft beperkte connectiviteit"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tik om toch verbinding te maken"</string>
@@ -1666,14 +1669,14 @@
<string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
<string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Verwijderen"</string>
<string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"Volume verhogen tot boven het aanbevolen niveau?\n\nAls je langere tijd op hoog volume naar muziek luistert, raakt je gehoor mogelijk beschadigd."</string>
- <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Sneltoets voor toegankelijkheid gebruiken?"</string>
+ <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Snelkoppeling toegankelijkheid gebruiken?"</string>
<string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Wanneer de snelkoppeling is ingeschakeld, kun je drie seconden op beide volumeknoppen drukken om een toegankelijkheidsfunctie te starten.\n\n Huidige toegankelijkheidsfunctie:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n Je kunt de functie wijzigen in Instellingen > Toegankelijkheid."</string>
<string name="disable_accessibility_shortcut" msgid="627625354248453445">"Sneltoets uitschakelen"</string>
<string name="leave_accessibility_shortcut_on" msgid="7653111894438512680">"Sneltoets gebruiken"</string>
<string name="color_inversion_feature_name" msgid="4231186527799958644">"Kleurinversie"</string>
<string name="color_correction_feature_name" msgid="6779391426096954933">"Kleurcorrectie"</string>
- <string name="accessibility_shortcut_enabling_service" msgid="7771852911861522636">"\'Snelle link voor toegankelijkheid\' heeft <xliff:g id="SERVICE_NAME">%1$s</xliff:g> ingeschakeld"</string>
- <string name="accessibility_shortcut_disabling_service" msgid="2747243438223109821">"\'Snelle link voor toegankelijkheid\' heeft <xliff:g id="SERVICE_NAME">%1$s</xliff:g> uitgeschakeld"</string>
+ <string name="accessibility_shortcut_enabling_service" msgid="7771852911861522636">"\'Snelkoppeling toegankelijkheid\' heeft <xliff:g id="SERVICE_NAME">%1$s</xliff:g> ingeschakeld"</string>
+ <string name="accessibility_shortcut_disabling_service" msgid="2747243438223109821">"\'Snelkoppeling toegankelijkheid\' heeft <xliff:g id="SERVICE_NAME">%1$s</xliff:g> uitgeschakeld"</string>
<string name="accessibility_shortcut_spoken_feedback" msgid="8376923232350078434">"Houd beide volumetoetsen drie seconden ingedrukt om <xliff:g id="SERVICE_NAME">%1$s</xliff:g> te gebruiken"</string>
<string name="accessibility_button_prompt_text" msgid="1176658502969738564">"Kies een service om te gebruiken wanneer je op de toegankelijkheidsknop tikt:"</string>
<string name="accessibility_gesture_prompt_text" msgid="8259145549733019401">"Kies een service om te gebruiken met het toegankelijkheidsgebaar (veeg met twee vingers omhoog vanaf de onderkant van het scherm):"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Opslaan"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nee, bedankt"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Updaten"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Doorgaan"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"Wachtwoord"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"Adres"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"Creditcard"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"pinpas"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"betaalkaart"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kaart"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"gebruikersnaam"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-mailadres"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Blijf kalm en zoek onderdak in de buurt."</string>
diff --git a/core/res/res/values-or/strings.xml b/core/res/res/values-or/strings.xml
index ac85a40..b4079ef 100644
--- a/core/res/res/values-or/strings.xml
+++ b/core/res/res/values-or/strings.xml
@@ -1274,6 +1274,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>ର ଇଣ୍ଟର୍ନେଟ୍ ଆକ୍ସେସ୍ ନାହିଁ"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ବିକଳ୍ପ ପାଇଁ ଟାପ୍ କରନ୍ତୁ"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"ସଂଯୁକ୍ତ ହୋଇଛି"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>ର ସୀମିତ ସଂଯୋଗ ଅଛି"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ତଥାପି ଯୋଗାଯୋଗ କରିବାକୁ ଟାପ୍ କରନ୍ତୁ"</string>
@@ -1961,9 +1967,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"ସେଭ୍ କରନ୍ତୁ"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ନାଁ, ପଚାରିଥିବାରୁ ଧନ୍ୟବାଦ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"ଅପ୍ଡେଟ୍ କରନ୍ତୁ"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ଜାରି ରଖନ୍ତୁ"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"ପାସୱର୍ଡ୍"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ଠିକଣା"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"କ୍ରେଡିଟ୍ କାର୍ଡ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ଡେବିଟ୍ କାର୍ଡ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ପେମେଣ୍ଟ କାର୍ଡ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"କାର୍ଡ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ୟୁଜରଙ୍କ ନାମ"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ଇମେଲ୍ ଠିକଣା"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ଶାନ୍ତ ରୁହନ୍ତୁ ଓ ନିକଟର କୌଣସି ଏକ ଆଶ୍ରୟସ୍ଥଳ ଖୋଜନ୍ତୁ"</string>
diff --git a/core/res/res/values-pa/strings.xml b/core/res/res/values-pa/strings.xml
index 177c7bc..68cfc5f 100644
--- a/core/res/res/values-pa/strings.xml
+++ b/core/res/res/values-pa/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ਕੋਲ ਇੰਟਰਨੈੱਟ ਪਹੁੰਚ ਨਹੀਂ ਹੈ"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ਵਿਕਲਪਾਂ ਲਈ ਟੈਪ ਕਰੋ"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"ਮੋਬਾਈਲ ਨੈੱਟਵਰਕ ਕੋਲ ਇੰਟਰਨੈੱਟ ਤੱਕ ਪਹੁੰਚ ਨਹੀਂ ਹੈ"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"ਨੈੱਟਵਰਕ ਕੋਲ ਇੰਟਰਨੈੱਟ ਤੱਕ ਪਹੁੰਚ ਨਹੀਂ ਹੈ"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"ਨਿੱਜੀ ਡੋਮੇਨ ਨਾਮ ਪ੍ਰਣਾਲੀ (DNS) ਸਰਵਰ \'ਤੇ ਪਹੁੰਚ ਨਹੀਂ ਕੀਤੀ ਜਾ ਸਕੀ"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"ਕਨੈਕਟ ਹੋਏ"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ਕੋਲ ਸੀਮਤ ਕਨੈਕਟੀਵਿਟੀ ਹੈ"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ਫਿਰ ਵੀ ਕਨੈਕਟ ਕਰਨ ਲਈ ਟੈਪ ਕਰੋ"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"ਰੱਖਿਅਤ ਕਰੋ"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ਨਹੀਂ ਧੰਨਵਾਦ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"ਅੱਪਡੇਟ ਕਰੋ"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ਜਾਰੀ ਰੱਖੋ"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"ਪਾਸਵਰਡ"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ਪਤਾ"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ਕ੍ਰੈਡਿਟ ਕਾਰਡ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ਡੈਬਿਟ ਕਾਰਡ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ਭੁਗਤਾਨ ਕਾਰਡ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ਕਾਰਡ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ਵਰਤੋਂਕਾਰ ਨਾਮ"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ਈਮੇਲ ਪਤਾ"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ਸ਼ਾਂਤ ਰਹੋ ਅਤੇ ਆਸ-ਪਾਸ ਪਨਾਹ ਮੰਗੋ।"</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 1f2430c..b238d4f 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -307,7 +307,7 @@
<string name="permgrouprequest_microphone" msgid="9167492350681916038">"Zezwolić aplikacji <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> na nagrywanie dźwięku?"</string>
<string name="permgrouplab_activityRecognition" msgid="1565108047054378642">"Aktywność fizyczna"</string>
<string name="permgroupdesc_activityRecognition" msgid="6949472038320473478">"dostęp do aktywności fizycznej"</string>
- <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"Zezwolić aplikacji „<xliff:g id="APP_NAME">%1$s</xliff:g>” na dostęp do aktywności fizycznej?"</string>
+ <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"Zezwolić aplikacji <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> na dostęp do aktywności fizycznej?"</string>
<string name="permgrouplab_camera" msgid="4820372495894586615">"Aparat"</string>
<string name="permgroupdesc_camera" msgid="3250611594678347720">"robienie zdjęć i nagrywanie filmów"</string>
<string name="permgrouprequest_camera" msgid="1299833592069671756">"Zezwolić aplikacji <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> na robienie zdjęć i nagrywanie filmów?"</string>
@@ -1318,6 +1318,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nie ma dostępu do internetu"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Kliknij, by wyświetlić opcje"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Połączono"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ma ograniczoną łączność"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Kliknij, by mimo to nawiązać połączenie"</string>
@@ -2031,9 +2037,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Zapisz"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nie, dziękuję"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Zaktualizuj"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Dalej"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"hasło"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adres"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"karta kredytowa"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"karta debetowa"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"karta płatnicza"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"karta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nazwa użytkownika"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adres e-mail"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Zachowaj spokój i poszukaj schronienia w pobliżu."</string>
diff --git a/core/res/res/values-pt-rBR/strings.xml b/core/res/res/values-pt-rBR/strings.xml
index 05967af..7442703 100644
--- a/core/res/res/values-pt-rBR/strings.xml
+++ b/core/res/res/values-pt-rBR/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> não tem acesso à Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Toque para ver opções"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"A rede móvel não tem acesso à Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"A rede não tem acesso à Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Não é possível acessar o servidor DNS privado"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Conectado"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tem conectividade limitada"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Toque para conectar mesmo assim"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Salvar"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Não, obrigado"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Atualizar"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuar"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"senha"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"endereço"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"cartão de crédito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"cartão de débito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"cartão de pagamento"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"cartão"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nome de usuário"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"endereço de e-mail"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Fique calmo e procure um abrigo por perto."</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 400d576..add12d9 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> não tem acesso à Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Toque para obter mais opções"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"A rede móvel não tem acesso à Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"A rede não tem acesso à Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Não é possível aceder ao servidor DNS."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Ligado"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tem conetividade limitada."</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Toque para ligar mesmo assim."</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Guardar"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Não, obrigado"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Atualizar"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuar"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"palavra-passe"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"endereço"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"cartão de crédito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"cartão de débito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"cartão de pagamento"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"cartão"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nome de utilizador"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"endereço de email"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Mantenha a calma e procure abrigo nas proximidades."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index 05967af..7442703 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> não tem acesso à Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Toque para ver opções"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"A rede móvel não tem acesso à Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"A rede não tem acesso à Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Não é possível acessar o servidor DNS privado"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Conectado"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> tem conectividade limitada"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Toque para conectar mesmo assim"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Salvar"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Não, obrigado"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Atualizar"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuar"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"senha"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"endereço"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"cartão de crédito"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"cartão de débito"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"cartão de pagamento"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"cartão"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nome de usuário"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"endereço de e-mail"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Fique calmo e procure um abrigo por perto."</string>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 27e6ec0..f1a6136 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -1296,6 +1296,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nu are acces la internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Atingeți pentru opțiuni"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Rețeaua mobilă nu are acces la internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Rețeaua nu are acces la internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Serverul DNS privat nu poate fi accesat"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Conectat"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> are conectivitate limitată"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Atingeți pentru a vă conecta oricum"</string>
@@ -1996,9 +1999,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Salvați"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nu, mulțumesc"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Actualizați"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Continuați"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"parolă"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresă"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"card de credit"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"card de debit"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"card de plată"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"nume de utilizator"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adresă de e-mail"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Păstrați-vă calmul și căutați un adăpost în apropiere."</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 6390b95..f01de36 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Сеть \"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>\" не подключена к Интернету"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Нажмите, чтобы показать варианты."</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобильная сеть не подключена к Интернету"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Сеть не подключена к Интернету"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Доступа к частному DNS-серверу нет."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Подключено"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Подключение к сети \"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>\" ограничено"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Нажмите, чтобы подключиться"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Сохранить"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Нет, спасибо"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Обновить"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Продолжить"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"Пароль"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"Адрес"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"Банковская карта"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебетовая карта"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"платежная карта"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"карта"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"имя пользователя"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"адрес электронной почты"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Сохраняйте спокойствие и поищите укрытие поблизости."</string>
diff --git a/core/res/res/values-si/strings.xml b/core/res/res/values-si/strings.xml
index fc69d0e..6dbf502 100644
--- a/core/res/res/values-si/strings.xml
+++ b/core/res/res/values-si/strings.xml
@@ -1276,6 +1276,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> හට අන්තර්ජාල ප්රවේශය නැත"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"විකල්ප සඳහා තට්ටු කරන්න"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"ජංගම ජාලවලට අන්තර්ජාල ප්රවේශය නැත"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"ජාලයට අන්තර්ජාල ප්රවේශය නැත"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"පුද්ගලික DNS සේවාදායකයට ප්රවේශ වීමට නොහැකිය"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"සම්බන්ධයි"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> හට සීමිත සබැඳුම් හැකියාවක් ඇත"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"කෙසේ වෙතත් ඉදිරියට යාමට තට්ටු කරන්න"</string>
@@ -1963,9 +1966,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"සුරකින්න"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"එපා ස්තූතියි"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"යාවත්කාලීන කරන්න"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ඉදිරියට යන්න"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"මුරපදය"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ලිපිනය"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ණය කාඩ්පත"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"හර කාඩ්පත"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ගෙවීම් කාඩ්පත"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"කාඩ්පත"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"පරිශීලක නාමය"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ඊ-තැපැල් ලිපිනය"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"සන්සුන්ව ඉන්න සහ අවට ඇති නවාතැන් පහසුකම් බලන්න."</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 59e8b5e..1549f4d 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nemá prístup k internetu"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Klepnutím získate možnosti"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilná sieť nemá prístup k internetu"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Sieť nemá prístup k internetu"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"K súkromnému serveru DNS sa nepodarilo získať prístup"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Pripojené"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> má obmedzené pripojenie"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Ak sa chcete aj napriek tomu pripojiť, klepnite"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Uložiť"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nie, vďaka"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Aktualizovať"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Pokračovať"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"heslo"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresa"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditná karta"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debetná karta"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"platobná karta"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"karta"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"používateľské meno"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-mailová adresa"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Zachovajte pokoj a vyhľadajte úkryt v okolí."</string>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index c49d5ff..40d0dde 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Omrežje <xliff:g id="NETWORK_SSID">%1$s</xliff:g> nima dostopa do interneta"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Dotaknite se za možnosti"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilno omrežje nima dostopa do interneta"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Omrežje nima dostopa do interneta"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Do zasebnega strežnika DNS ni mogoče dostopati"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Povezava je vzpostavljena"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Povezljivost omrežja <xliff:g id="NETWORK_SSID">%1$s</xliff:g> je omejena"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Dotaknite se, da kljub temu vzpostavite povezavo"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Shrani"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ne, hvala"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Posodobi"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Naprej"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"geslo"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"naslov"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditno kartico"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debetna kartica"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"plačilna kartica"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kartica"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"uporabniško ime"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-poštni naslov"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Ostanite mirni in poiščite zavetje v bližini."</string>
diff --git a/core/res/res/values-sq/strings.xml b/core/res/res/values-sq/strings.xml
index 045c7d5..ee46d3b 100644
--- a/core/res/res/values-sq/strings.xml
+++ b/core/res/res/values-sq/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nuk ka qasje në internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Trokit për opsionet"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Rrjeti celular nuk ka qasje në internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Rrjeti nuk ka qasje në internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Serveri privat DNS nuk mund të qaset"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Lidhur"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ka lidhshmëri të kufizuar"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Trokit për t\'u lidhur gjithsesi"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Ruaj"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Jo, faleminderit"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Përditëso"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Vazhdo"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"fjalëkalimi"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adresa"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"karta e kreditit"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"kartë debiti"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kartë pagese"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kartë"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"emri i përdoruesit"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"adresa e mail-it"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Qëndro i qetë dhe kërko strehim në afërsi."</string>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index 0d8acc6..7fd7353 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -1296,6 +1296,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> нема приступ интернету"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Додирните за опције"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобилна мрежа нема приступ интернету"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Мрежа нема приступ интернету"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Приступ приватном DNS серверу није успео"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Повезано је"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> има ограничену везу"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Додирните да бисте се ипак повезали"</string>
@@ -1996,9 +1999,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Сачувај"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Не, хвала"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Ажурирај"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Настави"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"лозинка"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"адреса"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"кредитна картица"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебитна картица"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"платна картица"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"картица"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"корисничко име"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"имејл адреса"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Останите мирни и потражите склониште у околини."</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index dba5ebb..b8da1b6 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> har ingen internetanslutning"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Tryck för alternativ"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobilnätverket har ingen internetanslutning"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Nätverket har ingen internetanslutning"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Det går inte att komma åt den privata DNS-servern."</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Ansluten"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> har begränsad anslutning"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Tryck för att ansluta ändå"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Spara"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Nej tack"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Uppdatera"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Fortsätt"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"lösenordet"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adressen"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kreditkortet"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"bankkort"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kontokort"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kort"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"användarnamn"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-postadress"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Håll dig lugn och sök skydd i närheten."</string>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index 89e3231..88221b6 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> haina uwezo wa kufikia intaneti"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Gusa ili upate chaguo"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mtandao wa simu hauna uwezo wa kufikia intaneti"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Mtandao hauna uwezo wa kufikia intaneti"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Seva ya faragha ya DNS haiwezi kufikiwa"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Imeunganisha"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ina muunganisho unaofikia huduma chache."</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Gusa ili uunganishe tu"</string>
@@ -1349,7 +1352,7 @@
<string name="dlg_ok" msgid="7376953167039865701">"Sawa"</string>
<string name="usb_charging_notification_title" msgid="1595122345358177163">"Unachaji kifaa hiki kupitia USB"</string>
<string name="usb_supplying_notification_title" msgid="4631045789893086181">"Inachaji kifaa kilichounganishwa kupitia USB"</string>
- <string name="usb_mtp_notification_title" msgid="4238227258391151029">"Umewasha hali ya uhamishaji wa faili kupitia USB"</string>
+ <string name="usb_mtp_notification_title" msgid="4238227258391151029">"Umewasha uhamishaji wa faili kupitia USB"</string>
<string name="usb_ptp_notification_title" msgid="5425857879922006878">"Umewasha hali ya PTP kupitia USB"</string>
<string name="usb_tether_notification_title" msgid="3716143122035802501">"Umewasha hali ya kusambaza mtandao ukitumia USB"</string>
<string name="usb_midi_notification_title" msgid="5356040379749154805">"Umewasha hali ya MIDI kupitia USB"</string>
@@ -1666,14 +1669,14 @@
<string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
<string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Ondoa"</string>
<string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"Ungependa kupandisha sauti zaidi ya kiwango kinachopendekezwa?\n\nKusikiliza kwa sauti ya juu kwa muda mrefu kunaweza kuharibu uwezo wako wa kusikia."</string>
- <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Ungependa Kutumia Njia ya Mkato ya Zana za walio na matatizo ya kuona au kusikia?"</string>
- <string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Unapowasha kipengele cha njia ya mkato, hatua ya kubonyeza vitufe vyote viwili vya sauti kwa dakika 3 itafungua kipengele cha zana za walio na matatizo ya kuona au kusikia.\n\n Kipengele kilichopo cha zana za walio na matatizo ya kuona au kusikia:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n Unaweza kubadilisha kipengele hiki katika Mipangilio > Zana za walio na matatizo ya kuona au kusikia."</string>
+ <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Ungependa kutumia njia ya mkato ya ufikivu?"</string>
+ <string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Unapowasha kipengele cha njia ya mkato, hatua ya kubonyeza vitufe vyote viwili vya sauti kwa dakika 3 itafungua kipengele cha ufikivu.\n\n Kipengele cha ufikivu kilichopo kwa sasa:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n Unaweza kubadilisha kipengele hiki katika Mipangilio > Zana za ufikivu."</string>
<string name="disable_accessibility_shortcut" msgid="627625354248453445">"Zima kipengele cha Njia ya Mkato"</string>
<string name="leave_accessibility_shortcut_on" msgid="7653111894438512680">"Tumia Njia ya Mkato"</string>
<string name="color_inversion_feature_name" msgid="4231186527799958644">"Ugeuzaji rangi"</string>
<string name="color_correction_feature_name" msgid="6779391426096954933">"Usahihishaji wa rangi"</string>
- <string name="accessibility_shortcut_enabling_service" msgid="7771852911861522636">"Njia ya mkato ya zana za walio na matatizo ya kuona au kusikia imewasha <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
- <string name="accessibility_shortcut_disabling_service" msgid="2747243438223109821">"Njia ya mkato ya zana za walio na matatizo ya kuona au kusikia imezima <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
+ <string name="accessibility_shortcut_enabling_service" msgid="7771852911861522636">"Njia ya mkato ya ufikivu imewasha <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
+ <string name="accessibility_shortcut_disabling_service" msgid="2747243438223109821">"Njia ya mkato ya ufikivu imezima <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
<string name="accessibility_shortcut_spoken_feedback" msgid="8376923232350078434">"Bonyeza na ushikilie vitufe vyote viwili vya sauti kwa sekunde tatu ili utumie <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
<string name="accessibility_button_prompt_text" msgid="1176658502969738564">"Chagua huduma ya kutumia unapogusa kitufe cha ufikivu:"</string>
<string name="accessibility_gesture_prompt_text" msgid="8259145549733019401">"Chagua huduma ya kutumia pamoja na ishara ya ufikivu (telezesha vidole viwili kutoka chini kwenda juu kwenye skrini):"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Hifadhi"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Hapana, asante"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Sasisha"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Endelea"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"nenosiri"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"anwani"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kadi ya mikopo"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"kadi ya malipo"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"kadi ya malipo"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kadi"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"jina la mtumiaji"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"anwani ya barua pepe"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Tulia na utafute hifadhi ya karibu."</string>
diff --git a/core/res/res/values-ta/strings.xml b/core/res/res/values-ta/strings.xml
index 0ed1421..6c35423 100644
--- a/core/res/res/values-ta/strings.xml
+++ b/core/res/res/values-ta/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> நெட்வொர்க்கிற்கு இணைய அணுகல் இல்லை"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"விருப்பங்களுக்கு, தட்டவும்"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"மொபைல் நெட்வொர்க்கிற்கு இணைய அணுகல் இல்லை"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"நெட்வொர்க்கிற்கு இணைய அணுகல் இல்லை"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"தனிப்பட்ட DNS சேவையகத்தை அணுக இயலாது"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"இணைக்கப்பட்டது"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> வரம்பிற்கு உட்பட்ட இணைப்புநிலையைக் கொண்டுள்ளது"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"எப்படியேனும் இணைப்பதற்குத் தட்டவும்"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"சேமி"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"வேண்டாம்"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"புதுப்பி"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"தொடர்க"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"கடவுச்சொல்"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"முகவரி"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"கிரெடிட் கார்டு"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"டெபிட் கார்டு"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"பேமெண்ட் கார்டு"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"கார்டு"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"பயனர்பெயர்"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"மின்னஞ்சல் முகவரி"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"பதட்டப்படாதீர்கள், அருகில் ஏதேனும் பாதுகாப்பான இடம் உள்ளதா எனப் பாருங்கள்."</string>
diff --git a/core/res/res/values-te/strings.xml b/core/res/res/values-te/strings.xml
index 72b83c4..7e91460 100644
--- a/core/res/res/values-te/strings.xml
+++ b/core/res/res/values-te/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>కి ఇంటర్నెట్ యాక్సెస్ లేదు"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"ఎంపికల కోసం నొక్కండి"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"మొబైల్ నెట్వర్క్కు ఇంటర్నెట్ యాక్సెస్ లేదు"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"నెట్వర్క్కు ఇంటర్నెట్ యాక్సెస్ లేదు"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"ప్రైవేట్ DNS సర్వర్ను యాక్సెస్ చేయడం సాధ్యపడదు"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"కనెక్ట్ చేయబడింది"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> పరిమిత కనెక్టివిటీని కలిగి ఉంది"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"ఏదేమైనా కనెక్ట్ చేయడానికి నొక్కండి"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"సేవ్ చేయి"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"వద్దు, ధన్యవాదాలు"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"అప్డేట్ చేయి"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"కొనసాగించు"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"పాస్వర్డ్"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"చిరునామా"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"క్రెడిట్ కార్డ్"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"డెబిట్ కార్డ్"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"చెల్లింపు కార్డ్"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"కార్డ్"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"వినియోగదారు పేరు"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ఇమెయిల్ చిరునామా"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ప్రశాంతంగా ఉండండి మరియు దగ్గర్లో తలదాచుకోండి."</string>
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index caaa32d..5431796 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> เข้าถึงอินเทอร์เน็ตไม่ได้"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"แตะเพื่อดูตัวเลือก"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"เครือข่ายมือถือไม่มีการเข้าถึงอินเทอร์เน็ต"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"เครือข่ายไม่มีการเข้าถึงอินเทอร์เน็ต"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"เข้าถึงเซิร์ฟเวอร์ DNS ไม่ได้"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"เชื่อมต่อแล้ว"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> มีการเชื่อมต่อจำกัด"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"แตะเพื่อเชื่อมต่อ"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"บันทึก"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"ไม่เป็นไร"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"อัปเดต"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"ทำต่อ"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"รหัสผ่าน"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ที่อยู่"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"บัตรเครดิต"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"บัตรเดบิต"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"บัตรสำหรับชำระเงิน"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"บัตร"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ชื่อผู้ใช้"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ที่อยู่อีเมล"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"ทำใจให้สงบและหาที่กำบังในบริเวณใกล้เคียง"</string>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 01cf28f..3e71d77 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Walang access sa internet ang <xliff:g id="NETWORK_SSID">%1$s</xliff:g>"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"I-tap para sa mga opsyon"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Walang access sa internet ang mobile network"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Walang access sa internet ang network"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Hindi ma-access ang pribadong DNS server"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Nakakonekta"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Limitado ang koneksyon ng <xliff:g id="NETWORK_SSID">%1$s</xliff:g>"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"I-tap para kumonekta pa rin"</string>
@@ -1666,8 +1669,8 @@
<string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
<string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Alisin"</string>
<string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"Lakasan ang volume nang lagpas sa inirerekomendang antas?\n\nMaaaring mapinsala ng pakikinig sa malakas na volume sa loob ng mahahabang panahon ang iyong pandinig."</string>
- <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Gagamitin ang Shortcut sa Pagiging Naa-access?"</string>
- <string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Kapag naka-on ang shortcut, magsisimula ang isang feature ng pagiging naa-access kapag pinindot ang parehong button ng volume sa loob ng 3 segundo.\n\n Kasalukuyang feature ng pagiging naa-access:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n Maaari mong baguhin ang feature sa Mga Setting > Pagiging Naa-access."</string>
+ <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Gagamitin ang Shortcut sa Pagiging Accessible?"</string>
+ <string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Kapag naka-on ang shortcut, magsisimula ang isang feature ng pagiging naa-access kapag pinindot ang parehong button ng volume sa loob ng 3 segundo.\n\n Kasalukuyang feature ng pagiging naa-access:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n Maaari mong baguhin ang feature sa Mga Setting > Pagiging Accessible."</string>
<string name="disable_accessibility_shortcut" msgid="627625354248453445">"I-off ang Shortcut"</string>
<string name="leave_accessibility_shortcut_on" msgid="7653111894438512680">"Gamitin ang Shortcut"</string>
<string name="color_inversion_feature_name" msgid="4231186527799958644">"Pag-invert ng Kulay"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"I-save"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Hindi, salamat na lang"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"I-update"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Magpatuloy"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"password"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"address"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"credit card"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debit card"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"card sa pagbabayad"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"card"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"username"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email address"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Manatiling kalmado at maghanap ng matutuluyan sa malapit."</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index d3e9d93..8a63348 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ağının internet bağlantısı yok"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Seçenekler için dokunun"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobil ağın internet bağlantısı yok"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Ağın internet bağlantısı yok"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Gizli DNS sunucusuna erişilemiyor"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Bağlandı"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> sınırlı bağlantıya sahip"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Yine de bağlanmak için dokunun"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Kaydet"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Hayır, teşekkürler"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Güncelle"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Devam"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"şifre"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"adres"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredi kartı"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"banka kartı"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ödeme kartı"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"kart"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"kullanıcı adı"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"e-posta adresi"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Sakin olun ve yakınlarda sığınabileceğiniz bir yer bulun."</string>
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index 88350a2..3d7358e 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -1318,6 +1318,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"Мережа <xliff:g id="NETWORK_SSID">%1$s</xliff:g> не має доступу до Інтернету"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Торкніться, щоб відкрити опції"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Мобільна мережа не має доступу до Інтернету"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Мережа не має доступу до Інтернету"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Немає доступу до приватного DNS-сервера"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Підключено"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"Підключення до мережі <xliff:g id="NETWORK_SSID">%1$s</xliff:g> обмежено"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Натисніть, щоб усе одно підключитися"</string>
@@ -1714,14 +1717,14 @@
<string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
<string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Вилучити"</string>
<string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"Збільшити гучність понад рекомендований рівень?\n\nЯкщо слухати надто гучну музику тривалий час, можна пошкодити слух."</string>
- <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Використовувати ярлик спеціальних можливостей?"</string>
+ <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"Використовувати швидке ввімкнення?"</string>
<string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"Коли ярлик увімкнено, після натискання обох клавіш гучності й утримування їх протягом 3 секунд увімкнеться функція спеціальних можливостей.\n\n Поточна функція спеціальних можливостей:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n Цю функцію можна змінити в меню \"Налаштування\" > \"Спеціальні можливості\"."</string>
<string name="disable_accessibility_shortcut" msgid="627625354248453445">"Вимкнути ярлик"</string>
<string name="leave_accessibility_shortcut_on" msgid="7653111894438512680">"Використовувати ярлик"</string>
<string name="color_inversion_feature_name" msgid="4231186527799958644">"Інверсія кольорів"</string>
<string name="color_correction_feature_name" msgid="6779391426096954933">"Корекція кольорів"</string>
- <string name="accessibility_shortcut_enabling_service" msgid="7771852911861522636">"Ярлик спеціальних можливостей увімкнув <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
- <string name="accessibility_shortcut_disabling_service" msgid="2747243438223109821">"Ярлик спеціальних можливостей вимкнув <xliff:g id="SERVICE_NAME">%1$s</xliff:g>"</string>
+ <string name="accessibility_shortcut_enabling_service" msgid="7771852911861522636">"Сервіс <xliff:g id="SERVICE_NAME">%1$s</xliff:g> увімкнено"</string>
+ <string name="accessibility_shortcut_disabling_service" msgid="2747243438223109821">"Сервіс <xliff:g id="SERVICE_NAME">%1$s</xliff:g> вимкнено"</string>
<string name="accessibility_shortcut_spoken_feedback" msgid="8376923232350078434">"Щоб скористатися службою <xliff:g id="SERVICE_NAME">%1$s</xliff:g>, утримуйте обидві клавіші гучності впродовж трьох секунд"</string>
<string name="accessibility_button_prompt_text" msgid="1176658502969738564">"Виберіть сервіс для кнопки спеціальних можливостей:"</string>
<string name="accessibility_gesture_prompt_text" msgid="8259145549733019401">"Виберіть сервіс для жесту спеціальних можливостей (проведення двома пальцями знизу вгору):"</string>
@@ -2031,9 +2034,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Зберегти"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Ні, дякую"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Оновити"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Продовжити"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"пароль"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"адреса"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"кредитна картка"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"дебетова картка"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"платіжна картка"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"картка"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"ім’я користувача"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"електронна адреса"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Не хвилюйтеся та знайдіть прихисток поблизу."</string>
diff --git a/core/res/res/values-ur/strings.xml b/core/res/res/values-ur/strings.xml
index e5015ea..776595f 100644
--- a/core/res/res/values-ur/strings.xml
+++ b/core/res/res/values-ur/strings.xml
@@ -1274,6 +1274,12 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> کو انٹرنیٹ تک رسائی حاصل نہیں ہے"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"اختیارات کیلئے تھپتھپائیں"</string>
+ <!-- no translation found for mobile_no_internet (1445208572588803493) -->
+ <skip />
+ <!-- no translation found for other_networks_no_internet (1553338015597653827) -->
+ <skip />
+ <!-- no translation found for private_dns_broken_detailed (4293356177543535578) -->
+ <skip />
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"منسلک ہے"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> کی کنیکٹوٹی محدود ہے"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"بہر حال منسلک کرنے کے لیے تھپتھپائیں"</string>
@@ -1962,9 +1968,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"محفوظ کریں"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"نہیں، شکریہ"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"اپ ڈیٹ کریں"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"جاری رکھیں"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"پاس ورڈ"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"پتہ"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"کریڈٹ کارڈ"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ڈیبٹ کارڈ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ادائیگی کارڈ"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"کارڈ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"صارف نام"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ای میل پتہ"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"پُرسکون رہیں اور قریبی پناہ حاصل کریں۔"</string>
diff --git a/core/res/res/values-uz/strings.xml b/core/res/res/values-uz/strings.xml
index 8899747..1f70155 100644
--- a/core/res/res/values-uz/strings.xml
+++ b/core/res/res/values-uz/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nomli tarmoqda internetga ruxsati yoʻq"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Variantlarni ko‘rsatish uchun bosing"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mobil tarmoq internetga ulanmagan"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Tarmoq internetga ulanmagan"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Xususiy DNS server ishlamayapti"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Ulandi"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> nomli tarmoqda aloqa cheklangan"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Baribir ulash uchun bosing"</string>
@@ -1962,9 +1965,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Saqlash"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Kerak emas"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Yangilash"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Davom etish"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"parol"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"manzil"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"kredit karta"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"debet karta"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"toʻlov kartasi"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"bildirgi"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"foydalanuvchi nomi"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"email manzili"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Tinchlaning va yaqin-atrofdan boshpana qidiring."</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index fc8994e..dc9076f 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> không có quyền truy cập Internet"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Nhấn để biết tùy chọn"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Mạng di động không có quyền truy cập Internet"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Mạng không có quyền truy cập Internet"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Không thể truy cập máy chủ DNS riêng tư"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Đã kết nối"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> có khả năng kết nối giới hạn"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Nhấn để tiếp tục kết nối"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Lưu"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Không, cảm ơn"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Cập nhật"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Tiếp tục"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"mật khẩu"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"địa chỉ"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"thẻ tín dụng"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"thẻ ghi nợ"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"thẻ thanh toán"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"thẻ"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"tên người dùng"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"địa chỉ email"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Hãy bình tĩnh và tìm kiếm nơi trú ẩn gần đó."</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index 56d8153..8ab182e 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> 无法访问互联网"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"点按即可查看相关选项"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"此移动网络无法访问互联网"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"此网络无法访问互联网"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"无法访问私人 DNS 服务器"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"已连接"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> 的连接受限"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"点按即可继续连接"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"保存"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"不用了"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"更新"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"继续"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"密码"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"地址"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"信用卡"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"借记卡"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"支付卡"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"卡片"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"用户名"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"电子邮件地址"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"请保持冷静,并寻找附近的避难地点。"</string>
diff --git a/core/res/res/values-zh-rHK/strings.xml b/core/res/res/values-zh-rHK/strings.xml
index c8360aa..d318764 100644
--- a/core/res/res/values-zh-rHK/strings.xml
+++ b/core/res/res/values-zh-rHK/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>未有連接至互聯網"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"輕按即可查看選項"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"流動網絡並未連接互聯網"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"網絡並未連接互聯網"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"無法存取私人 DNS 伺服器"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"已連接"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g>連線受限"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"仍要輕按以連結至此網絡"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"儲存"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"不用了,謝謝"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"更新"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"繼續"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"密碼"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"地址"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"信用卡"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"扣帳卡"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"付款卡"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"卡"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"使用者名稱"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"電郵地址"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"請保持冷靜,並尋找附近的避難所。"</string>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index 23b68e1..cd787c0 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> 沒有網際網路連線"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"輕觸即可查看選項"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"這個行動網路沒有網際網路連線"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"這個網路沒有網際網路連線"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"無法存取私人 DNS 伺服器"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"已連線"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"<xliff:g id="NETWORK_SSID">%1$s</xliff:g> 的連線能力受限"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"輕觸即可繼續連線"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"儲存"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"不用了,謝謝"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"更新"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"繼續"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"密碼"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"地址"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"信用卡"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"簽帳金融卡"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"付款卡"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"卡片"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"使用者名稱"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"電子郵件地址"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"請保持冷靜並尋找附近的避難地點。"</string>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index dac7c10..45bda9e 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -1274,6 +1274,9 @@
<skip />
<string name="wifi_no_internet" msgid="5198100389964214865">"I-<xliff:g id="NETWORK_SSID">%1$s</xliff:g> ayinakho ukufinyelela kwe-inthanethi"</string>
<string name="wifi_no_internet_detailed" msgid="8083079241212301741">"Thepha ukuze uthole izinketho"</string>
+ <string name="mobile_no_internet" msgid="1445208572588803493">"Inethiwekhi yeselula ayinakho ukufinyelela kwe-inthanethi"</string>
+ <string name="other_networks_no_internet" msgid="1553338015597653827">"Inethiwekhi ayinakho ukufinyelela kwenethiwekhi"</string>
+ <string name="private_dns_broken_detailed" msgid="4293356177543535578">"Iseva eyimfihlo ye-DNS ayikwazi ukufinyelelwa"</string>
<string name="captive_portal_logged_in_detailed" msgid="8489345381637456021">"Kuxhunyiwe"</string>
<string name="network_partial_connectivity" msgid="7774883385494762741">"I-<xliff:g id="NETWORK_SSID">%1$s</xliff:g> inokuxhumeka okukhawulelwe"</string>
<string name="network_partial_connectivity_detailed" msgid="1959697814165325217">"Thepha ukuze uxhume noma kunjalo"</string>
@@ -1961,9 +1964,13 @@
<string name="autofill_save_yes" msgid="6398026094049005921">"Londoloza"</string>
<string name="autofill_save_no" msgid="2625132258725581787">"Cha ngiyabonga"</string>
<string name="autofill_update_yes" msgid="310358413273276958">"Buyekeza"</string>
+ <string name="autofill_continue_yes" msgid="7473570809545975068">"Qhubeka"</string>
<string name="autofill_save_type_password" msgid="5288448918465971568">"iphasiwedi"</string>
<string name="autofill_save_type_address" msgid="4936707762193009542">"ikheli"</string>
<string name="autofill_save_type_credit_card" msgid="7127694776265563071">"ikhadi lesikweletu"</string>
+ <string name="autofill_save_type_debit_card" msgid="177366134636469277">"ikhaddi lasebhange"</string>
+ <string name="autofill_save_type_payment_card" msgid="446631844461198737">"ikhadi lokukhokha"</string>
+ <string name="autofill_save_type_generic_card" msgid="5898375974937018019">"ikhadi"</string>
<string name="autofill_save_type_username" msgid="239040540379769562">"igama lomsebenzisi"</string>
<string name="autofill_save_type_email_address" msgid="5752949432129262174">"ikheli le-imeyili"</string>
<string name="etws_primary_default_message_earthquake" msgid="5541962250262769193">"Hlala ubeke umoya phansi uphinde ufune ukukhuselwa eduze."</string>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 75cdb42..eaf93eb 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4357,4 +4357,8 @@
create additional screen real estate outside beyond the keyboard. Note that the user needs
to have a confirmed way to dismiss the keyboard when desired. -->
<bool name="config_automotiveHideNavBarForKeyboard">false</bool>
+
+ <!-- Whether or not to show the built-in charging animation when the device begins charging
+ wirelessly. -->
+ <bool name="config_showBuiltinWirelessChargingAnim">true</bool>
</resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index a01bbe3..9791241 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -41,6 +41,8 @@
<dimen name="quick_qs_offset_height">48dp</dimen>
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
<dimen name="quick_qs_total_height">176dp</dimen>
+ <!-- Total height of QQS with two rows to fit media player (quick_qs_offset_height + 176) -->
+ <dimen name="quick_qs_total_height_with_media">224dp</dimen>
<!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">48dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index bf5f706..d39d507 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3440,6 +3440,15 @@
<!-- A notification is shown when the user connects to a Wi-Fi network and the system detects that that network has no Internet access. This is the notification's message. -->
<string name="wifi_no_internet_detailed">Tap for options</string>
+ <!-- A notification is shown when the user connects to a mobile network without internet access. This is the notification's title. -->
+ <string name="mobile_no_internet">Mobile network has no internet access</string>
+
+ <!-- A notification is shown when the user connects to a non-mobile and non-wifi network without internet access. This is the notification's title. -->
+ <string name="other_networks_no_internet">Network has no internet access</string>
+
+ <!-- A notification is shown when connected network without internet due to private dns validation failed. This is the notification's message. [CHAR LIMIT=NONE] -->
+ <string name="private_dns_broken_detailed">Private DNS server cannot be accessed</string>
+
<!-- A notification is shown after the user logs in to a captive portal network, to indicate that the network should now have internet connectivity. This is the message of notification. [CHAR LIMIT=50] -->
<string name="captive_portal_logged_in_detailed">Connected</string>
<!-- A notification is shown when the user connects to a network that doesn't have access to some services (e.g. Push notifications may not work). This is the notification's title. [CHAR LIMIT=50] -->
@@ -5205,6 +5214,8 @@
<string name="autofill_save_no">No thanks</string>
<!-- Label for the autofill update button [CHAR LIMIT=NONE] -->
<string name="autofill_update_yes">Update</string>
+ <!-- Label for the autofill continue button [CHAR LIMIT=NONE] -->
+ <string name="autofill_continue_yes">Continue</string>
<!-- Label for the type of data being saved for autofill when it represent user credentials with a password [CHAR LIMIT=NONE] -->
<string name="autofill_save_type_password">password</string>
@@ -5212,6 +5223,12 @@
<string name="autofill_save_type_address">address</string>
<!-- Label for the type of data being saved for autofill when it represents a credit card [CHAR LIMIT=NONE] -->
<string name="autofill_save_type_credit_card">credit card</string>
+ <!-- Label for the type of data being saved for autofill when it represents a debit card [CHAR LIMIT=NONE] -->
+ <string name="autofill_save_type_debit_card">debit card</string>
+ <!-- Label for the type of data being saved for autofill when it represents a payment card [CHAR LIMIT=NONE] -->
+ <string name="autofill_save_type_payment_card">payment card</string>
+ <!-- Label for the type of data being saved for autofill when it represents a card that does not a specified type or cannot identify what the type is for [CHAR LIMIT=NONE] -->
+ <string name="autofill_save_type_generic_card">card</string>
<!-- Label for the type of data being saved for autofill when it represents an username [CHAR LIMIT=NONE] -->
<string name="autofill_save_type_username">username</string>
<!-- Label for the type of data being saved for autofill when it represents an email address [CHAR LIMIT=NONE] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 6bb4719..8d96c79 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -593,9 +593,12 @@
<java-symbol type="string" name="menu_space_shortcut_label" />
<java-symbol type="string" name="menu_shift_shortcut_label" />
<java-symbol type="string" name="menu_sym_shortcut_label" />
+ <java-symbol type="string" name="mobile_no_internet" />
<java-symbol type="string" name="notification_title" />
+ <java-symbol type="string" name="other_networks_no_internet" />
<java-symbol type="string" name="permission_request_notification_with_subtitle" />
<java-symbol type="string" name="prepend_shortcut_label" />
+ <java-symbol type="string" name="private_dns_broken_detailed" />
<java-symbol type="string" name="paste_as_plain_text" />
<java-symbol type="string" name="replace" />
<java-symbol type="string" name="undo" />
@@ -1774,6 +1777,7 @@
<java-symbol type="dimen" name="display_cutout_touchable_region_size" />
<java-symbol type="dimen" name="quick_qs_offset_height" />
<java-symbol type="dimen" name="quick_qs_total_height" />
+ <java-symbol type="dimen" name="quick_qs_total_height_with_media" />
<java-symbol type="drawable" name="ic_jog_dial_sound_off" />
<java-symbol type="drawable" name="ic_jog_dial_sound_on" />
<java-symbol type="drawable" name="ic_jog_dial_unlock" />
@@ -3355,6 +3359,7 @@
<java-symbol type="string" name="autofill_update_title_with_2types" />
<java-symbol type="string" name="autofill_update_title_with_3types" />
<java-symbol type="string" name="autofill_update_yes" />
+ <java-symbol type="string" name="autofill_continue_yes" />
<java-symbol type="string" name="autofill_save_accessibility_title " />
<java-symbol type="string" name="autofill_save_title" />
<java-symbol type="string" name="autofill_save_title_with_type" />
@@ -3365,6 +3370,9 @@
<java-symbol type="string" name="autofill_save_type_password" />
<java-symbol type="string" name="autofill_save_type_address" />
<java-symbol type="string" name="autofill_save_type_credit_card" />
+ <java-symbol type="string" name="autofill_save_type_debit_card" />
+ <java-symbol type="string" name="autofill_save_type_payment_card" />
+ <java-symbol type="string" name="autofill_save_type_generic_card" />
<java-symbol type="string" name="autofill_save_type_username" />
<java-symbol type="string" name="autofill_save_type_email_address" />
<java-symbol type="drawable" name="autofill_dataset_picker_background" />
@@ -3866,4 +3874,6 @@
<java-symbol type="bool" name="config_automotiveHideNavBarForKeyboard" />
+ <java-symbol type="bool" name="config_showBuiltinWirelessChargingAnim" />
+
</resources>
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
index f71c8b0..2d1c61c 100644
--- a/core/res/res/xml/sms_short_codes.xml
+++ b/core/res/res/xml/sms_short_codes.xml
@@ -90,7 +90,7 @@
<shortcode country="cz" premium="9\\d{6,7}" free="116\\d{3}" />
<!-- Germany: 4-5 digits plus 1232xxx (premium codes from http://www.vodafone.de/infofaxe/537.pdf and http://premiumdienste.eplus.de/pdf/kodex.pdf), plus EU. To keep the premium regex from being too large, it only includes payment processors that have been used by SMS malware, with the regular pattern matching the other premium short codes. -->
- <shortcode country="de" pattern="\\d{4,5}|1232\\d{3}" premium="11(?:111|833)|1232(?:013|021|060|075|286|358)|118(?:44|80|86)|20[25]00|220(?:21|22|88|99)|221(?:14|21)|223(?:44|53|77)|224[13]0|225(?:20|59|90)|226(?:06|10|20|26|30|40|56|70)|227(?:07|33|39|66|76|78|79|88|99)|228(?:08|11|66|77)|23300|30030|3[12347]000|330(?:33|55|66)|33(?:233|331|366|533)|34(?:34|567)|37000|40(?:040|123|444|[3568]00)|41(?:010|414)|44(?:000|044|344|44[24]|544)|50005|50100|50123|50555|51000|52(?:255|783)|54(?:100|2542)|55(?:077|[24]00|222|333|55|[12369]55)|56(?:789|886)|60800|6[13]000|66(?:[12348]66|566|766|777|88|999)|68888|70(?:07|123|777)|76766|77(?:007|070|222|444|[567]77)|80(?:008|123|888)|82(?:002|[378]00|323|444|472|474|488|727)|83(?:005|[169]00|333|830)|84(?:141|300|32[34]|343|488|499|777|888)|85888|86(?:188|566|640|644|650|677|868|888)|870[24]9|871(?:23|[49]9)|872(?:1[0-8]|49|99)|87499|875(?:49|55|99)|876(?:0[1367]|1[1245678]|54|99)|877(?:00|99)|878(?:15|25|3[567]|8[12])|87999|880(?:08|44|55|77|99)|88688|888(?:03|10|8|89)|8899|90(?:009|999)|99999" free="116\\d{3}|81214|81215|47529|70296|83782|3011|73240" />
+ <shortcode country="de" pattern="\\d{4,5}|1232\\d{3}" premium="11(?:111|833)|1232(?:013|021|060|075|286|358)|118(?:44|80|86)|20[25]00|220(?:21|22|88|99)|221(?:14|21)|223(?:44|53|77)|224[13]0|225(?:20|59|90)|226(?:06|10|20|26|30|40|56|70)|227(?:07|33|39|66|76|78|79|88|99)|228(?:08|11|66|77)|23300|30030|3[12347]000|330(?:33|55|66)|33(?:233|331|366|533)|34(?:34|567)|37000|40(?:040|123|444|[3568]00)|41(?:010|414)|44(?:000|044|344|44[24]|544)|50005|50100|50123|50555|51000|52(?:255|783)|54(?:100|2542)|55(?:077|[24]00|222|333|55|[12369]55)|56(?:789|886)|60800|6[13]000|66(?:[12348]66|566|766|777|88|999)|68888|70(?:07|123|777)|76766|77(?:007|070|222|444|[567]77)|80(?:008|123|888)|82(?:002|[378]00|323|444|472|474|488|727)|83(?:005|[169]00|333|830)|84(?:141|300|32[34]|343|488|499|777|888)|85888|86(?:188|566|640|644|650|677|868|888)|870[24]9|871(?:23|[49]9)|872(?:1[0-8]|49|99)|87499|875(?:49|55|99)|876(?:0[1367]|1[1245678]|54|99)|877(?:00|99)|878(?:15|25|3[567]|8[12])|87999|880(?:08|44|55|77|99)|88688|888(?:03|10|8|89)|8899|90(?:009|999)|99999" free="116\\d{3}|81214|81215|47529|70296|83782|3011|73240|72438" />
<!-- Denmark: see http://iprs.webspacecommerce.com/Denmark-Premium-Rate-Numbers -->
<shortcode country="dk" pattern="\\d{4,5}" premium="1\\d{3}" free="116\\d{3}|4665" />
diff --git a/core/tests/coretests/src/android/app/NotificationHistoryTest.java b/core/tests/coretests/src/android/app/NotificationHistoryTest.java
new file mode 100644
index 0000000..08595bb
--- /dev/null
+++ b/core/tests/coretests/src/android/app/NotificationHistoryTest.java
@@ -0,0 +1,232 @@
+/*
+ * 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.app;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.NotificationHistory.HistoricalNotification;
+import android.graphics.drawable.Icon;
+import android.os.Parcel;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+public class NotificationHistoryTest {
+
+ private HistoricalNotification getHistoricalNotification(int index) {
+ return getHistoricalNotification("package" + index, index);
+ }
+
+ private HistoricalNotification getHistoricalNotification(String packageName, int index) {
+ String expectedChannelName = "channelName" + index;
+ String expectedChannelId = "channelId" + index;
+ int expectedUid = 1123456 + index;
+ int expectedUserId = 11 + index;
+ long expectedPostTime = 987654321 + index;
+ String expectedTitle = "title" + index;
+ String expectedText = "text" + index;
+ Icon expectedIcon = Icon.createWithResource(InstrumentationRegistry.getContext(),
+ index);
+
+ return new HistoricalNotification.Builder()
+ .setPackage(packageName)
+ .setChannelName(expectedChannelName)
+ .setChannelId(expectedChannelId)
+ .setUid(expectedUid)
+ .setUserId(expectedUserId)
+ .setPostedTimeMs(expectedPostTime)
+ .setTitle(expectedTitle)
+ .setText(expectedText)
+ .setIcon(expectedIcon)
+ .build();
+ }
+
+ @Test
+ public void testHistoricalNotificationBuilder() {
+ String expectedPackage = "package";
+ String expectedChannelName = "channelName";
+ String expectedChannelId = "channelId";
+ int expectedUid = 1123456;
+ int expectedUserId = 11;
+ long expectedPostTime = 987654321;
+ String expectedTitle = "title";
+ String expectedText = "text";
+ Icon expectedIcon = Icon.createWithResource(InstrumentationRegistry.getContext(),
+ android.R.drawable.btn_star);
+
+ HistoricalNotification n = new HistoricalNotification.Builder()
+ .setPackage(expectedPackage)
+ .setChannelName(expectedChannelName)
+ .setChannelId(expectedChannelId)
+ .setUid(expectedUid)
+ .setUserId(expectedUserId)
+ .setPostedTimeMs(expectedPostTime)
+ .setTitle(expectedTitle)
+ .setText(expectedText)
+ .setIcon(expectedIcon)
+ .build();
+
+ assertThat(n.getPackage()).isEqualTo(expectedPackage);
+ assertThat(n.getChannelName()).isEqualTo(expectedChannelName);
+ assertThat(n.getChannelId()).isEqualTo(expectedChannelId);
+ assertThat(n.getUid()).isEqualTo(expectedUid);
+ assertThat(n.getUserId()).isEqualTo(expectedUserId);
+ assertThat(n.getPostedTimeMs()).isEqualTo(expectedPostTime);
+ assertThat(n.getTitle()).isEqualTo(expectedTitle);
+ assertThat(n.getText()).isEqualTo(expectedText);
+ assertThat(expectedIcon.sameAs(n.getIcon())).isTrue();
+ }
+
+ @Test
+ public void testAddNotificationToWrite() {
+ NotificationHistory history = new NotificationHistory();
+ HistoricalNotification n = getHistoricalNotification(0);
+ HistoricalNotification n2 = getHistoricalNotification(1);
+
+ history.addNotificationToWrite(n2);
+ history.addNotificationToWrite(n);
+
+ assertThat(history.getNotificationsToWrite().size()).isEqualTo(2);
+ assertThat(history.getNotificationsToWrite().get(0)).isSameAs(n2);
+ assertThat(history.getNotificationsToWrite().get(1)).isSameAs(n);
+ assertThat(history.getHistoryCount()).isEqualTo(2);
+ }
+
+ @Test
+ public void testPoolStringsFromNotifications() {
+ NotificationHistory history = new NotificationHistory();
+
+ List<String> expectedStrings = new ArrayList<>();
+ for (int i = 1; i <= 10; i++) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ history.addNotificationToWrite(n);
+ }
+
+ history.poolStringsFromNotifications();
+
+ assertThat(history.getPooledStringsToWrite().length).isEqualTo(expectedStrings.size());
+ String previous = null;
+ for (String actual : history.getPooledStringsToWrite()) {
+ assertThat(expectedStrings).contains(actual);
+
+ if (previous != null) {
+ assertThat(actual).isGreaterThan(previous);
+ }
+ previous = actual;
+ }
+ }
+
+ @Test
+ public void testAddPooledStrings() {
+ NotificationHistory history = new NotificationHistory();
+
+ List<String> expectedStrings = new ArrayList<>();
+ for (int i = 1; i <= 10; i++) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ history.addNotificationToWrite(n);
+ }
+
+ history.addPooledStrings(expectedStrings);
+
+ String[] actualStrings = history.getPooledStringsToWrite();
+ assertThat(actualStrings.length).isEqualTo(expectedStrings.size());
+ String previous = null;
+ for (String actual : actualStrings) {
+ assertThat(expectedStrings).contains(actual);
+
+ if (previous != null) {
+ assertThat(actual).isGreaterThan(previous);
+ }
+ previous = actual;
+ }
+ }
+
+ @Test
+ public void testRemoveNotificationsFromWrite() {
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> postRemoveExpectedEntries = new ArrayList<>();
+ List<String> postRemoveExpectedStrings = new ArrayList<>();
+ for (int i = 1; i <= 10; i++) {
+ HistoricalNotification n =
+ getHistoricalNotification((i % 2 == 0) ? "pkgEven" : "pkgOdd", i);
+
+ if (i % 2 == 0) {
+ postRemoveExpectedStrings.add(n.getPackage());
+ postRemoveExpectedStrings.add(n.getChannelName());
+ postRemoveExpectedStrings.add(n.getChannelId());
+ postRemoveExpectedEntries.add(n);
+ }
+
+ history.addNotificationToWrite(n);
+ }
+
+ history.poolStringsFromNotifications();
+
+ assertThat(history.getNotificationsToWrite().size()).isEqualTo(10);
+ // 2 package names and 10 * 2 unique channel names and ids
+ assertThat(history.getPooledStringsToWrite().length).isEqualTo(22);
+
+ history.removeNotificationsFromWrite("pkgOdd");
+
+
+ // 1 package names and 5 * 2 unique channel names and ids
+ assertThat(history.getPooledStringsToWrite().length).isEqualTo(11);
+ assertThat(history.getNotificationsToWrite())
+ .containsExactlyElementsIn(postRemoveExpectedEntries);
+ }
+
+ @Test
+ public void testParceling() {
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ for (int i = 10; i >= 1; i--) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedEntries.add(n);
+ history.addNotificationToWrite(n);
+ }
+ history.poolStringsFromNotifications();
+
+ Parcel parcel = Parcel.obtain();
+ history.writeToParcel(parcel, 0);
+ parcel.setDataPosition(0);
+ NotificationHistory parceledHistory = NotificationHistory.CREATOR.createFromParcel(parcel);
+
+ assertThat(parceledHistory.getHistoryCount()).isEqualTo(expectedEntries.size());
+
+ for (int i = 0; i < expectedEntries.size(); i++) {
+ assertThat(parceledHistory.hasNextNotification()).isTrue();
+
+ HistoricalNotification postParcelNotification = parceledHistory.getNextNotification();
+ assertThat(postParcelNotification).isEqualTo(expectedEntries.get(i));
+ }
+ }
+}
diff --git a/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java b/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java
new file mode 100644
index 0000000..1b5ad88
--- /dev/null
+++ b/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package android.app.timedetector;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.TimestampedValue;
+
+import org.junit.Test;
+
+public class PhoneTimeSuggestionTest {
+ private static final int PHONE_ID = 99999;
+
+ @Test
+ public void testEquals() {
+ PhoneTimeSuggestion one =
+ new PhoneTimeSuggestion(PHONE_ID, new TimestampedValue<>(1111L, 2222L));
+ assertEquals(one, one);
+
+ PhoneTimeSuggestion two =
+ new PhoneTimeSuggestion(PHONE_ID, new TimestampedValue<>(1111L, 2222L));
+ assertEquals(one, two);
+ assertEquals(two, one);
+
+ PhoneTimeSuggestion three =
+ new PhoneTimeSuggestion(PHONE_ID + 1, new TimestampedValue<>(1111L, 2222L));
+ assertNotEquals(one, three);
+ assertNotEquals(three, one);
+
+ // DebugInfo must not be considered in equals().
+ one.addDebugInfo("Debug info 1");
+ two.addDebugInfo("Debug info 2");
+ assertEquals(one, two);
+ }
+
+ @Test
+ public void testParcelable() {
+ PhoneTimeSuggestion one =
+ new PhoneTimeSuggestion(PHONE_ID, new TimestampedValue<>(1111L, 2222L));
+ assertEquals(one, roundTripParcelable(one));
+
+ // DebugInfo should also be stored (but is not checked by equals()
+ one.addDebugInfo("This is debug info");
+ PhoneTimeSuggestion two = roundTripParcelable(one);
+ assertEquals(one.getDebugInfo(), two.getDebugInfo());
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends Parcelable> T roundTripParcelable(T one) {
+ Parcel parcel = Parcel.obtain();
+ parcel.writeTypedObject(one, 0);
+ parcel.setDataPosition(0);
+
+ T toReturn = (T) parcel.readTypedObject(PhoneTimeSuggestion.CREATOR);
+ parcel.recycle();
+ return toReturn;
+ }
+}
diff --git a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java
deleted file mode 100644
index f6527da..0000000
--- a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2012 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.content.pm;
-
-import android.net.Uri;
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-
-import androidx.test.filters.LargeTest;
-
-/**
- * Tests the android.content.pm.VerificationParams class
- *
- * To test run:
- * ./development/testrunner/runtest.py frameworks-core -c android.content.pm.VerificationParamsTest
- */
-@LargeTest
-public class VerificationParamsTest extends AndroidTestCase {
-
- private final static String VERIFICATION_URI_STRING = "http://verification.uri/path";
- private final static String ORIGINATING_URI_STRING = "http://originating.uri/path";
- private final static String REFERRER_STRING = "http://referrer.uri/path";
- private final static int INSTALLER_UID = 42;
-
- private final static Uri VERIFICATION_URI = Uri.parse(VERIFICATION_URI_STRING);
- private final static Uri ORIGINATING_URI = Uri.parse(ORIGINATING_URI_STRING);
- private final static Uri REFERRER = Uri.parse(REFERRER_STRING);
-
- private final static int ORIGINATING_UID = 10042;
-
- public void testParcel() throws Exception {
- VerificationParams expected = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- Parcel parcel = Parcel.obtain();
- expected.writeToParcel(parcel, 0);
- parcel.setDataPosition(0);
-
- VerificationParams actual = VerificationParams.CREATOR.createFromParcel(parcel);
-
- assertEquals(VERIFICATION_URI, actual.getVerificationURI());
-
- assertEquals(ORIGINATING_URI, actual.getOriginatingURI());
-
- assertEquals(REFERRER, actual.getReferrer());
-
- assertEquals(ORIGINATING_UID, actual.getOriginatingUid());
- }
-
- public void testEquals_Success() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
-
- assertEquals(params1, params2);
- }
-
- public void testEquals_VerificationUri_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse("http://a.different.uri/"), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
-
- assertFalse(params1.equals(params2));
- }
-
- public void testEquals_OriginatingUri_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse("http://a.different.uri/"),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
-
- assertFalse(params1.equals(params2));
- }
-
- public void testEquals_Referrer_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse("http://a.different.uri/"), ORIGINATING_UID);
-
- assertFalse(params1.equals(params2));
- }
-
- public void testEquals_Originating_Uid_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), 12345);
-
- assertFalse(params1.equals(params2));
- }
-
- public void testEquals_InstallerUid_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
- params2.setInstallerUid(INSTALLER_UID);
-
- assertFalse(params1.equals(params2));
- }
-
- public void testHashCode_Success() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
-
- assertEquals(params1.hashCode(), params2.hashCode());
- }
-
- public void testHashCode_VerificationUri_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(null, Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
-
- assertFalse(params1.hashCode() == params2.hashCode());
- }
-
- public void testHashCode_OriginatingUri_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse("http://a.different.uri/"),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
-
- assertFalse(params1.hashCode() == params2.hashCode());
- }
-
- public void testHashCode_Referrer_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), null,
- ORIGINATING_UID);
-
- assertFalse(params1.hashCode() == params2.hashCode());
- }
-
- public void testHashCode_Originating_Uid_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), 12345);
-
- assertFalse(params1.hashCode() == params2.hashCode());
- }
-
- public void testHashCode_InstallerUid_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID);
- params2.setInstallerUid(INSTALLER_UID);
-
- assertFalse(params1.hashCode() == params2.hashCode());
- }
-}
diff --git a/core/tests/coretests/src/android/graphics/TypefaceEqualsTest.java b/core/tests/coretests/src/android/graphics/TypefaceEqualsTest.java
new file mode 100644
index 0000000..6ae7eb7
--- /dev/null
+++ b/core/tests/coretests/src/android/graphics/TypefaceEqualsTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 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.graphics;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.content.res.AssetManager;
+import android.graphics.fonts.Font;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.IOException;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class TypefaceEqualsTest {
+ @Test
+ public void testFontEqualWithLocale() throws IOException {
+ final AssetManager am =
+ InstrumentationRegistry.getInstrumentation().getContext().getAssets();
+
+ Font masterFont = new Font.Builder(am, "fonts/a3em.ttf").build();
+
+ Font jaFont = new Font.Builder(masterFont.getBuffer(), new File("fonts/a3em.ttf"), "ja")
+ .build();
+ Font jaFont2 = new Font.Builder(masterFont.getBuffer(), new File("fonts/a3em.ttf"), "ja")
+ .build();
+ Font koFont = new Font.Builder(masterFont.getBuffer(), new File("fonts/a3em.ttf"), "ko")
+ .build();
+
+ assertEquals(jaFont, jaFont2);
+ assertNotEquals(jaFont, koFont);
+ assertNotEquals(jaFont, masterFont);
+ }
+}
diff --git a/core/tests/coretests/src/android/provider/DeviceConfigTest.java b/core/tests/coretests/src/android/provider/DeviceConfigTest.java
index 77b7f2a..1f2dfe0 100644
--- a/core/tests/coretests/src/android/provider/DeviceConfigTest.java
+++ b/core/tests/coretests/src/android/provider/DeviceConfigTest.java
@@ -16,12 +16,10 @@
package android.provider;
-import static android.provider.DeviceConfig.OnPropertiesChangedListener;
import static android.provider.DeviceConfig.Properties;
import static com.google.common.truth.Truth.assertThat;
-import android.app.ActivityThread;
import android.content.ContentResolver;
import android.os.Bundle;
import android.platform.test.annotations.Presubmit;
@@ -35,9 +33,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
/** Tests that ensure appropriate settings are backed up. */
@Presubmit
@RunWith(AndroidJUnit4.class)
@@ -482,29 +477,30 @@
assertThat(properties.getString(KEY3, DEFAULT_VALUE)).isEqualTo(DEFAULT_VALUE);
}
- @Test
- public void testOnPropertiesChangedListener() throws InterruptedException {
- final CountDownLatch countDownLatch = new CountDownLatch(1);
-
- OnPropertiesChangedListener changeListener = (properties) -> {
- assertThat(properties.getNamespace()).isEqualTo(NAMESPACE);
- assertThat(properties.getKeyset()).contains(KEY);
- assertThat(properties.getString(KEY, "default_value")).isEqualTo(VALUE);
- countDownLatch.countDown();
- };
-
- try {
- DeviceConfig.addOnPropertiesChangedListener(NAMESPACE,
- ActivityThread.currentApplication().getMainExecutor(), changeListener);
- DeviceConfig.setProperty(NAMESPACE, KEY, VALUE, false);
- assertThat(countDownLatch.await(
- WAIT_FOR_PROPERTY_CHANGE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)).isTrue();
- } catch (InterruptedException e) {
- Assert.fail(e.getMessage());
- } finally {
- DeviceConfig.removeOnPropertiesChangedListener(changeListener);
- }
- }
+ // TODO(mpape): resolve b/142727848 and re-enable this test
+// @Test
+// public void testOnPropertiesChangedListener() throws InterruptedException {
+// final CountDownLatch countDownLatch = new CountDownLatch(1);
+//
+// OnPropertiesChangedListener changeListener = (properties) -> {
+// assertThat(properties.getNamespace()).isEqualTo(NAMESPACE);
+// assertThat(properties.getKeyset()).contains(KEY);
+// assertThat(properties.getString(KEY, "default_value")).isEqualTo(VALUE);
+// countDownLatch.countDown();
+// };
+//
+// try {
+// DeviceConfig.addOnPropertiesChangedListener(NAMESPACE,
+// ActivityThread.currentApplication().getMainExecutor(), changeListener);
+// DeviceConfig.setProperty(NAMESPACE, KEY, VALUE, false);
+// assertThat(countDownLatch.await(
+// WAIT_FOR_PROPERTY_CHANGE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)).isTrue();
+// } catch (InterruptedException e) {
+// Assert.fail(e.getMessage());
+// } finally {
+// DeviceConfig.removeOnPropertiesChangedListener(changeListener);
+// }
+// }
private static boolean deleteViaContentProvider(String namespace, String key) {
ContentResolver resolver = InstrumentationRegistry.getContext().getContentResolver();
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
index 5ea91da9..d427cbd 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
@@ -24,12 +24,12 @@
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
-import static com.android.internal.app.ChooserActivity.CALLER_TARGET_SCORE_BOOST;
-import static com.android.internal.app.ChooserActivity.SHORTCUT_TARGET_SCORE_BOOST;
import static com.android.internal.app.ChooserActivity.TARGET_TYPE_CHOOSER_TARGET;
import static com.android.internal.app.ChooserActivity.TARGET_TYPE_DEFAULT;
import static com.android.internal.app.ChooserActivity.TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE;
import static com.android.internal.app.ChooserActivity.TARGET_TYPE_SHORTCUTS_FROM_SHORTCUT_MANAGER;
+import static com.android.internal.app.ChooserListAdapter.CALLER_TARGET_SCORE_BOOST;
+import static com.android.internal.app.ChooserListAdapter.SHORTCUT_TARGET_SCORE_BOOST;
import static com.android.internal.app.ChooserWrapperActivity.sOverrides;
import static org.hamcrest.CoreMatchers.is;
@@ -69,6 +69,7 @@
import com.android.internal.R;
import com.android.internal.app.ResolverActivity.ResolvedComponentInfo;
+import com.android.internal.app.chooser.DisplayResolveInfo;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -819,17 +820,18 @@
when(sOverrides.resolverListController.getResolversForIntent(Mockito.anyBoolean(),
Mockito.anyBoolean(),
Mockito.isA(List.class))).thenReturn(resolvedComponentInfos);
- when(sOverrides.resolverListController.getScore(Mockito.isA(
- ResolverActivity.DisplayResolveInfo.class))).thenReturn(testBaseScore);
+ when(sOverrides.resolverListController.getScore(Mockito.isA(DisplayResolveInfo.class)))
+ .thenReturn(testBaseScore);
final ChooserWrapperActivity activity = mActivityRule
.launchActivity(Intent.createChooser(sendIntent, null));
waitForIdle();
- final ResolverActivity.DisplayResolveInfo testDri =
+ final DisplayResolveInfo testDri =
activity.createTestDisplayResolveInfo(sendIntent,
- ResolverDataProvider.createResolveInfo(3, 0), "testLabel", "testInfo", sendIntent);
- final ChooserActivity.ChooserListAdapter adapter = activity.getAdapter();
+ ResolverDataProvider.createResolveInfo(3, 0), "testLabel", "testInfo", sendIntent,
+ /* resolveInfoPresentationGetter */ null);
+ final ChooserListAdapter adapter = activity.getAdapter();
assertThat(adapter.getBaseScore(null, 0), is(CALLER_TARGET_SCORE_BOOST));
assertThat(adapter.getBaseScore(testDri, TARGET_TYPE_DEFAULT), is(testBaseScore));
@@ -970,7 +972,8 @@
ri,
"testLabel",
"testInfo",
- sendIntent),
+ sendIntent,
+ /* resolveInfoPresentationGetter */ null),
serviceTargets,
TARGET_TYPE_CHOOSER_TARGET)
);
@@ -1036,7 +1039,8 @@
ri,
"testLabel",
"testInfo",
- sendIntent),
+ sendIntent,
+ /* resolveInfoPresentationGetter */ null),
serviceTargets,
TARGET_TYPE_CHOOSER_TARGET)
);
@@ -1097,7 +1101,8 @@
ri,
"testLabel",
"testInfo",
- sendIntent),
+ sendIntent,
+ /* resolveInfoPresentationGetter */ null),
serviceTargets,
TARGET_TYPE_CHOOSER_TARGET)
);
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java b/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java
index 1d567c7..03705d0 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java
@@ -18,6 +18,7 @@
import static org.mockito.Mockito.mock;
+import android.annotation.Nullable;
import android.app.usage.UsageStatsManager;
import android.content.ContentResolver;
import android.content.Context;
@@ -30,6 +31,9 @@
import android.net.Uri;
import android.util.Size;
+import com.android.internal.app.ResolverListAdapter.ResolveInfoPresentationGetter;
+import com.android.internal.app.chooser.DisplayResolveInfo;
+import com.android.internal.app.chooser.TargetInfo;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -64,7 +68,7 @@
}
@Override
- public void safelyStartActivity(TargetInfo cti) {
+ public void safelyStartActivity(com.android.internal.app.chooser.TargetInfo cti) {
if (sOverrides.onSafelyStartCallback != null &&
sOverrides.onSafelyStartCallback.apply(cti)) {
return;
@@ -133,8 +137,10 @@
}
public DisplayResolveInfo createTestDisplayResolveInfo(Intent originalIntent, ResolveInfo pri,
- CharSequence pLabel, CharSequence pInfo, Intent pOrigIntent) {
- return new DisplayResolveInfo(originalIntent, pri, pLabel, pInfo, pOrigIntent);
+ CharSequence pLabel, CharSequence pInfo, Intent replacementIntent,
+ @Nullable ResolveInfoPresentationGetter resolveInfoPresentationGetter) {
+ return new DisplayResolveInfo(originalIntent, pri, pLabel, pInfo, replacementIntent,
+ resolveInfoPresentationGetter);
}
/**
diff --git a/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java
index 453bddd..a401e21 100644
--- a/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java
@@ -38,14 +38,15 @@
import android.widget.RelativeLayout;
import androidx.test.InstrumentationRegistry;
+import androidx.test.espresso.Espresso;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.android.internal.R;
-import com.android.internal.app.ResolverActivity.ActivityInfoPresentationGetter;
-import com.android.internal.app.ResolverActivity.ResolveInfoPresentationGetter;
import com.android.internal.app.ResolverActivity.ResolvedComponentInfo;
import com.android.internal.app.ResolverDataProvider.PackageManagerMockedInfo;
+import com.android.internal.app.ResolverListAdapter.ActivityInfoPresentationGetter;
+import com.android.internal.app.ResolverListAdapter.ResolveInfoPresentationGetter;
import com.android.internal.widget.ResolverDrawerLayout;
import org.junit.Before;
@@ -82,6 +83,7 @@
Mockito.isA(List.class))).thenReturn(resolvedComponentInfos);
final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent);
+ Espresso.registerIdlingResources(activity.getAdapter().getLabelIdlingResource());
waitForIdle();
assertThat(activity.getAdapter().getCount(), is(2));
@@ -214,6 +216,7 @@
Mockito.isA(List.class))).thenReturn(resolvedComponentInfos);
final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent);
+ Espresso.registerIdlingResources(activity.getAdapter().getLabelIdlingResource());
waitForIdle();
// The other entry is filtered to the last used slot
@@ -251,6 +254,7 @@
Mockito.isA(List.class))).thenReturn(resolvedComponentInfos);
final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent);
+ Espresso.registerIdlingResources(activity.getAdapter().getLabelIdlingResource());
waitForIdle();
// The other entry is filtered to the other profile slot
@@ -296,6 +300,7 @@
.thenReturn(resolvedComponentInfos.get(1).getResolveInfoAt(0));
final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent);
+ Espresso.registerIdlingResources(activity.getAdapter().getLabelIdlingResource());
waitForIdle();
// The other entry is filtered to the other profile slot
diff --git a/core/tests/coretests/src/com/android/internal/app/ResolverListControllerTest.java b/core/tests/coretests/src/com/android/internal/app/ResolverListControllerTest.java
index 6218fa9..5ac1489 100644
--- a/core/tests/coretests/src/com/android/internal/app/ResolverListControllerTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ResolverListControllerTest.java
@@ -16,6 +16,8 @@
package com.android.internal.app;
+import static junit.framework.Assert.assertEquals;
+
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Matchers.any;
@@ -126,7 +128,7 @@
String annotation = "test_annotation";
Intent sendIntent = createSendImageIntent(annotation);
String refererPackage = "test_referer_package";
- List<ResolvedComponentInfo> resolvedComponents = createResolvedComponentsForTest(15);
+ List<ResolvedComponentInfo> resolvedComponents = createResolvedComponentsForTest(10);
mUsm = new UsageStatsManager(mMockContext, mMockService);
when(mMockContext.getSystemService(Context.USAGE_STATS_SERVICE)).thenReturn(mUsm);
mController = new ResolverListController(mMockContext, mMockPackageManager, sendIntent,
@@ -135,7 +137,18 @@
mController.topK(topKList, 5);
List<ResolvedComponentInfo> sortList = new ArrayList<>(topKList);
mController.sort(sortList);
- assertThat(sortList.subList(0, 5), is(topKList.subList(0, 5)));
+ assertEquals("Top k elements should be sorted when input size greater than k.",
+ sortList.subList(0, 5), topKList.subList(0, 5));
+ mController.topK(topKList, 10);
+ sortList = new ArrayList<>(topKList);
+ mController.sort(sortList);
+ assertEquals("All elements should be sorted when input size equals k.",
+ sortList, topKList);
+ mController.topK(topKList, 15);
+ sortList = new ArrayList<>(topKList);
+ mController.sort(sortList);
+ assertEquals("All elements should be sorted when input size less than k.",
+ sortList, topKList);
}
private UsageStats initStats(String packageName, String action,
diff --git a/core/tests/coretests/src/com/android/internal/app/ResolverWrapperActivity.java b/core/tests/coretests/src/com/android/internal/app/ResolverWrapperActivity.java
index 83f6bc2..39cc83c 100644
--- a/core/tests/coretests/src/com/android/internal/app/ResolverWrapperActivity.java
+++ b/core/tests/coretests/src/com/android/internal/app/ResolverWrapperActivity.java
@@ -19,8 +19,14 @@
import static org.mockito.Mockito.mock;
import android.app.usage.UsageStatsManager;
+import android.content.Context;
+import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import com.android.internal.app.chooser.TargetInfo;
+
+import java.util.List;
import java.util.function.Function;
/*
@@ -30,8 +36,16 @@
static final OverrideData sOverrides = new OverrideData();
private UsageStatsManager mUsm;
- ResolveListAdapter getAdapter() {
- return mAdapter;
+ @Override
+ public ResolverListAdapter createAdapter(Context context, List<Intent> payloadIntents,
+ Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed,
+ boolean useLayoutForBrowsables) {
+ return new ResolverWrapperAdapter(context, payloadIntents, initialIntents, rList,
+ filterLastUsed, createListController(), useLayoutForBrowsables, this);
+ }
+
+ ResolverWrapperAdapter getAdapter() {
+ return (ResolverWrapperAdapter) mAdapter;
}
@Override
diff --git a/core/tests/coretests/src/com/android/internal/app/ResolverWrapperAdapter.java b/core/tests/coretests/src/com/android/internal/app/ResolverWrapperAdapter.java
new file mode 100644
index 0000000..e41df418
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/app/ResolverWrapperAdapter.java
@@ -0,0 +1,71 @@
+/*
+ * 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.internal.app;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+
+import androidx.test.espresso.idling.CountingIdlingResource;
+
+import com.android.internal.app.chooser.DisplayResolveInfo;
+
+import java.util.List;
+
+public class ResolverWrapperAdapter extends ResolverListAdapter {
+
+ private CountingIdlingResource mLabelIdlingResource =
+ new CountingIdlingResource("LoadLabelTask");
+
+ public ResolverWrapperAdapter(Context context,
+ List<Intent> payloadIntents,
+ Intent[] initialIntents,
+ List<ResolveInfo> rList, boolean filterLastUsed,
+ ResolverListController resolverListController, boolean useLayoutForBrowsables,
+ ResolverListCommunicator resolverListCommunicator) {
+ super(context, payloadIntents, initialIntents, rList, filterLastUsed,
+ resolverListController,
+ useLayoutForBrowsables, resolverListCommunicator);
+ }
+
+ public CountingIdlingResource getLabelIdlingResource() {
+ return mLabelIdlingResource;
+ }
+
+ @Override
+ protected LoadLabelTask getLoadLabelTask(DisplayResolveInfo info, ViewHolder holder) {
+ return new LoadLabelWrapperTask(info, holder);
+ }
+
+ class LoadLabelWrapperTask extends LoadLabelTask {
+
+ protected LoadLabelWrapperTask(DisplayResolveInfo dri, ViewHolder holder) {
+ super(dri, holder);
+ }
+
+ @Override
+ protected void onPreExecute() {
+ mLabelIdlingResource.increment();
+ }
+
+ @Override
+ protected void onPostExecute(CharSequence[] result) {
+ super.onPostExecute(result);
+ mLabelIdlingResource.decrement();
+ }
+ }
+}
diff --git a/core/tests/coretests/src/com/android/internal/widget/LockscreenCredentialTest.java b/core/tests/coretests/src/com/android/internal/widget/LockscreenCredentialTest.java
index 5eec91c..05bab1c 100644
--- a/core/tests/coretests/src/com/android/internal/widget/LockscreenCredentialTest.java
+++ b/core/tests/coretests/src/com/android/internal/widget/LockscreenCredentialTest.java
@@ -31,10 +31,23 @@
assertEquals(0, empty.size());
assertNotNull(empty.getCredential());
+ assertFalse(empty.isPin());
assertFalse(empty.isPassword());
assertFalse(empty.isPattern());
}
+ public void testPinCredential() {
+ LockscreenCredential pin = LockscreenCredential.createPin("3456");
+
+ assertTrue(pin.isPin());
+ assertEquals(4, pin.size());
+ assertTrue(Arrays.equals("3456".getBytes(), pin.getCredential()));
+
+ assertFalse(pin.isNone());
+ assertFalse(pin.isPassword());
+ assertFalse(pin.isPattern());
+ }
+
public void testPasswordCredential() {
LockscreenCredential password = LockscreenCredential.createPassword("password");
@@ -43,6 +56,7 @@
assertTrue(Arrays.equals("password".getBytes(), password.getCredential()));
assertFalse(password.isNone());
+ assertFalse(password.isPin());
assertFalse(password.isPattern());
}
@@ -60,6 +74,7 @@
assertTrue(Arrays.equals("12369".getBytes(), pattern.getCredential()));
assertFalse(pattern.isNone());
+ assertFalse(pattern.isPin());
assertFalse(pattern.isPassword());
}
@@ -72,6 +87,15 @@
LockscreenCredential.createPasswordOrNone("abcd"));
}
+ public void testPinOrNoneCredential() {
+ assertEquals(LockscreenCredential.createNone(),
+ LockscreenCredential.createPinOrNone(null));
+ assertEquals(LockscreenCredential.createNone(),
+ LockscreenCredential.createPinOrNone(""));
+ assertEquals(LockscreenCredential.createPin("1357"),
+ LockscreenCredential.createPinOrNone("1357"));
+ }
+
public void testSanitize() {
LockscreenCredential password = LockscreenCredential.createPassword("password");
password.zeroize();
@@ -80,12 +104,15 @@
password.isNone();
fail("Sanitized credential still accessible");
} catch (IllegalStateException expected) { }
-
try {
password.isPattern();
fail("Sanitized credential still accessible");
} catch (IllegalStateException expected) { }
try {
+ password.isPin();
+ fail("Sanitized credential still accessible");
+ } catch (IllegalStateException expected) { }
+ try {
password.isPassword();
fail("Sanitized credential still accessible");
} catch (IllegalStateException expected) { }
diff --git a/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java b/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java
index 9913531..50e8474 100644
--- a/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java
+++ b/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java
@@ -62,7 +62,9 @@
Settings.Global.putInt(cr, Settings.Global.DEVICE_DEMO_MODE, deviceDemoMode);
final ILockSettings ils = Mockito.mock(ILockSettings.class);
- when(ils.havePassword(DEMO_USER_ID)).thenReturn(isSecure);
+ when(ils.getCredentialType(DEMO_USER_ID)).thenReturn(
+ isSecure ? LockPatternUtils.CREDENTIAL_TYPE_PASSWORD
+ : LockPatternUtils.CREDENTIAL_TYPE_NONE);
when(ils.getLong("lockscreen.password_type", PASSWORD_QUALITY_UNSPECIFIED, DEMO_USER_ID))
.thenReturn((long) PASSWORD_QUALITY_MANAGED);
// TODO(b/63758238): stop spying the class under test
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index ac742e2..a0215e1 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -370,6 +370,7 @@
<permission name="android.permission.LOCAL_MAC_ADDRESS"/>
<permission name="android.permission.MANAGE_USERS"/>
<permission name="android.permission.PACKAGE_USAGE_STATS"/>
+ <permission name="android.permission.READ_DEVICE_CONFIG"/>
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
<permission name="android.permission.REQUEST_NETWORK_SCORES"/>
<permission name="android.permission.WRITE_SECURE_SETTINGS"/>
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json
index 012ffcc..342259d 100644
--- a/data/etc/services.core.protolog.json
+++ b/data/etc/services.core.protolog.json
@@ -817,12 +817,6 @@
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/DisplayRotation.java"
},
- "-415912575": {
- "message": "setTask: %s at top.",
- "level": "VERBOSE",
- "group": "WM_DEBUG_ADD_REMOVE",
- "at": "com\/android\/server\/wm\/ActivityRecord.java"
- },
"-415865166": {
"message": "findFocusedWindow: Found new focus @ %s",
"level": "VERBOSE",
@@ -883,6 +877,12 @@
"group": "WM_DEBUG_ADD_REMOVE",
"at": "com\/android\/server\/wm\/WindowState.java"
},
+ "-303497363": {
+ "message": "reparent: moving activity=%s to task=%d at %d",
+ "level": "INFO",
+ "group": "WM_DEBUG_ADD_REMOVE",
+ "at": "com\/android\/server\/wm\/ActivityRecord.java"
+ },
"-253016819": {
"message": "applyAnimation: transition animation is disabled or skipped. atoken=%s",
"level": "VERBOSE",
@@ -1237,12 +1237,6 @@
"group": "WM_DEBUG_FOCUS_LIGHT",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
- "393054329": {
- "message": "reParentWindowToken: removing window token=%s from task=%s",
- "level": "INFO",
- "group": "WM_DEBUG_ADD_REMOVE",
- "at": "com\/android\/server\/wm\/ActivityRecord.java"
- },
"399841913": {
"message": "SURFACE RECOVER DESTROY: %s",
"level": "INFO",
@@ -1351,6 +1345,12 @@
"group": "WM_SHOW_TRANSACTIONS",
"at": "com\/android\/server\/wm\/Session.java"
},
+ "609651209": {
+ "message": "addChild: %s at top.",
+ "level": "VERBOSE",
+ "group": "WM_DEBUG_ADD_REMOVE",
+ "at": "com\/android\/server\/wm\/TaskRecord.java"
+ },
"620368427": {
"message": "******* TELLING SURFACE FLINGER WE ARE BOOTED!",
"level": "INFO",
@@ -1999,12 +1999,6 @@
"group": "WM_SHOW_TRANSACTIONS",
"at": "com\/android\/server\/wm\/WindowAnimator.java"
},
- "1995048598": {
- "message": "reparent: moving app token=%s to task=%d at %d",
- "level": "INFO",
- "group": "WM_DEBUG_ADD_REMOVE",
- "at": "com\/android\/server\/wm\/ActivityRecord.java"
- },
"2016061474": {
"message": "Prepare app transition: transit=%s %s alwaysKeepCurrent=%b displayId=%d Callers=%s",
"level": "VERBOSE",
diff --git a/graphics/java/android/graphics/fonts/Font.java b/graphics/java/android/graphics/fonts/Font.java
index 552088f..ba96a06 100644
--- a/graphics/java/android/graphics/fonts/Font.java
+++ b/graphics/java/android/graphics/fonts/Font.java
@@ -519,12 +519,13 @@
}
Font f = (Font) o;
return mFontStyle.equals(f.mFontStyle) && f.mTtcIndex == mTtcIndex
- && Arrays.equals(f.mAxes, mAxes) && f.mBuffer.equals(mBuffer);
+ && Arrays.equals(f.mAxes, mAxes) && f.mBuffer.equals(mBuffer)
+ && Objects.equals(f.mLocaleList, mLocaleList);
}
@Override
public int hashCode() {
- return Objects.hash(mFontStyle, mTtcIndex, Arrays.hashCode(mAxes), mBuffer);
+ return Objects.hash(mFontStyle, mTtcIndex, Arrays.hashCode(mAxes), mBuffer, mLocaleList);
}
@Override
diff --git a/keystore/java/android/security/Credentials.java b/keystore/java/android/security/Credentials.java
index 54995ac..f25910b 100644
--- a/keystore/java/android/security/Credentials.java
+++ b/keystore/java/android/security/Credentials.java
@@ -71,6 +71,15 @@
/** Key containing suffix of lockdown VPN profile. */
public static final String LOCKDOWN_VPN = "LOCKDOWN_VPN";
+ /** Name of CA certificate usage. */
+ public static final String CERTIFICATE_USAGE_CA = "ca";
+
+ /** Name of User certificate usage. */
+ public static final String CERTIFICATE_USAGE_USER = "user";
+
+ /** Name of WIFI certificate usage. */
+ public static final String CERTIFICATE_USAGE_WIFI = "wifi";
+
/** Data type for public keys. */
public static final String EXTRA_PUBLIC_KEY = "KEY";
@@ -91,6 +100,11 @@
public static final String EXTRA_INSTALL_AS_UID = "install_as_uid";
/**
+ * Intent extra: type of the certificate to install
+ */
+ public static final String EXTRA_CERTIFICATE_USAGE = "certificate_install_usage";
+
+ /**
* Intent extra: name for the user's key pair.
*/
public static final String EXTRA_USER_KEY_ALIAS = "user_key_pair_name";
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index 254456c..538319c 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -763,28 +763,33 @@
* @see KeyChain#bind
*/
public static class KeyChainConnection implements Closeable {
- private final Context context;
- private final ServiceConnection serviceConnection;
- private final IKeyChainService service;
+ private final Context mContext;
+ private final ServiceConnection mServiceConnection;
+ private final IKeyChainService mService;
protected KeyChainConnection(Context context,
ServiceConnection serviceConnection,
IKeyChainService service) {
- this.context = context;
- this.serviceConnection = serviceConnection;
- this.service = service;
+ this.mContext = context;
+ this.mServiceConnection = serviceConnection;
+ this.mService = service;
}
@Override public void close() {
- context.unbindService(serviceConnection);
+ mContext.unbindService(mServiceConnection);
}
+
+ /** returns the service binder. */
public IKeyChainService getService() {
- return service;
+ return mService;
}
}
/**
- * @hide for reuse by CertInstaller and Settings.
- *
+ * Bind to KeyChainService in the current user.
* Caller should call unbindService on the result when finished.
+ *
+ *@throws InterruptedException if interrupted during binding.
+ *@throws AssertionError if unable to bind to KeyChainService.
+ * @hide for reuse by CertInstaller and Settings.
*/
@WorkerThread
public static KeyChainConnection bind(@NonNull Context context) throws InterruptedException {
@@ -792,6 +797,11 @@
}
/**
+ * Bind to KeyChainService in the target user.
+ * Caller should call unbindService on the result when finished.
+ *
+ * @throws InterruptedException if interrupted during binding.
+ * @throws AssertionError if unable to bind to KeyChainService.
* @hide
*/
@WorkerThread
@@ -814,6 +824,16 @@
}
}
}
+ @Override public void onBindingDied(ComponentName name) {
+ if (!mConnectedAtLeastOnce) {
+ mConnectedAtLeastOnce = true;
+ try {
+ q.put(null);
+ } catch (InterruptedException e) {
+ // will never happen, since the queue starts with one available slot
+ }
+ }
+ }
@Override public void onServiceDisconnected(ComponentName name) {}
};
Intent intent = new Intent(IKeyChainService.class.getName());
@@ -823,7 +843,13 @@
intent, keyChainServiceConnection, Context.BIND_AUTO_CREATE, user)) {
throw new AssertionError("could not bind to KeyChainService");
}
- return new KeyChainConnection(context, keyChainServiceConnection, q.take());
+ IKeyChainService service = q.take();
+ if (service != null) {
+ return new KeyChainConnection(context, keyChainServiceConnection, service);
+ } else {
+ context.unbindService(keyChainServiceConnection);
+ throw new AssertionError("KeyChainService died while binding");
+ }
}
private static void ensureNotOnMainThread(@NonNull Context context) {
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 61b72cf..2041e7a 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -221,7 +221,6 @@
"pipeline/skia/SkiaPipeline.cpp",
"pipeline/skia/SkiaProfileRenderer.cpp",
"pipeline/skia/SkiaVulkanPipeline.cpp",
- "pipeline/skia/VectorDrawableAtlas.cpp",
"pipeline/skia/VkFunctorDrawable.cpp",
"pipeline/skia/VkInteropFunctorDrawable.cpp",
"renderstate/RenderState.cpp",
@@ -347,7 +346,6 @@
"tests/unit/ThreadBaseTests.cpp",
"tests/unit/TypefaceTests.cpp",
"tests/unit/VectorDrawableTests.cpp",
- "tests/unit/VectorDrawableAtlasTests.cpp",
"tests/unit/WebViewFunctorManagerTests.cpp",
],
}
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp
index 61403aa..217b0c4 100644
--- a/libs/hwui/VectorDrawable.cpp
+++ b/libs/hwui/VectorDrawable.cpp
@@ -496,87 +496,6 @@
return *mCache.bitmap;
}
-void Tree::updateCache(sp<skiapipeline::VectorDrawableAtlas>& atlas, GrContext* context) {
-#ifdef __ANDROID__ // Layoutlib does not support hardware acceleration
- SkRect dst;
- sk_sp<SkSurface> surface = mCache.getSurface(&dst);
- bool canReuseSurface = surface && dst.width() >= mProperties.getScaledWidth() &&
- dst.height() >= mProperties.getScaledHeight();
- if (!canReuseSurface) {
- int scaledWidth = SkScalarCeilToInt(mProperties.getScaledWidth());
- int scaledHeight = SkScalarCeilToInt(mProperties.getScaledHeight());
- auto atlasEntry = atlas->requestNewEntry(scaledWidth, scaledHeight, context);
- if (INVALID_ATLAS_KEY != atlasEntry.key) {
- dst = atlasEntry.rect;
- surface = atlasEntry.surface;
- mCache.setAtlas(atlas, atlasEntry.key);
- } else {
- // don't draw, if we failed to allocate an offscreen buffer
- mCache.clear();
- surface.reset();
- }
- }
- if (!canReuseSurface || mCache.dirty) {
- if (surface) {
- Bitmap& bitmap = getBitmapUpdateIfDirty();
- SkBitmap skiaBitmap;
- bitmap.getSkBitmap(&skiaBitmap);
- surface->writePixels(skiaBitmap, dst.fLeft, dst.fTop);
- }
- mCache.dirty = false;
- }
-#endif
-}
-
-void Tree::Cache::setAtlas(sp<skiapipeline::VectorDrawableAtlas> newAtlas,
- skiapipeline::AtlasKey newAtlasKey) {
- LOG_ALWAYS_FATAL_IF(newAtlasKey == INVALID_ATLAS_KEY);
- clear();
- mAtlas = newAtlas;
- mAtlasKey = newAtlasKey;
-}
-
-sk_sp<SkSurface> Tree::Cache::getSurface(SkRect* bounds) {
- sk_sp<SkSurface> surface;
-#ifdef __ANDROID__ // Layoutlib does not support hardware acceleration
- sp<skiapipeline::VectorDrawableAtlas> atlas = mAtlas.promote();
- if (atlas.get() && mAtlasKey != INVALID_ATLAS_KEY) {
- auto atlasEntry = atlas->getEntry(mAtlasKey);
- *bounds = atlasEntry.rect;
- surface = atlasEntry.surface;
- mAtlasKey = atlasEntry.key;
- }
-#endif
-
- return surface;
-}
-
-void Tree::Cache::clear() {
-#ifdef __ANDROID__ // Layoutlib does not support hardware acceleration
- if (mAtlasKey != INVALID_ATLAS_KEY) {
- if (renderthread::RenderThread::isCurrent()) {
- sp<skiapipeline::VectorDrawableAtlas> lockAtlas = mAtlas.promote();
- if (lockAtlas.get()) {
- lockAtlas->releaseEntry(mAtlasKey);
- }
- } else {
- // VectorDrawableAtlas can be accessed only on RenderThread.
- // Use by-copy capture of the current Cache variables, because "this" may not be valid
- // by the time the lambda is evaluated on RenderThread.
- renderthread::RenderThread::getInstance().queue().post(
- [atlas = mAtlas, atlasKey = mAtlasKey]() {
- sp<skiapipeline::VectorDrawableAtlas> lockAtlas = atlas.promote();
- if (lockAtlas.get()) {
- lockAtlas->releaseEntry(atlasKey);
- }
- });
- }
- mAtlasKey = INVALID_ATLAS_KEY;
- }
- mAtlas = nullptr;
-#endif
-}
-
void Tree::draw(SkCanvas* canvas, const SkRect& bounds, const SkPaint& inPaint) {
if (canvas->quickReject(bounds)) {
// The RenderNode is on screen, but the AVD is not.
@@ -587,39 +506,14 @@
SkPaint paint = inPaint;
paint.setAlpha(mProperties.getRootAlpha() * 255);
- if (canvas->getGrContext() == nullptr) {
- // Recording to picture, don't use the SkSurface which won't work off of renderthread.
- Bitmap& bitmap = getBitmapUpdateIfDirty();
- SkBitmap skiaBitmap;
- bitmap.getSkBitmap(&skiaBitmap);
+ Bitmap& bitmap = getBitmapUpdateIfDirty();
+ SkBitmap skiaBitmap;
+ bitmap.getSkBitmap(&skiaBitmap);
- int scaledWidth = SkScalarCeilToInt(mProperties.getScaledWidth());
- int scaledHeight = SkScalarCeilToInt(mProperties.getScaledHeight());
- canvas->drawBitmapRect(skiaBitmap, SkRect::MakeWH(scaledWidth, scaledHeight), bounds,
- &paint, SkCanvas::kFast_SrcRectConstraint);
- return;
- }
-
- SkRect src;
- sk_sp<SkSurface> vdSurface = mCache.getSurface(&src);
- if (vdSurface) {
- canvas->drawImageRect(vdSurface->makeImageSnapshot().get(), src, bounds, &paint,
- SkCanvas::kFast_SrcRectConstraint);
- } else {
- // Handle the case when VectorDrawableAtlas has been destroyed, because of memory pressure.
- // We render the VD into a temporary standalone buffer and mark the frame as dirty. Next
- // frame will be cached into the atlas.
- Bitmap& bitmap = getBitmapUpdateIfDirty();
- SkBitmap skiaBitmap;
- bitmap.getSkBitmap(&skiaBitmap);
-
- int scaledWidth = SkScalarCeilToInt(mProperties.getScaledWidth());
- int scaledHeight = SkScalarCeilToInt(mProperties.getScaledHeight());
- canvas->drawBitmapRect(skiaBitmap, SkRect::MakeWH(scaledWidth, scaledHeight), bounds,
- &paint, SkCanvas::kFast_SrcRectConstraint);
- mCache.clear();
- markDirty();
- }
+ int scaledWidth = SkScalarCeilToInt(mProperties.getScaledWidth());
+ int scaledHeight = SkScalarCeilToInt(mProperties.getScaledHeight());
+ canvas->drawBitmapRect(skiaBitmap, SkRect::MakeWH(scaledWidth, scaledHeight), bounds,
+ &paint, SkCanvas::kFast_SrcRectConstraint);
}
void Tree::updateBitmapCache(Bitmap& bitmap, bool useStagingData) {
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h
index 9c0bb16..e1b6f2a 100644
--- a/libs/hwui/VectorDrawable.h
+++ b/libs/hwui/VectorDrawable.h
@@ -651,46 +651,13 @@
void getPaintFor(SkPaint* outPaint, const TreeProperties &props) const;
BitmapPalette computePalette();
- /**
- * Draws VD into a GPU backed surface.
- * This should always be called from RT and it works with Skia pipeline only.
- */
- void updateCache(sp<skiapipeline::VectorDrawableAtlas>& atlas, GrContext* context);
-
void setAntiAlias(bool aa) { mRootNode->setAntiAlias(aa); }
private:
class Cache {
public:
sk_sp<Bitmap> bitmap; // used by HWUI pipeline and software
- // TODO: use surface instead of bitmap when drawing in software canvas
bool dirty = true;
-
- // the rest of the code in Cache is used by Skia pipelines only
-
- ~Cache() { clear(); }
-
- /**
- * Stores a weak pointer to the atlas and a key.
- */
- void setAtlas(sp<skiapipeline::VectorDrawableAtlas> atlas,
- skiapipeline::AtlasKey newAtlasKey);
-
- /**
- * Gets a surface and bounds from the atlas.
- *
- * @return nullptr if the altas has been deleted.
- */
- sk_sp<SkSurface> getSurface(SkRect* bounds);
-
- /**
- * Releases atlas key from the atlas, which makes it available for reuse.
- */
- void clear();
-
- private:
- wp<skiapipeline::VectorDrawableAtlas> mAtlas;
- skiapipeline::AtlasKey mAtlasKey = INVALID_ATLAS_KEY;
};
bool allocateBitmapIfNeeded(Cache& cache, int width, int height);
diff --git a/libs/hwui/pipeline/skia/SkiaDisplayList.cpp b/libs/hwui/pipeline/skia/SkiaDisplayList.cpp
index d7076d4..158c349 100644
--- a/libs/hwui/pipeline/skia/SkiaDisplayList.cpp
+++ b/libs/hwui/pipeline/skia/SkiaDisplayList.cpp
@@ -150,12 +150,7 @@
const SkRect& bounds = vectorDrawable->properties().getBounds();
if (intersects(info.screenSize, totalMatrix, bounds)) {
isDirty = true;
-#ifdef __ANDROID__ // Layoutlib does not support CanvasContext
- static_cast<SkiaPipeline*>(info.canvasContext.getRenderPipeline())
- ->getVectorDrawables()
- ->push_back(vectorDrawable);
vectorDrawable->setPropertyChangeWillBeConsumed(true);
-#endif
}
}
}
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index 3010206..87ef7fc 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -43,7 +43,6 @@
namespace skiapipeline {
SkiaPipeline::SkiaPipeline(RenderThread& thread) : mRenderThread(thread) {
- mVectorDrawables.reserve(30);
}
SkiaPipeline::~SkiaPipeline() {
@@ -73,18 +72,11 @@
mPinnedImages.clear();
}
-void SkiaPipeline::onPrepareTree() {
- // The only time mVectorDrawables is not empty is if prepare tree was called 2 times without
- // a renderFrame in the middle.
- mVectorDrawables.clear();
-}
-
void SkiaPipeline::renderLayers(const LightGeometry& lightGeometry,
LayerUpdateQueue* layerUpdateQueue, bool opaque,
const LightInfo& lightInfo) {
LightingInfo::updateLighting(lightGeometry, lightInfo);
ATRACE_NAME("draw layers");
- renderVectorDrawableCache();
renderLayersImpl(*layerUpdateQueue, opaque);
layerUpdateQueue->clear();
}
@@ -213,19 +205,6 @@
}
}
-void SkiaPipeline::renderVectorDrawableCache() {
- if (!mVectorDrawables.empty()) {
- sp<VectorDrawableAtlas> atlas = mRenderThread.cacheManager().acquireVectorDrawableAtlas();
- auto grContext = mRenderThread.getGrContext();
- atlas->prepareForDraw(grContext);
- ATRACE_NAME("Update VectorDrawables");
- for (auto vd : mVectorDrawables) {
- vd->updateCache(atlas, grContext);
- }
- mVectorDrawables.clear();
- }
-}
-
static void savePictureAsync(const sk_sp<SkData>& data, const std::string& filename) {
CommonPool::post([data, filename] {
if (0 == access(filename.c_str(), F_OK)) {
@@ -380,8 +359,6 @@
Properties::skpCaptureEnabled = true;
}
- renderVectorDrawableCache();
-
// draw all layers up front
renderLayersImpl(layers, opaque);
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.h b/libs/hwui/pipeline/skia/SkiaPipeline.h
index 37b559f..215ff36 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.h
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.h
@@ -41,7 +41,6 @@
bool pinImages(std::vector<SkImage*>& mutableImages) override;
bool pinImages(LsaVector<sk_sp<Bitmap>>& images) override { return false; }
void unpinImages() override;
- void onPrepareTree() override;
void renderLayers(const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue,
bool opaque, const LightInfo& lightInfo) override;
@@ -57,8 +56,6 @@
const Rect& contentDrawBounds, sk_sp<SkSurface> surface,
const SkMatrix& preTransform);
- std::vector<VectorDrawableRoot*>* getVectorDrawables() { return &mVectorDrawables; }
-
static void prepareToDraw(const renderthread::RenderThread& thread, Bitmap* bitmap);
void renderLayersImpl(const LayerUpdateQueue& layers, bool opaque);
@@ -93,11 +90,6 @@
const std::vector<sp<RenderNode>>& nodes, const Rect& contentDrawBounds,
sk_sp<SkSurface> surface, const SkMatrix& preTransform);
- /**
- * Render mVectorDrawables into offscreen buffers.
- */
- void renderVectorDrawableCache();
-
// Called every frame. Normally returns early with screen canvas.
// But when capture is enabled, returns an nwaycanvas where commands are also recorded.
SkCanvas* tryCapture(SkSurface* surface);
@@ -113,11 +105,6 @@
std::vector<sk_sp<SkImage>> mPinnedImages;
- /**
- * populated by prepareTree with dirty VDs
- */
- std::vector<VectorDrawableRoot*> mVectorDrawables;
-
// Block of properties used only for debugging to record a SkPicture and save it in a file.
// There are three possible ways of recording drawing commands.
enum class CaptureMode {
diff --git a/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp b/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp
deleted file mode 100644
index e783f38..0000000
--- a/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "VectorDrawableAtlas.h"
-
-#include <GrRectanizer_pow2.h>
-#include <SkCanvas.h>
-#include <cmath>
-#include "renderthread/RenderProxy.h"
-#include "renderthread/RenderThread.h"
-#include "utils/TraceUtils.h"
-
-namespace android {
-namespace uirenderer {
-namespace skiapipeline {
-
-VectorDrawableAtlas::VectorDrawableAtlas(size_t surfaceArea, StorageMode storageMode)
- : mWidth((int)std::sqrt(surfaceArea))
- , mHeight((int)std::sqrt(surfaceArea))
- , mStorageMode(storageMode) {}
-
-void VectorDrawableAtlas::prepareForDraw(GrContext* context) {
- if (StorageMode::allowSharedSurface == mStorageMode) {
- if (!mSurface) {
- mSurface = createSurface(mWidth, mHeight, context);
- mRectanizer = std::make_unique<GrRectanizerPow2>(mWidth, mHeight);
- mPixelUsedByVDs = 0;
- mPixelAllocated = 0;
- mConsecutiveFailures = 0;
- mFreeRects.clear();
- } else {
- if (isFragmented()) {
- // Invoke repack outside renderFrame to avoid jank.
- renderthread::RenderProxy::repackVectorDrawableAtlas();
- }
- }
- }
-}
-
-#define MAX_CONSECUTIVE_FAILURES 5
-#define MAX_UNUSED_RATIO 2.0f
-
-bool VectorDrawableAtlas::isFragmented() {
- return mConsecutiveFailures > MAX_CONSECUTIVE_FAILURES &&
- mPixelUsedByVDs * MAX_UNUSED_RATIO < mPixelAllocated;
-}
-
-void VectorDrawableAtlas::repackIfNeeded(GrContext* context) {
- // We repackage when atlas failed to allocate space MAX_CONSECUTIVE_FAILURES consecutive
- // times and the atlas allocated pixels are at least MAX_UNUSED_RATIO times higher than pixels
- // used by atlas VDs.
- if (isFragmented() && mSurface) {
- repack(context);
- }
-}
-
-// compare to CacheEntry objects based on VD area.
-bool VectorDrawableAtlas::compareCacheEntry(const CacheEntry& first, const CacheEntry& second) {
- return first.VDrect.width() * first.VDrect.height() <
- second.VDrect.width() * second.VDrect.height();
-}
-
-void VectorDrawableAtlas::repack(GrContext* context) {
- ATRACE_CALL();
- sk_sp<SkSurface> newSurface;
- SkCanvas* canvas = nullptr;
- if (StorageMode::allowSharedSurface == mStorageMode) {
- newSurface = createSurface(mWidth, mHeight, context);
- if (!newSurface) {
- return;
- }
- canvas = newSurface->getCanvas();
- canvas->clear(SK_ColorTRANSPARENT);
- mRectanizer = std::make_unique<GrRectanizerPow2>(mWidth, mHeight);
- } else {
- if (!mSurface) {
- return; // nothing to repack
- }
- mRectanizer.reset();
- }
- mFreeRects.clear();
- SkImage* sourceImageAtlas = nullptr;
- if (mSurface) {
- sourceImageAtlas = mSurface->makeImageSnapshot().get();
- }
-
- // Sort the list by VD size, which allows for the smallest VDs to get first in the atlas.
- // Sorting is safe, because it does not affect iterator validity.
- if (mRects.size() <= 100) {
- mRects.sort(compareCacheEntry);
- }
-
- for (CacheEntry& entry : mRects) {
- SkRect currentVDRect = entry.VDrect;
- SkImage* sourceImage; // copy either from the atlas or from a standalone surface
- if (entry.surface) {
- if (!fitInAtlas(currentVDRect.width(), currentVDRect.height())) {
- continue; // don't even try to repack huge VD
- }
- sourceImage = entry.surface->makeImageSnapshot().get();
- } else {
- sourceImage = sourceImageAtlas;
- }
- size_t VDRectArea = currentVDRect.width() * currentVDRect.height();
- SkIPoint16 pos;
- if (canvas && mRectanizer->addRect(currentVDRect.width(), currentVDRect.height(), &pos)) {
- SkRect newRect =
- SkRect::MakeXYWH(pos.fX, pos.fY, currentVDRect.width(), currentVDRect.height());
- canvas->drawImageRect(sourceImage, currentVDRect, newRect, nullptr);
- entry.VDrect = newRect;
- entry.rect = newRect;
- if (entry.surface) {
- // A rectangle moved from a standalone surface to the atlas.
- entry.surface = nullptr;
- mPixelUsedByVDs += VDRectArea;
- }
- } else {
- // Repack failed for this item. If it is not already, store it in a standalone
- // surface.
- if (!entry.surface) {
- // A rectangle moved from an atlas to a standalone surface.
- mPixelUsedByVDs -= VDRectArea;
- SkRect newRect = SkRect::MakeWH(currentVDRect.width(), currentVDRect.height());
- entry.surface = createSurface(newRect.width(), newRect.height(), context);
- auto tempCanvas = entry.surface->getCanvas();
- tempCanvas->clear(SK_ColorTRANSPARENT);
- tempCanvas->drawImageRect(sourceImageAtlas, currentVDRect, newRect, nullptr);
- entry.VDrect = newRect;
- entry.rect = newRect;
- }
- }
- }
- mPixelAllocated = mPixelUsedByVDs;
- context->flush();
- mSurface = newSurface;
- mConsecutiveFailures = 0;
-}
-
-AtlasEntry VectorDrawableAtlas::requestNewEntry(int width, int height, GrContext* context) {
- AtlasEntry result;
- if (width <= 0 || height <= 0) {
- return result;
- }
-
- if (mSurface) {
- const size_t area = width * height;
-
- // Use a rectanizer to allocate unused space from the atlas surface.
- bool notTooBig = fitInAtlas(width, height);
- SkIPoint16 pos;
- if (notTooBig && mRectanizer->addRect(width, height, &pos)) {
- mPixelUsedByVDs += area;
- mPixelAllocated += area;
- result.rect = SkRect::MakeXYWH(pos.fX, pos.fY, width, height);
- result.surface = mSurface;
- auto eraseIt = mRects.emplace(mRects.end(), result.rect, result.rect, nullptr);
- CacheEntry* entry = &(*eraseIt);
- entry->eraseIt = eraseIt;
- result.key = reinterpret_cast<AtlasKey>(entry);
- mConsecutiveFailures = 0;
- return result;
- }
-
- // Try to reuse atlas memory from rectangles freed by "releaseEntry".
- auto freeRectIt = mFreeRects.lower_bound(area);
- while (freeRectIt != mFreeRects.end()) {
- SkRect& freeRect = freeRectIt->second;
- if (freeRect.width() >= width && freeRect.height() >= height) {
- result.rect = SkRect::MakeXYWH(freeRect.fLeft, freeRect.fTop, width, height);
- result.surface = mSurface;
- auto eraseIt = mRects.emplace(mRects.end(), result.rect, freeRect, nullptr);
- CacheEntry* entry = &(*eraseIt);
- entry->eraseIt = eraseIt;
- result.key = reinterpret_cast<AtlasKey>(entry);
- mPixelUsedByVDs += area;
- mFreeRects.erase(freeRectIt);
- mConsecutiveFailures = 0;
- return result;
- }
- freeRectIt++;
- }
-
- if (notTooBig && mConsecutiveFailures <= MAX_CONSECUTIVE_FAILURES) {
- mConsecutiveFailures++;
- }
- }
-
- // Allocate a surface for a rectangle that is too big or if atlas is full.
- if (nullptr != context) {
- result.rect = SkRect::MakeWH(width, height);
- result.surface = createSurface(width, height, context);
- auto eraseIt = mRects.emplace(mRects.end(), result.rect, result.rect, result.surface);
- CacheEntry* entry = &(*eraseIt);
- entry->eraseIt = eraseIt;
- result.key = reinterpret_cast<AtlasKey>(entry);
- }
-
- return result;
-}
-
-AtlasEntry VectorDrawableAtlas::getEntry(AtlasKey atlasKey) {
- AtlasEntry result;
- if (INVALID_ATLAS_KEY != atlasKey) {
- CacheEntry* entry = reinterpret_cast<CacheEntry*>(atlasKey);
- result.rect = entry->VDrect;
- result.surface = entry->surface;
- if (!result.surface) {
- result.surface = mSurface;
- }
- result.key = atlasKey;
- }
- return result;
-}
-
-void VectorDrawableAtlas::releaseEntry(AtlasKey atlasKey) {
- if (INVALID_ATLAS_KEY != atlasKey) {
- if (!renderthread::RenderThread::isCurrent()) {
- {
- AutoMutex _lock(mReleaseKeyLock);
- mKeysForRelease.push_back(atlasKey);
- }
- // invoke releaseEntry on the renderthread
- renderthread::RenderProxy::releaseVDAtlasEntries();
- return;
- }
- CacheEntry* entry = reinterpret_cast<CacheEntry*>(atlasKey);
- if (!entry->surface) {
- // Store freed atlas rectangles in "mFreeRects" and try to reuse them later, when atlas
- // is full.
- SkRect& removedRect = entry->rect;
- size_t rectArea = removedRect.width() * removedRect.height();
- mFreeRects.emplace(rectArea, removedRect);
- SkRect& removedVDRect = entry->VDrect;
- size_t VDRectArea = removedVDRect.width() * removedVDRect.height();
- mPixelUsedByVDs -= VDRectArea;
- mConsecutiveFailures = 0;
- }
- auto eraseIt = entry->eraseIt;
- mRects.erase(eraseIt);
- }
-}
-
-void VectorDrawableAtlas::delayedReleaseEntries() {
- AutoMutex _lock(mReleaseKeyLock);
- for (auto key : mKeysForRelease) {
- releaseEntry(key);
- }
- mKeysForRelease.clear();
-}
-
-sk_sp<SkSurface> VectorDrawableAtlas::createSurface(int width, int height, GrContext* context) {
- SkImageInfo info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- // This must have a top-left origin so that calls to surface->canvas->writePixels
- // performs a basic texture upload instead of a more complex drawing operation
- return SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, 0, kTopLeft_GrSurfaceOrigin,
- nullptr);
-}
-
-void VectorDrawableAtlas::setStorageMode(StorageMode mode) {
- mStorageMode = mode;
- if (StorageMode::disallowSharedSurface == mStorageMode && mSurface) {
- mSurface.reset();
- mRectanizer.reset();
- mFreeRects.clear();
- }
-}
-
-} /* namespace skiapipeline */
-} /* namespace uirenderer */
-} /* namespace android */
diff --git a/libs/hwui/pipeline/skia/VectorDrawableAtlas.h b/libs/hwui/pipeline/skia/VectorDrawableAtlas.h
deleted file mode 100644
index 5e892aa..0000000
--- a/libs/hwui/pipeline/skia/VectorDrawableAtlas.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-#include <SkSurface.h>
-#include <utils/FatVector.h>
-#include <utils/RefBase.h>
-#include <utils/Thread.h>
-#include <list>
-#include <map>
-
-class GrRectanizer;
-
-namespace android {
-namespace uirenderer {
-namespace skiapipeline {
-
-typedef uintptr_t AtlasKey;
-
-#define INVALID_ATLAS_KEY 0
-
-struct AtlasEntry {
- sk_sp<SkSurface> surface;
- SkRect rect;
- AtlasKey key = INVALID_ATLAS_KEY;
-};
-
-/**
- * VectorDrawableAtlas provides offscreen buffers used to draw VD and AnimatedVD.
- * VectorDrawableAtlas can allocate a standalone surface or provide a subrect from a shared surface.
- * VectorDrawableAtlas is owned by the CacheManager and weak pointers are kept by each
- * VectorDrawable that is using it. VectorDrawableAtlas and its surface can be deleted at any time,
- * except during a renderFrame call. VectorDrawable does not contain a pointer to atlas SkSurface
- * nor any coordinates into the atlas, but instead holds a rectangle "id", which is resolved only
- * when drawing. This design makes VectorDrawableAtlas free to move the data internally.
- * At draw time a VectorDrawable may find, that its atlas has been deleted, which will make it
- * draw in a standalone cache surface not part of an atlas. In this case VD won't use
- * VectorDrawableAtlas until the next frame.
- * VectorDrawableAtlas tries to fit VDs in the atlas SkSurface. If there is not enough space in
- * the atlas, VectorDrawableAtlas creates a standalone surface for each VD.
- * When a VectorDrawable is deleted, it invokes VectorDrawableAtlas::releaseEntry, which is keeping
- * track of free spaces and allow to reuse the surface for another VD.
- */
-// TODO: Check if not using atlas for AnimatedVD is more efficient.
-// TODO: For low memory situations, when there are no paint effects in VD, we may render without an
-// TODO: offscreen surface.
-class VectorDrawableAtlas : public virtual RefBase {
-public:
- enum class StorageMode { allowSharedSurface, disallowSharedSurface };
-
- explicit VectorDrawableAtlas(size_t surfaceArea,
- StorageMode storageMode = StorageMode::allowSharedSurface);
-
- /**
- * "prepareForDraw" may allocate a new surface if needed. It may schedule to repack the
- * atlas at a later time.
- */
- void prepareForDraw(GrContext* context);
-
- /**
- * Repack the atlas if needed, by moving used rectangles into a new atlas surface.
- * The goal of repacking is to fix a fragmented atlas.
- */
- void repackIfNeeded(GrContext* context);
-
- /**
- * Returns true if atlas is fragmented and repack is needed.
- */
- bool isFragmented();
-
- /**
- * "requestNewEntry" is called by VectorDrawable to allocate a new rectangle area from the atlas
- * or create a standalone surface if atlas is full.
- * On success it returns a non-negative unique id, which can be used later with "getEntry" and
- * "releaseEntry".
- */
- AtlasEntry requestNewEntry(int width, int height, GrContext* context);
-
- /**
- * "getEntry" extracts coordinates and surface of a previously created rectangle.
- * "atlasKey" is an unique id created by "requestNewEntry". Passing a non-existing "atlasKey" is
- * causing an undefined behaviour.
- * On success it returns a rectangle Id -> may be same or different from "atlasKey" if
- * implementation decides to move the record internally.
- */
- AtlasEntry getEntry(AtlasKey atlasKey);
-
- /**
- * "releaseEntry" is invoked when a VectorDrawable is deleted. Passing a non-existing "atlasKey"
- * is causing an undefined behaviour. This is the only function in the class that can be
- * invoked from any thread. It will marshal internally to render thread if needed.
- */
- void releaseEntry(AtlasKey atlasKey);
-
- void setStorageMode(StorageMode mode);
-
- /**
- * "delayedReleaseEntries" is indirectly invoked by "releaseEntry", when "releaseEntry" is
- * invoked from a non render thread.
- */
- void delayedReleaseEntries();
-
-private:
- struct CacheEntry {
- CacheEntry(const SkRect& newVDrect, const SkRect& newRect,
- const sk_sp<SkSurface>& newSurface)
- : VDrect(newVDrect), rect(newRect), surface(newSurface) {}
-
- /**
- * size and position of VectorDrawable into the atlas or in "this.surface"
- */
- SkRect VDrect;
-
- /**
- * rect allocated in atlas surface or "this.surface". It may be bigger than "VDrect"
- */
- SkRect rect;
-
- /**
- * this surface is used if atlas is full or VD is too big
- */
- sk_sp<SkSurface> surface;
-
- /**
- * iterator is used to delete self with a constant complexity (without traversing the list)
- */
- std::list<CacheEntry>::iterator eraseIt;
- };
-
- /**
- * atlas surface shared by all VDs
- */
- sk_sp<SkSurface> mSurface;
-
- std::unique_ptr<GrRectanizer> mRectanizer;
- const int mWidth;
- const int mHeight;
-
- /**
- * "mRects" keeps records only for rectangles used by VDs. List has nice properties: constant
- * complexity to insert and erase and references are not invalidated by insert/erase.
- */
- std::list<CacheEntry> mRects;
-
- /**
- * Rectangles freed by "releaseEntry" are removed from "mRects" and added to "mFreeRects".
- * "mFreeRects" is using for an index the rectangle area. There could be more than one free
- * rectangle with the same area, which is the reason to use "multimap" instead of "map".
- */
- std::multimap<size_t, SkRect> mFreeRects;
-
- /**
- * area in atlas used by VectorDrawables (area in standalone surface not counted)
- */
- int mPixelUsedByVDs = 0;
-
- /**
- * area allocated in mRectanizer
- */
- int mPixelAllocated = 0;
-
- /**
- * Consecutive times we had to allocate standalone surfaces, because atlas was full.
- */
- int mConsecutiveFailures = 0;
-
- /**
- * mStorageMode allows using a shared surface to store small vector drawables.
- * Using a shared surface can boost the performance by allowing GL ops to be batched, but may
- * consume more memory.
- */
- StorageMode mStorageMode;
-
- /**
- * mKeysForRelease is used by releaseEntry implementation to pass atlas keys from an arbitrary
- * calling thread to the render thread.
- */
- std::vector<AtlasKey> mKeysForRelease;
-
- /**
- * A lock used to protect access to mKeysForRelease.
- */
- Mutex mReleaseKeyLock;
-
- sk_sp<SkSurface> createSurface(int width, int height, GrContext* context);
-
- inline bool fitInAtlas(int width, int height) {
- return 2 * width < mWidth && 2 * height < mHeight;
- }
-
- void repack(GrContext* context);
-
- static bool compareCacheEntry(const CacheEntry& first, const CacheEntry& second);
-};
-
-} /* namespace skiapipeline */
-} /* namespace uirenderer */
-} /* namespace android */
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp
index 8eb8153..b366a80 100644
--- a/libs/hwui/renderthread/CacheManager.cpp
+++ b/libs/hwui/renderthread/CacheManager.cpp
@@ -56,10 +56,6 @@
, mBackgroundCpuFontCacheBytes(mMaxCpuFontCacheBytes * BACKGROUND_RETENTION_PERCENTAGE) {
SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes);
-
- mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(
- mMaxSurfaceArea / 2,
- skiapipeline::VectorDrawableAtlas::StorageMode::disallowSharedSurface);
}
void CacheManager::reset(sk_sp<GrContext> context) {
@@ -76,9 +72,6 @@
void CacheManager::destroy() {
// cleanup any caches here as the GrContext is about to go away...
mGrContext.reset(nullptr);
- mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(
- mMaxSurfaceArea / 2,
- skiapipeline::VectorDrawableAtlas::StorageMode::disallowSharedSurface);
}
class CommonPoolExecutor : public SkExecutor {
@@ -109,7 +102,6 @@
switch (mode) {
case TrimMemoryMode::Complete:
- mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(mMaxSurfaceArea / 2);
mGrContext->freeGpuResources();
SkGraphics::PurgeAllCaches();
break;
@@ -138,16 +130,6 @@
mGrContext->purgeResourcesNotUsedInMs(std::chrono::seconds(30));
}
-sp<skiapipeline::VectorDrawableAtlas> CacheManager::acquireVectorDrawableAtlas() {
- LOG_ALWAYS_FATAL_IF(mVectorDrawableAtlas.get() == nullptr);
- LOG_ALWAYS_FATAL_IF(mGrContext == nullptr);
-
- /**
- * TODO: define memory conditions where we clear the cache (e.g. surface->reset())
- */
- return mVectorDrawableAtlas;
-}
-
void CacheManager::dumpMemoryUsage(String8& log, const RenderState* renderState) {
if (!mGrContext) {
log.appendFormat("No valid cache instance.\n");
@@ -176,8 +158,6 @@
log.appendFormat("Other Caches:\n");
log.appendFormat(" Current / Maximum\n");
- log.appendFormat(" VectorDrawableAtlas %6.2f kB / %6.2f KB (entries = %zu)\n", 0.0f, 0.0f,
- (size_t)0);
if (renderState) {
if (renderState->mActiveLayers.size() > 0) {
diff --git a/libs/hwui/renderthread/CacheManager.h b/libs/hwui/renderthread/CacheManager.h
index d7977cc..857710b 100644
--- a/libs/hwui/renderthread/CacheManager.h
+++ b/libs/hwui/renderthread/CacheManager.h
@@ -25,8 +25,6 @@
#include <utils/String8.h>
#include <vector>
-#include "pipeline/skia/VectorDrawableAtlas.h"
-
namespace android {
class Surface;
@@ -51,8 +49,6 @@
void trimStaleResources();
void dumpMemoryUsage(String8& log, const RenderState* renderState = nullptr);
- sp<skiapipeline::VectorDrawableAtlas> acquireVectorDrawableAtlas();
-
size_t getCacheSize() const { return mMaxResourceBytes; }
size_t getBackgroundCacheSize() const { return mBackgroundResourceBytes; }
@@ -77,13 +73,6 @@
const size_t mMaxGpuFontAtlasBytes;
const size_t mMaxCpuFontCacheBytes;
const size_t mBackgroundCpuFontCacheBytes;
-
- struct PipelineProps {
- const void* pipelineKey = nullptr;
- size_t surfaceArea = 0;
- };
-
- sp<skiapipeline::VectorDrawableAtlas> mVectorDrawableAtlas;
};
} /* namespace renderthread */
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 30cc007..e5c502c 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -306,7 +306,6 @@
info.out.canDrawThisFrame = true;
mAnimationContext->startFrame(info.mode);
- mRenderPipeline->onPrepareTree();
for (const sp<RenderNode>& node : mRenderNodes) {
// Only the primary target node will be drawn full - all other nodes would get drawn in
// real time mode. In case of a window, the primary node is the window content and the other
@@ -565,8 +564,8 @@
ReliableSurface* surface = mNativeSurface.get();
if (surface) {
SkISize size;
- surface->query(NATIVE_WINDOW_WIDTH, &size.fWidth);
- surface->query(NATIVE_WINDOW_HEIGHT, &size.fHeight);
+ size.fWidth = ANativeWindow_getWidth(surface);
+ size.fHeight = ANativeWindow_getHeight(surface);
return size;
}
return {INT32_MAX, INT32_MAX};
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 8a76d6b..6e3e43a 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -242,7 +242,8 @@
nsecs_t queueDuration;
};
- RingBuffer<SwapHistory, 3> mSwapHistory;
+ // Need at least 4 because we do quad buffer. Add a 5th for good measure.
+ RingBuffer<SwapHistory, 5> mSwapHistory;
int64_t mFrameNumber = -1;
// last vsync for a dropped frame due to stuffed queue
diff --git a/libs/hwui/renderthread/IRenderPipeline.h b/libs/hwui/renderthread/IRenderPipeline.h
index 3b81014..ef0aa98 100644
--- a/libs/hwui/renderthread/IRenderPipeline.h
+++ b/libs/hwui/renderthread/IRenderPipeline.h
@@ -80,7 +80,6 @@
virtual bool pinImages(std::vector<SkImage*>& mutableImages) = 0;
virtual bool pinImages(LsaVector<sk_sp<Bitmap>>& images) = 0;
virtual void unpinImages() = 0;
- virtual void onPrepareTree() = 0;
virtual SkColorType getSurfaceColorType() const = 0;
virtual sk_sp<SkColorSpace> getSurfaceColorSpace() = 0;
virtual GrSurfaceOrigin getSurfaceOrigin() = 0;
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 40fbdff..4f7ad7b 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -24,7 +24,6 @@
#include "Readback.h"
#include "Rect.h"
#include "WebViewFunctorManager.h"
-#include "pipeline/skia/VectorDrawableAtlas.h"
#include "renderthread/CanvasContext.h"
#include "renderthread/RenderTask.h"
#include "renderthread/RenderThread.h"
@@ -365,27 +364,6 @@
Properties::disableVsync = true;
}
-void RenderProxy::repackVectorDrawableAtlas() {
- RenderThread& thread = RenderThread::getInstance();
- thread.queue().post([&thread]() {
- // The context may be null if trimMemory executed, but then the atlas was deleted too.
- if (thread.getGrContext() != nullptr) {
- thread.cacheManager().acquireVectorDrawableAtlas()->repackIfNeeded(
- thread.getGrContext());
- }
- });
-}
-
-void RenderProxy::releaseVDAtlasEntries() {
- RenderThread& thread = RenderThread::getInstance();
- thread.queue().post([&thread]() {
- // The context may be null if trimMemory executed, but then the atlas was deleted too.
- if (thread.getGrContext() != nullptr) {
- thread.cacheManager().acquireVectorDrawableAtlas()->delayedReleaseEntries();
- }
- });
-}
-
void RenderProxy::preload() {
// Create RenderThread object and start the thread. Then preload Vulkan/EGL driver.
auto& thread = RenderThread::getInstance();
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index c3eb6ed..e6fe1d4 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -150,10 +150,6 @@
ANDROID_API static void preload();
- static void repackVectorDrawableAtlas();
-
- static void releaseVDAtlasEntries();
-
private:
RenderThread& mRenderThread;
CanvasContext* mContext;
diff --git a/libs/hwui/tests/unit/SkiaDisplayListTests.cpp b/libs/hwui/tests/unit/SkiaDisplayListTests.cpp
index 6fb164a..7d999c4 100644
--- a/libs/hwui/tests/unit/SkiaDisplayListTests.cpp
+++ b/libs/hwui/tests/unit/SkiaDisplayListTests.cpp
@@ -208,9 +208,8 @@
test::TestContext testContext;
testContext.setRenderOffscreen(true);
auto surface = testContext.surface();
- int width, height;
- surface->query(NATIVE_WINDOW_WIDTH, &width);
- surface->query(NATIVE_WINDOW_HEIGHT, &height);
+ int width = ANativeWindow_getWidth(surface.get());
+ int height = ANativeWindow_getHeight(surface.get());
canvasContext->setSurface(std::move(surface));
TreeInfo info(TreeInfo::MODE_FULL, *canvasContext.get());
diff --git a/libs/hwui/tests/unit/SkiaPipelineTests.cpp b/libs/hwui/tests/unit/SkiaPipelineTests.cpp
index 958baa7..307d136 100644
--- a/libs/hwui/tests/unit/SkiaPipelineTests.cpp
+++ b/libs/hwui/tests/unit/SkiaPipelineTests.cpp
@@ -61,39 +61,6 @@
ASSERT_EQ(TestUtils::getColor(surface, 0, 0), SK_ColorRED);
}
-RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaPipeline, testOnPrepareTree) {
- auto redNode = TestUtils::createSkiaNode(
- 0, 0, 1, 1, [](RenderProperties& props, SkiaRecordingCanvas& redCanvas) {
- redCanvas.drawColor(SK_ColorRED, SkBlendMode::kSrcOver);
- });
-
- LayerUpdateQueue layerUpdateQueue;
- SkRect dirty = SkRectMakeLargest();
- std::vector<sp<RenderNode>> renderNodes;
- renderNodes.push_back(redNode);
- bool opaque = true;
- android::uirenderer::Rect contentDrawBounds(0, 0, 1, 1);
- auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread);
- {
- // add a pointer to a deleted vector drawable object in the pipeline
- sp<VectorDrawableRoot> dirtyVD(new VectorDrawableRoot(new VectorDrawable::Group()));
- dirtyVD->mutateProperties()->setScaledSize(5, 5);
- pipeline->getVectorDrawables()->push_back(dirtyVD.get());
- }
-
- // pipeline should clean list of dirty vector drawables before prepare tree
- pipeline->onPrepareTree();
-
- auto surface = SkSurface::MakeRasterN32Premul(1, 1);
- surface->getCanvas()->drawColor(SK_ColorBLUE, SkBlendMode::kSrcOver);
- ASSERT_EQ(TestUtils::getColor(surface, 0, 0), SK_ColorBLUE);
-
- // drawFrame will crash if "SkiaPipeline::onPrepareTree" did not clean invalid VD pointer
- pipeline->renderFrame(layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds, surface,
- SkMatrix::I());
- ASSERT_EQ(TestUtils::getColor(surface, 0, 0), SK_ColorRED);
-}
-
RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaPipeline, renderFrameCheckOpaque) {
auto halfGreenNode = TestUtils::createSkiaNode(
0, 0, 2, 2, [](RenderProperties& props, SkiaRecordingCanvas& bottomHalfGreenCanvas) {
diff --git a/libs/hwui/tests/unit/VectorDrawableAtlasTests.cpp b/libs/hwui/tests/unit/VectorDrawableAtlasTests.cpp
deleted file mode 100644
index 0c95fdd..0000000
--- a/libs/hwui/tests/unit/VectorDrawableAtlasTests.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <GrRectanizer.h>
-#include "pipeline/skia/VectorDrawableAtlas.h"
-#include "tests/common/TestUtils.h"
-
-using namespace android;
-using namespace android::uirenderer;
-using namespace android::uirenderer::renderthread;
-using namespace android::uirenderer::skiapipeline;
-
-RENDERTHREAD_SKIA_PIPELINE_TEST(VectorDrawableAtlas, addGetRemove) {
- VectorDrawableAtlas atlas(100 * 100);
- atlas.prepareForDraw(renderThread.getGrContext());
- // create 150 rects 10x10, which won't fit in the atlas (atlas can fit no more than 100 rects)
- const int MAX_RECTS = 150;
- AtlasEntry VDRects[MAX_RECTS];
-
- sk_sp<SkSurface> atlasSurface;
-
- // check we are able to allocate new rects
- // check that rects in the atlas do not intersect
- for (uint32_t i = 0; i < MAX_RECTS; i++) {
- VDRects[i] = atlas.requestNewEntry(10, 10, renderThread.getGrContext());
- if (0 == i) {
- atlasSurface = VDRects[0].surface;
- }
- ASSERT_TRUE(VDRects[i].key != INVALID_ATLAS_KEY);
- ASSERT_TRUE(VDRects[i].surface.get() != nullptr);
- ASSERT_TRUE(VDRects[i].rect.width() == 10 && VDRects[i].rect.height() == 10);
-
- // nothing in the atlas should intersect
- if (atlasSurface.get() == VDRects[i].surface.get()) {
- for (uint32_t j = 0; j < i; j++) {
- if (atlasSurface.get() == VDRects[j].surface.get()) {
- ASSERT_FALSE(VDRects[i].rect.intersect(VDRects[j].rect));
- }
- }
- }
- }
-
- // first 1/3 rects should all be in the same surface
- for (uint32_t i = 1; i < MAX_RECTS / 3; i++) {
- ASSERT_NE(VDRects[i].key, VDRects[0].key);
- ASSERT_EQ(VDRects[i].surface.get(), atlasSurface.get());
- }
-
- // first rect is using atlas and last is a standalone surface
- ASSERT_NE(VDRects[0].surface.get(), VDRects[MAX_RECTS - 1].surface.get());
-
- // check getEntry returns the same surfaces that we had created
- for (uint32_t i = 0; i < MAX_RECTS; i++) {
- auto VDRect = atlas.getEntry(VDRects[i].key);
- ASSERT_TRUE(VDRect.key != INVALID_ATLAS_KEY);
- ASSERT_EQ(VDRects[i].key, VDRect.key);
- ASSERT_EQ(VDRects[i].surface.get(), VDRect.surface.get());
- ASSERT_EQ(VDRects[i].rect, VDRect.rect);
- atlas.releaseEntry(VDRect.key);
- }
-
- // check that any new rects will be allocated in the atlas, even that rectanizer is full.
- // rects in the atlas should not intersect.
- for (uint32_t i = 0; i < MAX_RECTS / 3; i++) {
- VDRects[i] = atlas.requestNewEntry(10, 10, renderThread.getGrContext());
- ASSERT_TRUE(VDRects[i].key != INVALID_ATLAS_KEY);
- ASSERT_EQ(VDRects[i].surface.get(), atlasSurface.get());
- ASSERT_TRUE(VDRects[i].rect.width() == 10 && VDRects[i].rect.height() == 10);
- for (uint32_t j = 0; j < i; j++) {
- ASSERT_FALSE(VDRects[i].rect.intersect(VDRects[j].rect));
- }
- }
-}
-
-RENDERTHREAD_SKIA_PIPELINE_TEST(VectorDrawableAtlas, disallowSharedSurface) {
- VectorDrawableAtlas atlas(100 * 100);
- // don't allow to use a shared surface
- atlas.setStorageMode(VectorDrawableAtlas::StorageMode::disallowSharedSurface);
- atlas.prepareForDraw(renderThread.getGrContext());
- // create 150 rects 10x10, which won't fit in the atlas (atlas can fit no more than 100 rects)
- const int MAX_RECTS = 150;
- AtlasEntry VDRects[MAX_RECTS];
-
- // check we are able to allocate new rects
- // check that rects in the atlas use unique surfaces
- for (uint32_t i = 0; i < MAX_RECTS; i++) {
- VDRects[i] = atlas.requestNewEntry(10, 10, renderThread.getGrContext());
- ASSERT_TRUE(VDRects[i].key != INVALID_ATLAS_KEY);
- ASSERT_TRUE(VDRects[i].surface.get() != nullptr);
- ASSERT_TRUE(VDRects[i].rect.width() == 10 && VDRects[i].rect.height() == 10);
-
- // nothing in the atlas should use the same surface
- for (uint32_t j = 0; j < i; j++) {
- ASSERT_NE(VDRects[i].surface.get(), VDRects[j].surface.get());
- }
- }
-}
-
-RENDERTHREAD_SKIA_PIPELINE_TEST(VectorDrawableAtlas, repack) {
- VectorDrawableAtlas atlas(100 * 100);
- ASSERT_FALSE(atlas.isFragmented());
- atlas.prepareForDraw(renderThread.getGrContext());
- ASSERT_FALSE(atlas.isFragmented());
- // create 150 rects 10x10, which won't fit in the atlas (atlas can fit no more than 100 rects)
- const int MAX_RECTS = 150;
- AtlasEntry VDRects[MAX_RECTS];
-
- sk_sp<SkSurface> atlasSurface;
-
- // fill the atlas with check we are able to allocate new rects
- for (uint32_t i = 0; i < MAX_RECTS; i++) {
- VDRects[i] = atlas.requestNewEntry(10, 10, renderThread.getGrContext());
- if (0 == i) {
- atlasSurface = VDRects[0].surface;
- }
- ASSERT_TRUE(VDRects[i].key != INVALID_ATLAS_KEY);
- }
-
- ASSERT_FALSE(atlas.isFragmented());
-
- // first 1/3 rects should all be in the same surface
- for (uint32_t i = 1; i < MAX_RECTS / 3; i++) {
- ASSERT_NE(VDRects[i].key, VDRects[0].key);
- ASSERT_EQ(VDRects[i].surface.get(), atlasSurface.get());
- }
-
- // release all entries
- for (uint32_t i = 0; i < MAX_RECTS; i++) {
- auto VDRect = atlas.getEntry(VDRects[i].key);
- ASSERT_TRUE(VDRect.key != INVALID_ATLAS_KEY);
- atlas.releaseEntry(VDRect.key);
- }
-
- ASSERT_FALSE(atlas.isFragmented());
-
- // allocate 4x4 rects, which will fragment the atlas badly, because each entry occupies a 10x10
- // area
- for (uint32_t i = 0; i < 4 * MAX_RECTS; i++) {
- AtlasEntry entry = atlas.requestNewEntry(4, 4, renderThread.getGrContext());
- ASSERT_TRUE(entry.key != INVALID_ATLAS_KEY);
- }
-
- ASSERT_TRUE(atlas.isFragmented());
-
- atlas.repackIfNeeded(renderThread.getGrContext());
-
- ASSERT_FALSE(atlas.isFragmented());
-}
\ No newline at end of file
diff --git a/location/TEST_MAPPING b/location/TEST_MAPPING
new file mode 100644
index 0000000..2f386271
--- /dev/null
+++ b/location/TEST_MAPPING
@@ -0,0 +1,10 @@
+{
+ "presubmit": [
+ {
+ "name": "CtsLocationCoarseTestCases"
+ },
+ {
+ "name": "CtsLocationNoneTestCases"
+ }
+ ]
+}
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 91f3a20fc..79bec92 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -42,20 +42,23 @@
*/
interface ILocationManager
{
- Location getLastLocation(in LocationRequest request, String packageName);
+ Location getLastLocation(in LocationRequest request, String packageName, String featureId);
boolean getCurrentLocation(in LocationRequest request,
in ICancellationSignal cancellationSignal, in ILocationListener listener,
- String packageName, String listenerIdentifier);
+ String packageName, String featureId, String listenerIdentifier);
void requestLocationUpdates(in LocationRequest request, in ILocationListener listener,
- in PendingIntent intent, String packageName, String listenerIdentifier);
+ in PendingIntent intent, String packageName, String featureId,
+ String listenerIdentifier);
void removeUpdates(in ILocationListener listener, in PendingIntent intent, String packageName);
void requestGeofence(in LocationRequest request, in Geofence geofence,
- in PendingIntent intent, String packageName, String listenerIdentifier);
+ in PendingIntent intent, String packageName, String featureId,
+ String listenerIdentifier);
void removeGeofence(in Geofence fence, in PendingIntent intent, String packageName);
- boolean registerGnssStatusCallback(IGnssStatusListener callback, String packageName);
+ boolean registerGnssStatusCallback(IGnssStatusListener callback, String packageName,
+ String featureId);
void unregisterGnssStatusCallback(IGnssStatusListener callback);
boolean geocoderIsPresent();
@@ -69,14 +72,14 @@
boolean sendNiResponse(int notifId, int userResponse);
boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener,
- String packageName, String listenerIdentifier);
+ String packageName, String featureId, String listenerIdentifier);
void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections,
in String packageName);
long getGnssCapabilities(in String packageName);
void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener);
boolean addGnssNavigationMessageListener(in IGnssNavigationMessageListener listener,
- String packageName, String listenerIdentifier);
+ String packageName, String featureId, String listenerIdentifier);
void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener);
int getGnssYearOfHardware();
@@ -84,7 +87,7 @@
int getGnssBatchSize(String packageName);
boolean addGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName,
- String listenerIdentifier);
+ String featureId, String listenerIdentifier);
void removeGnssBatchingCallback();
boolean startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName);
void flushGnssBatch(String packageName);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 9e17e95..d3db9d8 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -515,7 +515,8 @@
@RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
public Location getLastLocation() {
try {
- return mService.getLastLocation(null, mContext.getPackageName());
+ return mService.getLastLocation(null, mContext.getPackageName(),
+ mContext.getFeatureId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -547,7 +548,8 @@
provider, 0, 0, true);
try {
- return mService.getLastLocation(request, mContext.getPackageName());
+ return mService.getLastLocation(request, mContext.getPackageName(),
+ mContext.getFeatureId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -641,7 +643,7 @@
try {
if (mService.getCurrentLocation(currentLocationRequest, remoteCancellationSignal,
- listenerTransport, mContext.getPackageName(),
+ listenerTransport, mContext.getPackageName(), mContext.getFeatureId(),
getListenerIdentifier(consumer))) {
listenerTransport.register(mContext.getSystemService(AlarmManager.class),
remoteCancellationSignal);
@@ -1085,7 +1087,8 @@
boolean registered = false;
try {
mService.requestLocationUpdates(locationRequest, transport, null,
- mContext.getPackageName(), getListenerIdentifier(listener));
+ mContext.getPackageName(), mContext.getFeatureId(),
+ getListenerIdentifier(listener));
registered = true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -1130,7 +1133,8 @@
try {
mService.requestLocationUpdates(locationRequest, null, pendingIntent,
- mContext.getPackageName(), getListenerIdentifier(pendingIntent));
+ mContext.getPackageName(), mContext.getFeatureId(),
+ getListenerIdentifier(pendingIntent));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1594,7 +1598,7 @@
LocationRequest request = new LocationRequest().setExpireIn(expiration);
try {
mService.requestGeofence(request, fence, intent, mContext.getPackageName(),
- getListenerIdentifier(intent));
+ mContext.getFeatureId(), getListenerIdentifier(intent));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1672,7 +1676,7 @@
try {
mService.requestGeofence(request, fence, intent, mContext.getPackageName(),
- getListenerIdentifier(intent));
+ mContext.getFeatureId(), getListenerIdentifier(intent));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2179,7 +2183,7 @@
public void removeGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) {}
/**
- * Registers a GNSS Navigation Message callback.
+ * Registers a GNSS Navigation Message callback which will run on a binder thread.
*
* @param callback a {@link GnssNavigationMessage.Callback} object to register.
* @return {@code true} if the callback was added successfully, {@code false} otherwise.
@@ -2190,7 +2194,7 @@
@Deprecated
public boolean registerGnssNavigationMessageCallback(
@NonNull GnssNavigationMessage.Callback callback) {
- return registerGnssNavigationMessageCallback(callback, null);
+ return registerGnssNavigationMessageCallback(Runnable::run, callback);
}
/**
@@ -2748,7 +2752,7 @@
mListenerTransport = new GnssStatusListener();
return mService.registerGnssStatusCallback(mListenerTransport,
- mContext.getPackageName());
+ mContext.getPackageName(), mContext.getFeatureId());
}
@Override
@@ -2808,7 +2812,8 @@
mListenerTransport = new GnssMeasurementsListener();
return mService.addGnssMeasurementsListener(mListenerTransport,
- mContext.getPackageName(), "gnss measurement callback");
+ mContext.getPackageName(), mContext.getFeatureId(),
+ "gnss measurement callback");
}
@Override
@@ -2844,7 +2849,8 @@
mListenerTransport = new GnssNavigationMessageListener();
return mService.addGnssNavigationMessageListener(mListenerTransport,
- mContext.getPackageName(), "gnss navigation callback");
+ mContext.getPackageName(), mContext.getFeatureId(),
+ "gnss navigation callback");
}
@Override
@@ -2880,7 +2886,7 @@
mListenerTransport = new BatchedLocationCallback();
return mService.addGnssBatchingCallback(mListenerTransport, mContext.getPackageName(),
- "batched location callback");
+ mContext.getFeatureId(), "batched location callback");
}
@Override
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java
index 0902acf..0f38f7f 100644
--- a/location/java/android/location/LocationRequest.java
+++ b/location/java/android/location/LocationRequest.java
@@ -30,6 +30,8 @@
import android.os.WorkSource;
import android.util.TimeUtils;
+import com.android.internal.util.Preconditions;
+
/**
* A data object that contains quality of service parameters for requests
@@ -195,6 +197,8 @@
@NonNull
public static LocationRequest createFromDeprecatedProvider(
@NonNull String provider, long minTime, float minDistance, boolean singleShot) {
+ Preconditions.checkArgument(provider != null, "invalid null provider");
+
if (minTime < 0) minTime = 0;
if (minDistance < 0) minDistance = 0;
@@ -222,6 +226,8 @@
@NonNull
public static LocationRequest createFromDeprecatedCriteria(
@NonNull Criteria criteria, long minTime, float minDistance, boolean singleShot) {
+ Preconditions.checkArgument(criteria != null, "invalid null criteria");
+
if (minTime < 0) minTime = 0;
if (minDistance < 0) minDistance = 0;
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 53bc65d..bb731a8 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -16,6 +16,7 @@
package android.media;
+import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
@@ -26,6 +27,8 @@
import android.media.audiopolicy.AudioMix;
import android.util.Log;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Map;
@@ -431,6 +434,50 @@
public static final int DEAD_OBJECT = -6;
public static final int WOULD_BLOCK = -7;
+ /** @hide */
+ @IntDef({
+ SUCCESS,
+ ERROR,
+ BAD_VALUE,
+ INVALID_OPERATION,
+ PERMISSION_DENIED,
+ NO_INIT,
+ DEAD_OBJECT,
+ WOULD_BLOCK
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface AudioSystemError {}
+
+ /**
+ * Convert an int error value to its String value for readability.
+ * Accepted error values are the java AudioSystem errors, matching android_media_AudioErrors.h,
+ * which map onto the native status_t type.
+ * @param error one of the java AudioSystem errors
+ * @return a human-readable string
+ */
+ public static String audioSystemErrorToString(@AudioSystemError int error) {
+ switch(error) {
+ case SUCCESS:
+ return "SUCCESS";
+ case ERROR:
+ return "ERROR";
+ case BAD_VALUE:
+ return "BAD_VALUE";
+ case INVALID_OPERATION:
+ return "INVALID_OPERATION";
+ case PERMISSION_DENIED:
+ return "PERMISSION_DENIED";
+ case NO_INIT:
+ return "NO_INIT";
+ case DEAD_OBJECT:
+ return "DEAD_OBJECT";
+ case WOULD_BLOCK:
+ return "WOULD_BLOCK";
+ default:
+ return ("unknown error:" + error);
+ }
+ }
+
/*
* AudioPolicyService methods
*/
diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java
index 33ddfa7..d6a4ea7 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -39,6 +39,7 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
@@ -68,6 +69,7 @@
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.zip.CRC32;
/**
* This is a class for reading and writing Exif tags in a JPEG file or a RAW image file.
@@ -502,11 +504,22 @@
// 3.7. eXIf Exchangeable Image File (Exif) Profile
private static final byte[] PNG_CHUNK_TYPE_EXIF = new byte[]{(byte) 0x65, (byte) 0x58,
(byte) 0x49, (byte) 0x66};
+ private static final byte[] PNG_CHUNK_TYPE_IHDR = new byte[]{(byte) 0x49, (byte) 0x48,
+ (byte) 0x44, (byte) 0x52};
private static final byte[] PNG_CHUNK_TYPE_IEND = new byte[]{(byte) 0x49, (byte) 0x45,
(byte) 0x4e, (byte) 0x44};
- private static final int PNG_CHUNK_LENGTH_BYTE_LENGTH = 4;
+ private static final int PNG_CHUNK_TYPE_BYTE_LENGTH = 4;
private static final int PNG_CHUNK_CRC_BYTE_LENGTH = 4;
+ // See https://developers.google.com/speed/webp/docs/riff_container, Section "WebP File Header"
+ private static final byte[] WEBP_SIGNATURE_1 = new byte[] {'R', 'I', 'F', 'F'};
+ private static final byte[] WEBP_SIGNATURE_2 = new byte[] {'W', 'E', 'B', 'P'};
+ private static final int WEBP_FILE_SIZE_BYTE_LENGTH = 4;
+ private static final byte[] WEBP_CHUNK_TYPE_EXIF = new byte[]{(byte) 0x45, (byte) 0x58,
+ (byte) 0x49, (byte) 0x46};
+ private static final int WEBP_CHUNK_TYPE_BYTE_LENGTH = 4;
+ private static final int WEBP_CHUNK_SIZE_BYTE_LENGTH = 4;
+
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
private static SimpleDateFormat sFormatter;
private static SimpleDateFormat sFormatterTz;
@@ -1325,6 +1338,7 @@
private static final int IMAGE_TYPE_SRW = 11;
private static final int IMAGE_TYPE_HEIF = 12;
private static final int IMAGE_TYPE_PNG = 13;
+ private static final int IMAGE_TYPE_WEBP = 14;
static {
sFormatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
@@ -1869,6 +1883,10 @@
getPngAttributes(inputStream);
break;
}
+ case IMAGE_TYPE_WEBP: {
+ getWebpAttributes(inputStream);
+ break;
+ }
case IMAGE_TYPE_ARW:
case IMAGE_TYPE_CR2:
case IMAGE_TYPE_DNG:
@@ -1934,7 +1952,7 @@
* {@link #setAttribute(String,String)} to set all attributes to write and
* make a single call rather than multiple calls for each attribute.
* <p>
- * This method is only supported for JPEG files.
+ * This method is only supported for JPEG and PNG files.
* <p class="note">
* Note: after calling this method, any attempts to obtain range information
* from {@link #getAttributeRange(String)} or {@link #getThumbnailRange()}
@@ -1943,8 +1961,9 @@
* </p>
*/
public void saveAttributes() throws IOException {
- if (!mIsSupportedFile || mMimeType != IMAGE_TYPE_JPEG) {
- throw new IOException("ExifInterface only supports saving attributes on JPEG formats.");
+ if (!mIsSupportedFile || (mMimeType != IMAGE_TYPE_JPEG && mMimeType != IMAGE_TYPE_PNG)) {
+ throw new IOException("ExifInterface only supports saving attributes on JPEG or PNG "
+ + "formats.");
}
if (mIsInputStream || (mSeekableFileDescriptor == null && mFilename == null)) {
throw new IOException(
@@ -1973,7 +1992,11 @@
throw new IOException("Couldn't rename to " + tempFile.getAbsolutePath());
}
} else if (mSeekableFileDescriptor != null) {
- tempFile = File.createTempFile("temp", "jpg");
+ if (mMimeType == IMAGE_TYPE_JPEG) {
+ tempFile = File.createTempFile("temp", "jpg");
+ } else if (mMimeType == IMAGE_TYPE_PNG) {
+ tempFile = File.createTempFile("temp", "png");
+ }
Os.lseek(mSeekableFileDescriptor, 0, OsConstants.SEEK_SET);
in = new FileInputStream(mSeekableFileDescriptor);
out = new FileOutputStream(tempFile);
@@ -1999,7 +2022,11 @@
}
try (BufferedInputStream bufferedIn = new BufferedInputStream(in);
BufferedOutputStream bufferedOut = new BufferedOutputStream(out)) {
- saveJpegAttributes(bufferedIn, bufferedOut);
+ if (mMimeType == IMAGE_TYPE_JPEG) {
+ saveJpegAttributes(bufferedIn, bufferedOut);
+ } else if (mMimeType == IMAGE_TYPE_PNG) {
+ savePngAttributes(bufferedIn, bufferedOut);
+ }
}
} catch (Exception e) {
if (mFilename != null) {
@@ -2431,6 +2458,8 @@
return IMAGE_TYPE_RW2;
} else if (isPngFormat(signatureCheckBytes)) {
return IMAGE_TYPE_PNG;
+ } else if (isWebpFormat(signatureCheckBytes)) {
+ return IMAGE_TYPE_WEBP;
}
// Certain file formats (PEF) are identified in readImageFileDirectory()
return IMAGE_TYPE_UNKNOWN;
@@ -2609,6 +2638,26 @@
return true;
}
+ /**
+ * WebP's file signature is composed of 12 bytes:
+ * 'RIFF' (4 bytes) + file length value (4 bytes) + 'WEBP' (4 bytes)
+ * See https://developers.google.com/speed/webp/docs/riff_container, Section "WebP File Header"
+ */
+ private boolean isWebpFormat(byte[] signatureCheckBytes) throws IOException {
+ for (int i = 0; i < WEBP_SIGNATURE_1.length; i++) {
+ if (signatureCheckBytes[i] != WEBP_SIGNATURE_1[i]) {
+ return false;
+ }
+ }
+ for (int i = 0; i < WEBP_SIGNATURE_2.length; i++) {
+ if (signatureCheckBytes[i + WEBP_SIGNATURE_1.length + WEBP_FILE_SIZE_BYTE_LENGTH]
+ != WEBP_SIGNATURE_2[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private static boolean isStandalone(InputStream inputStream) throws IOException {
byte[] signatureCheckBytes = new byte[IDENTIFIER_EXIF_APP1.length];
inputStream.read(signatureCheckBytes);
@@ -3146,30 +3195,36 @@
int bytesRead = 0;
// Skip the signature bytes
- in.seek(PNG_SIGNATURE.length);
+ in.skipBytes(PNG_SIGNATURE.length);
bytesRead += PNG_SIGNATURE.length;
+ // Each chunk is made up of four parts:
+ // 1) Length: 4-byte unsigned integer indicating the number of bytes in the
+ // Chunk Data field. Excludes Chunk Type and CRC bytes.
+ // 2) Chunk Type: 4-byte chunk type code.
+ // 3) Chunk Data: The data bytes. Can be zero-length.
+ // 4) CRC: 4-byte data calculated on the preceding bytes in the chunk. Always
+ // present.
+ // --> 4 (length bytes) + 4 (type bytes) + X (data bytes) + 4 (CRC bytes)
+ // See PNG (Portable Network Graphics) Specification, Version 1.2,
+ // 3.2. Chunk layout
try {
while (true) {
- // Each chunk is made up of four parts:
- // 1) Length: 4-byte unsigned integer indicating the number of bytes in the
- // Chunk Data field. Excludes Chunk Type and CRC bytes.
- // 2) Chunk Type: 4-byte chunk type code.
- // 3) Chunk Data: The data bytes. Can be zero-length.
- // 4) CRC: 4-byte data calculated on the preceding bytes in the chunk. Always
- // present.
- // --> 4 (length bytes) + 4 (type bytes) + X (data bytes) + 4 (CRC bytes)
- // See PNG (Portable Network Graphics) Specification, Version 1.2,
- // 3.2. Chunk layout
int length = in.readInt();
bytesRead += 4;
- byte[] type = new byte[PNG_CHUNK_LENGTH_BYTE_LENGTH];
+ byte[] type = new byte[PNG_CHUNK_TYPE_BYTE_LENGTH];
if (in.read(type) != type.length) {
throw new IOException("Encountered invalid length while parsing PNG chunk"
+ "type");
}
- bytesRead += PNG_CHUNK_LENGTH_BYTE_LENGTH;
+ bytesRead += PNG_CHUNK_TYPE_BYTE_LENGTH;
+
+ // The first chunk must be the IHDR chunk
+ if (bytesRead == 16 && !Arrays.equals(type, PNG_CHUNK_TYPE_IHDR)) {
+ throw new IOException("Encountered invalid PNG file--IHDR chunk should appear"
+ + "as the first chunk");
+ }
if (Arrays.equals(type, PNG_CHUNK_TYPE_IEND)) {
// IEND marks the end of the image.
@@ -3181,9 +3236,25 @@
throw new IOException("Failed to read given length for given PNG chunk "
+ "type: " + byteArrayToHexString(type));
}
+
+ // Compare CRC values for potential data corruption.
+ int dataCrcValue = in.readInt();
+ // Cyclic Redundancy Code used to check for corruption of the data
+ CRC32 crc = new CRC32();
+ crc.update(type);
+ crc.update(data);
+ if ((int) crc.getValue() != dataCrcValue) {
+ throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk."
+ + "\n recorded CRC value: " + dataCrcValue + ", calculated CRC "
+ + "value: " + crc.getValue());
+ }
+
readExifSegment(data, IFD_TYPE_PRIMARY);
validateImages();
+
+ // Save offset values for handleThumbnailFromJfif() function
+ mExifOffset = bytesRead;
break;
} else {
// Skip to next chunk
@@ -3191,8 +3262,6 @@
bytesRead += length + PNG_CHUNK_CRC_BYTE_LENGTH;
}
}
- // Save offset values for handleThumbnailFromJfif() function
- mExifOffset = bytesRead;
} catch (EOFException e) {
// Should not reach here. Will only reach here if the file is corrupted or
// does not follow the PNG specifications
@@ -3200,6 +3269,75 @@
}
}
+ // WebP contains EXIF data as a RIFF File Format Chunk
+ // All references below can be found in the following link.
+ // https://developers.google.com/speed/webp/docs/riff_container
+ private void getWebpAttributes(ByteOrderedDataInputStream in) throws IOException {
+ if (DEBUG) {
+ Log.d(TAG, "getWebpAttributes starting with: " + in);
+ }
+ // WebP uses little-endian by default.
+ // See Section "Terminology & Basics"
+ in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ in.skipBytes(WEBP_SIGNATURE_1.length);
+ // File size corresponds to the size of the entire file from offset 8.
+ // See Section "WebP File Header"
+ int fileSize = in.readInt() + 8;
+ int bytesRead = 8;
+ bytesRead += in.skipBytes(WEBP_SIGNATURE_2.length);
+ try {
+ while (true) {
+ // Each chunk is made up of three parts:
+ // 1) Chunk FourCC: 4-byte concatenating four ASCII characters.
+ // 2) Chunk Size: 4-byte unsigned integer indicating the size of the chunk.
+ // Excludes Chunk FourCC and Chunk Size bytes.
+ // 3) Chunk Payload: data payload. A single padding byte ('0') is added if
+ // Chunk Size is odd.
+ // See Section "RIFF File Format"
+ byte[] code = new byte[WEBP_CHUNK_TYPE_BYTE_LENGTH];
+ if (in.read(code) != code.length) {
+ throw new IOException("Encountered invalid length while parsing WebP chunk"
+ + "type");
+ }
+ bytesRead += 4;
+ int chunkSize = in.readInt();
+ bytesRead += 4;
+ if (Arrays.equals(WEBP_CHUNK_TYPE_EXIF, code)) {
+ // TODO: Need to handle potential OutOfMemoryError
+ byte[] payload = new byte[chunkSize];
+ if (in.read(payload) != chunkSize) {
+ throw new IOException("Failed to read given length for given PNG chunk "
+ + "type: " + byteArrayToHexString(code));
+ }
+ readExifSegment(payload, IFD_TYPE_PRIMARY);
+ break;
+ } else {
+ // Add a single padding byte at end if chunk size is odd
+ chunkSize = (chunkSize % 2 == 1) ? chunkSize + 1 : chunkSize;
+ // Check if skipping to next chunk is necessary
+ if (bytesRead + chunkSize == fileSize) {
+ // Reached end of file
+ break;
+ } else if (bytesRead + chunkSize > fileSize) {
+ throw new IOException("Encountered WebP file with invalid chunk size");
+ }
+ // Skip to next chunk
+ int skipped = in.skipBytes(chunkSize);
+ if (skipped != chunkSize) {
+ throw new IOException("Encountered WebP file with invalid chunk size");
+ }
+ bytesRead += skipped;
+ }
+ }
+ // Save offset values for handleThumbnailFromJfif() function
+ mExifOffset = bytesRead;
+ } catch (EOFException e) {
+ // Should not reach here. Will only reach here if the file is corrupted or
+ // does not follow the WebP specifications
+ throw new IOException("Encountered corrupt WebP file.");
+ }
+ }
+
// Stores a new JPEG image with EXIF attributes into a given output stream.
private void saveJpegAttributes(InputStream inputStream, OutputStream outputStream)
throws IOException {
@@ -3298,6 +3436,62 @@
}
}
+ private void savePngAttributes(InputStream inputStream, OutputStream outputStream)
+ throws IOException {
+ if (DEBUG) {
+ Log.d(TAG, "savePngAttributes starting with (inputStream: " + inputStream
+ + ", outputStream: " + outputStream + ")");
+ }
+ DataInputStream dataInputStream = new DataInputStream(inputStream);
+ ByteOrderedDataOutputStream dataOutputStream =
+ new ByteOrderedDataOutputStream(outputStream, ByteOrder.BIG_ENDIAN);
+ // Copy PNG signature bytes
+ copy(dataInputStream, dataOutputStream, PNG_SIGNATURE.length);
+ // EXIF chunk can appear anywhere between the first (IHDR) and last (IEND) chunks, except
+ // between IDAT chunks.
+ // Adhering to these rules,
+ // 1) if EXIF chunk did not exist in the original file, it will be stored right after the
+ // first chunk,
+ // 2) if EXIF chunk existed in the original file, it will be stored in the same location.
+ if (mExifOffset == 0) {
+ // Copy IHDR chunk bytes
+ int ihdrChunkLength = dataInputStream.readInt();
+ dataOutputStream.writeInt(ihdrChunkLength);
+ copy(dataInputStream, dataOutputStream, PNG_CHUNK_TYPE_BYTE_LENGTH
+ + ihdrChunkLength + PNG_CHUNK_CRC_BYTE_LENGTH);
+ } else {
+ // Copy up until the point where EXIF chunk length information is stored.
+ int copyLength = mExifOffset - PNG_SIGNATURE.length
+ - 4 /* PNG EXIF chunk length bytes */
+ - PNG_CHUNK_TYPE_BYTE_LENGTH;
+ copy(dataInputStream, dataOutputStream, copyLength);
+ // Skip to the start of the chunk after the EXIF chunk
+ int exifChunkLength = dataInputStream.readInt();
+ dataInputStream.skipBytes(PNG_CHUNK_TYPE_BYTE_LENGTH + exifChunkLength
+ + PNG_CHUNK_CRC_BYTE_LENGTH);
+ }
+ // Write EXIF data
+ try (ByteArrayOutputStream exifByteArrayOutputStream = new ByteArrayOutputStream()) {
+ // A byte array is needed to calculate the CRC value of this chunk which requires
+ // the chunk type bytes and the chunk data bytes.
+ ByteOrderedDataOutputStream exifDataOutputStream =
+ new ByteOrderedDataOutputStream(exifByteArrayOutputStream,
+ ByteOrder.BIG_ENDIAN);
+ // Store Exif data in separate byte array
+ writeExifSegment(exifDataOutputStream, 0);
+ byte[] exifBytes =
+ ((ByteArrayOutputStream) exifDataOutputStream.mOutputStream).toByteArray();
+ // Write EXIF chunk data
+ dataOutputStream.write(exifBytes);
+ // Write EXIF chunk CRC
+ CRC32 crc = new CRC32();
+ crc.update(exifBytes, 4 /* skip length bytes */, exifBytes.length - 4);
+ dataOutputStream.writeInt((int) crc.getValue());
+ }
+ // Copy the rest of the file
+ Streams.copy(dataInputStream, dataOutputStream);
+ }
+
// Reads the given EXIF byte area and save its tag data into attributes.
private void readExifSegment(byte[] exifBytes, int imageType) throws IOException {
ByteOrderedDataInputStream dataInputStream =
@@ -3684,12 +3878,18 @@
int thumbnailOffset = jpegInterchangeFormatAttribute.getIntValue(mExifByteOrder);
int thumbnailLength = jpegInterchangeFormatLengthAttribute.getIntValue(mExifByteOrder);
- if (mMimeType == IMAGE_TYPE_JPEG || mMimeType == IMAGE_TYPE_RAF
- || mMimeType == IMAGE_TYPE_RW2 || mMimeType == IMAGE_TYPE_PNG) {
- thumbnailOffset += mExifOffset;
- } else if (mMimeType == IMAGE_TYPE_ORF) {
- // Update offset value since RAF files have IFD data preceding MakerNote data.
- thumbnailOffset += mOrfMakerNoteOffset;
+ switch (mMimeType) {
+ case IMAGE_TYPE_JPEG:
+ case IMAGE_TYPE_RAF:
+ case IMAGE_TYPE_RW2:
+ case IMAGE_TYPE_PNG:
+ case IMAGE_TYPE_WEBP:
+ thumbnailOffset += mExifOffset;
+ break;
+ case IMAGE_TYPE_ORF:
+ // Update offset value since RAF files have IFD data preceding MakerNote data.
+ thumbnailOffset += mOrfMakerNoteOffset;
+ break;
}
// The following code limits the size of thumbnail size not to overflow EXIF data area.
thumbnailLength = Math.min(thumbnailLength, in.getLength() - thumbnailOffset);
@@ -3991,7 +4191,7 @@
}
// Calculate IFD offsets.
- int position = 8;
+ int position = 8; // 8 bytes are for TIFF headers
for (int ifdType = 0; ifdType < EXIF_TAGS.length; ++ifdType) {
if (!mAttributes[ifdType].isEmpty()) {
ifdOffsets[ifdType] = position;
@@ -4006,13 +4206,16 @@
position += mThumbnailLength;
}
- // Calculate the total size
- int totalSize = position + 8; // eight bytes is for header part.
+ int totalSize = position;
+ if (mMimeType == IMAGE_TYPE_JPEG) {
+ // Add 8 bytes for APP1 size and identifier data
+ totalSize += 8;
+ }
if (DEBUG) {
- Log.d(TAG, "totalSize length: " + totalSize);
for (int i = 0; i < EXIF_TAGS.length; ++i) {
- Log.d(TAG, String.format("index: %d, offsets: %d, tag count: %d, data sizes: %d",
- i, ifdOffsets[i], mAttributes[i].size(), ifdDataSizes[i]));
+ Log.d(TAG, String.format("index: %d, offsets: %d, tag count: %d, data sizes: %d, "
+ + "total size: %d", i, ifdOffsets[i], mAttributes[i].size(),
+ ifdDataSizes[i], totalSize));
}
}
@@ -4030,9 +4233,17 @@
ifdOffsets[IFD_TYPE_INTEROPERABILITY], mExifByteOrder));
}
+ if (mMimeType == IMAGE_TYPE_JPEG) {
+ // Write JPEG specific data (APP1 size, APP1 identifier)
+ dataOutputStream.writeUnsignedShort(totalSize);
+ dataOutputStream.write(IDENTIFIER_EXIF_APP1);
+ } else if (mMimeType == IMAGE_TYPE_PNG) {
+ // Write PNG specific data (chunk size, chunk type)
+ dataOutputStream.writeInt(totalSize);
+ dataOutputStream.write(PNG_CHUNK_TYPE_EXIF);
+ }
+
// Write TIFF Headers. See JEITA CP-3451C Section 4.5.2. Table 1.
- dataOutputStream.writeUnsignedShort(totalSize);
- dataOutputStream.write(IDENTIFIER_EXIF_APP1);
dataOutputStream.writeShort(mExifByteOrder == ByteOrder.BIG_ENDIAN
? BYTE_ALIGN_MM : BYTE_ALIGN_II);
dataOutputStream.setByteOrder(mExifByteOrder);
@@ -4108,7 +4319,7 @@
* Determines the data format of EXIF entry value.
*
* @param entryValue The value to be determined.
- * @return Returns two data formats gussed as a pair in integer. If there is no two candidate
+ * @return Returns two data formats guessed as a pair in integer. If there is no two candidate
data formats for the given entry value, returns {@code -1} in the second of the pair.
*/
private static Pair<Integer, Integer> guessDataFormat(String entryValue) {
@@ -4430,7 +4641,7 @@
// An output stream to write EXIF data area, which can be written in either little or big endian
// order.
private static class ByteOrderedDataOutputStream extends FilterOutputStream {
- private final OutputStream mOutputStream;
+ final OutputStream mOutputStream;
private ByteOrder mByteOrder;
public ByteOrderedDataOutputStream(OutputStream out, ByteOrder byteOrder) {
@@ -4546,6 +4757,25 @@
}
/**
+ * Copies the given number of the bytes from {@code in} to {@code out}. Neither stream is
+ * closed.
+ */
+ private static void copy(InputStream in, OutputStream out, int numBytes) throws IOException {
+ int remainder = numBytes;
+ byte[] buffer = new byte[8192];
+ while (remainder > 0) {
+ int bytesToRead = Math.min(remainder, 8192);
+ int bytesRead = in.read(buffer, 0, bytesToRead);
+ if (bytesRead != bytesToRead) {
+ throw new IOException("Failed to copy the given amount of bytes from the input"
+ + "stream to the output stream.");
+ }
+ remainder -= bytesRead;
+ out.write(buffer, 0, bytesRead);
+ }
+ }
+
+ /**
* Convert given int[] to long[]. If long[] is given, just return it.
* Return null for other types of input.
*/
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 7906fa3..7d107dd 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -89,6 +89,10 @@
* of audio/video files and streams. An example on how to use the methods in
* this class can be found in {@link android.widget.VideoView}.
*
+ * <p>MediaPlayer is not thread-safe. Creation of and all access to player instances
+ * should be on the same thread. If registering <a href="#Callbacks">callbacks</a>,
+ * the thread must have a Looper.
+ *
* <p>Topics covered here are:
* <ol>
* <li><a href="#StateDiagram">State Diagram</a>
@@ -305,7 +309,7 @@
* </li>
* <li>When the playback reaches the end of stream, the playback completes.
* <ul>
- * <li>If the looping mode was being set to <var>true</var>with
+ * <li>If the looping mode was being set to <var>true</var> with
* {@link #setLooping(boolean)}, the MediaPlayer object shall remain in
* the <em>Started</em> state.</li>
* <li>If the looping mode was set to <var>false
@@ -554,13 +558,13 @@
* possible runtime errors during playback or streaming. Registration for
* these events is done by properly setting the appropriate listeners (via calls
* to
- * {@link #setOnPreparedListener(OnPreparedListener)}setOnPreparedListener,
- * {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)}setOnVideoSizeChangedListener,
- * {@link #setOnSeekCompleteListener(OnSeekCompleteListener)}setOnSeekCompleteListener,
- * {@link #setOnCompletionListener(OnCompletionListener)}setOnCompletionListener,
- * {@link #setOnBufferingUpdateListener(OnBufferingUpdateListener)}setOnBufferingUpdateListener,
- * {@link #setOnInfoListener(OnInfoListener)}setOnInfoListener,
- * {@link #setOnErrorListener(OnErrorListener)}setOnErrorListener, etc).
+ * {@link #setOnPreparedListener(OnPreparedListener) setOnPreparedListener},
+ * {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener) setOnVideoSizeChangedListener},
+ * {@link #setOnSeekCompleteListener(OnSeekCompleteListener) setOnSeekCompleteListener},
+ * {@link #setOnCompletionListener(OnCompletionListener) setOnCompletionListener},
+ * {@link #setOnBufferingUpdateListener(OnBufferingUpdateListener) setOnBufferingUpdateListener},
+ * {@link #setOnInfoListener(OnInfoListener) setOnInfoListener},
+ * {@link #setOnErrorListener(OnErrorListener) setOnErrorListener}, etc).
* In order to receive the respective callback
* associated with these listeners, applications are required to create
* MediaPlayer objects on a thread with its own Looper running (main UI
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index bf7da23..9723652 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -337,9 +337,14 @@
/**
* Audio source for capturing broadcast radio tuner output.
+ * Capturing the radio tuner output requires the
+ * {@link android.Manifest.permission#CAPTURE_AUDIO_OUTPUT} permission.
+ * This permission is reserved for use by system components and is not available to
+ * third-party applications.
* @hide
*/
@SystemApi
+ @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT)
public static final int RADIO_TUNER = 1998;
/**
diff --git a/media/java/android/media/audiopolicy/AudioPolicy.java b/media/java/android/media/audiopolicy/AudioPolicy.java
index 39474e1..01f1250 100644
--- a/media/java/android/media/audiopolicy/AudioPolicy.java
+++ b/media/java/android/media/audiopolicy/AudioPolicy.java
@@ -853,6 +853,10 @@
Log.v(TAG, "notifyVolumeAdjust: " + adjustment);
}
}
+
+ public void notifyUnregistration() {
+ setRegistration(null);
+ }
};
//==================================================
diff --git a/media/java/android/media/audiopolicy/IAudioPolicyCallback.aidl b/media/java/android/media/audiopolicy/IAudioPolicyCallback.aidl
index 107e7cd..1d58151 100644
--- a/media/java/android/media/audiopolicy/IAudioPolicyCallback.aidl
+++ b/media/java/android/media/audiopolicy/IAudioPolicyCallback.aidl
@@ -34,4 +34,8 @@
// callback for volume events
void notifyVolumeAdjust(int adjustment);
+
+ // callback for unregistration (e.g. if policy couldn't automatically be re-registered after
+ // an audioserver crash)
+ void notifyUnregistration();
}
diff --git a/media/java/android/media/midi/MidiDeviceInfo.aidl b/media/java/android/media/midi/MidiDeviceInfo.aidl
index 5b2ac9b..a248204 100644
--- a/media/java/android/media/midi/MidiDeviceInfo.aidl
+++ b/media/java/android/media/midi/MidiDeviceInfo.aidl
@@ -16,4 +16,4 @@
package android.media.midi;
-parcelable MidiDeviceInfo cpp_header "media/MidiDeviceInfo.h";
+parcelable MidiDeviceInfo cpp_header "MidiDeviceInfo.h";
diff --git a/media/java/android/media/tv/tuner/Tuner.java b/media/java/android/media/tv/tuner/Tuner.java
new file mode 100644
index 0000000..0228dc9
--- /dev/null
+++ b/media/java/android/media/tv/tuner/Tuner.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package android.media.tv.tuner;
+
+/**
+ * Tuner is used to interact with tuner devices.
+ *
+ * @hide
+ */
+public final class Tuner implements AutoCloseable {
+ private static final String TAG = "MediaTvTuner";
+ private static final boolean DEBUG = false;
+
+ static {
+ System.loadLibrary("media_tv_tuner");
+ nativeInit();
+ }
+
+ public Tuner() {
+ nativeSetup();
+ }
+
+ private long mNativeContext; // used by native jMediaTuner
+
+ @Override
+ public void close() {}
+
+ /**
+ * Native Initialization.
+ */
+ private static native void nativeInit();
+
+ /**
+ * Native setup.
+ */
+ private native void nativeSetup();
+}
diff --git a/media/jni/Android.bp b/media/jni/Android.bp
index b4edabf..a596d89 100644
--- a/media/jni/Android.bp
+++ b/media/jni/Android.bp
@@ -123,6 +123,30 @@
],
}
+cc_library_shared {
+ name: "libmedia_tv_tuner",
+ srcs: [
+ "android_media_tv_Tuner.cpp",
+ ],
+
+ shared_libs: [
+ "android.hardware.tv.tuner@1.0",
+ "libandroid_runtime",
+ "liblog",
+ "libutils",
+ ],
+
+ export_include_dirs: ["."],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-error=deprecated-declarations",
+ "-Wunused",
+ "-Wunreachable-code",
+ ],
+}
+
subdirs = [
"audioeffect",
"soundpool",
diff --git a/media/jni/OWNERS b/media/jni/OWNERS
index bb91d4b..f1b0237 100644
--- a/media/jni/OWNERS
+++ b/media/jni/OWNERS
@@ -1,2 +1,5 @@
# extra for MTP related files
per-file android_mtp_*.cpp=marcone@google.com,jsharkey@android.com,jameswei@google.com,rmojumder@google.com
+
+# extra for TV related files
+per-file android_media_tv_*=nchalko@google.com,quxiangfang@google.com
diff --git a/media/jni/android_media_tv_Tuner.cpp b/media/jni/android_media_tv_Tuner.cpp
new file mode 100644
index 0000000..d499eee
--- /dev/null
+++ b/media/jni/android_media_tv_Tuner.cpp
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "TvTuner-JNI"
+#include <utils/Log.h>
+
+#include "android_media_tv_Tuner.h"
+#include "android_runtime/AndroidRuntime.h"
+
+#include <android/hardware/tv/tuner/1.0/ITuner.h>
+#include <media/stagefright/foundation/ADebug.h>
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
+using ::android::hardware::tv::tuner::V1_0::ITuner;
+
+struct fields_t {
+ jfieldID context;
+};
+
+static fields_t gFields;
+
+namespace android {
+
+sp<ITuner> JTuner::mTuner;
+
+JTuner::JTuner(JNIEnv *env, jobject thiz)
+ : mClass(NULL) {
+ jclass clazz = env->GetObjectClass(thiz);
+ CHECK(clazz != NULL);
+
+ mClass = (jclass)env->NewGlobalRef(clazz);
+ mObject = env->NewWeakGlobalRef(thiz);
+ if (mTuner == NULL) {
+ mTuner = getTunerService();
+ }
+}
+
+JTuner::~JTuner() {
+ JNIEnv *env = AndroidRuntime::getJNIEnv();
+
+ env->DeleteGlobalRef(mClass);
+ mTuner = NULL;
+ mClass = NULL;
+ mObject = NULL;
+}
+
+sp<ITuner> JTuner::getTunerService() {
+ if (mTuner == nullptr) {
+ mTuner = ITuner::getService();
+
+ if (mTuner == nullptr) {
+ ALOGW("Failed to get tuner service.");
+ }
+ }
+ return mTuner;
+}
+
+} // namespace android
+
+////////////////////////////////////////////////////////////////////////////////
+
+using namespace android;
+
+static sp<JTuner> setTuner(JNIEnv *env, jobject thiz, const sp<JTuner> &tuner) {
+ sp<JTuner> old = (JTuner *)env->GetLongField(thiz, gFields.context);
+
+ if (tuner != NULL) {
+ tuner->incStrong(thiz);
+ }
+ if (old != NULL) {
+ old->decStrong(thiz);
+ }
+ env->SetLongField(thiz, gFields.context, (jlong)tuner.get());
+
+ return old;
+}
+
+static sp<JTuner> getTuner(JNIEnv *env, jobject thiz) {
+ return (JTuner *)env->GetLongField(thiz, gFields.context);
+}
+
+static void android_media_tv_Tuner_native_init(JNIEnv *env) {
+ jclass clazz = env->FindClass("android/media/tv/tuner/Tuner");
+ CHECK(clazz != NULL);
+
+ gFields.context = env->GetFieldID(clazz, "mNativeContext", "J");
+ CHECK(gFields.context != NULL);
+}
+
+static void android_media_tv_Tuner_native_setup(JNIEnv *env, jobject thiz) {
+ sp<JTuner> tuner = new JTuner(env, thiz);
+ setTuner(env,thiz, tuner);
+}
+
+static const JNINativeMethod gMethods[] = {
+ { "nativeInit", "()V", (void *)android_media_tv_Tuner_native_init },
+ { "nativeSetup", "()V", (void *)android_media_tv_Tuner_native_setup },
+};
+
+static int register_android_media_tv_Tuner(JNIEnv *env) {
+ return AndroidRuntime::registerNativeMethods(
+ env, "android/media/tv/tuner/Tuner", gMethods, NELEM(gMethods));
+}
+
+jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
+{
+ JNIEnv* env = NULL;
+ jint result = -1;
+
+ if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+ ALOGE("ERROR: GetEnv failed\n");
+ return result;
+ }
+ assert(env != NULL);
+
+ if (register_android_media_tv_Tuner(env) != JNI_OK) {
+ ALOGE("ERROR: Tuner native registration failed\n");
+ return result;
+ }
+ return JNI_VERSION_1_4;
+}
diff --git a/media/jni/android_media_tv_Tuner.h b/media/jni/android_media_tv_Tuner.h
new file mode 100644
index 0000000..e7d5924
--- /dev/null
+++ b/media/jni/android_media_tv_Tuner.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+#ifndef _ANDROID_MEDIA_TV_TUNER_H_
+#define _ANDROID_MEDIA_TV_TUNER_H_
+
+#include <android/hardware/tv/tuner/1.0/ITuner.h>
+#include <utils/RefBase.h>
+
+#include "jni.h"
+
+using ::android::hardware::tv::tuner::V1_0::ITuner;
+
+namespace android {
+
+struct JTuner : public RefBase {
+ JTuner(JNIEnv *env, jobject thiz);
+ sp<ITuner> getTunerService();
+protected:
+ virtual ~JTuner();
+
+private:
+ jclass mClass;
+ jweak mObject;
+ static sp<ITuner> mTuner;
+};
+
+} // namespace android
+
+#endif // _ANDROID_MEDIA_TV_TUNER_H_
diff --git a/media/jni/audioeffect/Android.bp b/media/jni/audioeffect/Android.bp
index 09c546a..41ab670 100644
--- a/media/jni/audioeffect/Android.bp
+++ b/media/jni/audioeffect/Android.bp
@@ -6,6 +6,7 @@
"android_media_SourceDefaultEffect.cpp",
"android_media_StreamDefaultEffect.cpp",
"android_media_Visualizer.cpp",
+ "Visualizer.cpp",
],
shared_libs: [
@@ -14,10 +15,12 @@
"libutils",
"libandroid_runtime",
"libnativehelper",
- "libmedia",
"libaudioclient",
+ "libaudioutils",
],
+ version_script: "exports.lds",
+
cflags: [
"-Wall",
"-Werror",
diff --git a/media/jni/audioeffect/Visualizer.cpp b/media/jni/audioeffect/Visualizer.cpp
new file mode 100644
index 0000000..83f3b6e
--- /dev/null
+++ b/media/jni/audioeffect/Visualizer.cpp
@@ -0,0 +1,446 @@
+/*
+**
+** Copyright 2010, 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.
+*/
+
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Visualizer"
+#include <utils/Log.h>
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <limits.h>
+
+#include <audio_utils/fixedfft.h>
+#include <utils/Thread.h>
+
+#include "Visualizer.h"
+
+namespace android {
+
+// ---------------------------------------------------------------------------
+
+Visualizer::Visualizer (const String16& opPackageName,
+ int32_t priority,
+ effect_callback_t cbf,
+ void* user,
+ audio_session_t sessionId)
+ : AudioEffect(SL_IID_VISUALIZATION, opPackageName, NULL, priority, cbf, user, sessionId),
+ mCaptureRate(CAPTURE_RATE_DEF),
+ mCaptureSize(CAPTURE_SIZE_DEF),
+ mSampleRate(44100000),
+ mScalingMode(VISUALIZER_SCALING_MODE_NORMALIZED),
+ mMeasurementMode(MEASUREMENT_MODE_NONE),
+ mCaptureCallBack(NULL),
+ mCaptureCbkUser(NULL)
+{
+ initCaptureSize();
+}
+
+Visualizer::~Visualizer()
+{
+ ALOGV("Visualizer::~Visualizer()");
+ setEnabled(false);
+ setCaptureCallBack(NULL, NULL, 0, 0);
+}
+
+void Visualizer::release()
+{
+ ALOGV("Visualizer::release()");
+ setEnabled(false);
+ Mutex::Autolock _l(mCaptureLock);
+
+ mCaptureThread.clear();
+ mCaptureCallBack = NULL;
+ mCaptureCbkUser = NULL;
+ mCaptureFlags = 0;
+ mCaptureRate = 0;
+}
+
+status_t Visualizer::setEnabled(bool enabled)
+{
+ Mutex::Autolock _l(mCaptureLock);
+
+ sp<CaptureThread> t = mCaptureThread;
+ if (t != 0) {
+ if (enabled) {
+ if (t->exitPending()) {
+ mCaptureLock.unlock();
+ if (t->requestExitAndWait() == WOULD_BLOCK) {
+ mCaptureLock.lock();
+ ALOGE("Visualizer::enable() called from thread");
+ return INVALID_OPERATION;
+ }
+ mCaptureLock.lock();
+ }
+ }
+ t->mLock.lock();
+ }
+
+ status_t status = AudioEffect::setEnabled(enabled);
+
+ if (t != 0) {
+ if (enabled && status == NO_ERROR) {
+ t->run("Visualizer");
+ } else {
+ t->requestExit();
+ }
+ }
+
+ if (t != 0) {
+ t->mLock.unlock();
+ }
+
+ return status;
+}
+
+status_t Visualizer::setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags,
+ uint32_t rate)
+{
+ if (rate > CAPTURE_RATE_MAX) {
+ return BAD_VALUE;
+ }
+ Mutex::Autolock _l(mCaptureLock);
+
+ if (mEnabled) {
+ return INVALID_OPERATION;
+ }
+
+ if (mCaptureThread != 0) {
+ mCaptureLock.unlock();
+ mCaptureThread->requestExitAndWait();
+ mCaptureLock.lock();
+ }
+
+ mCaptureThread.clear();
+ mCaptureCallBack = cbk;
+ mCaptureCbkUser = user;
+ mCaptureFlags = flags;
+ mCaptureRate = rate;
+
+ if (cbk != NULL) {
+ mCaptureThread = new CaptureThread(this, rate, ((flags & CAPTURE_CALL_JAVA) != 0));
+ }
+ ALOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x",
+ rate, mCaptureThread.get(), mCaptureFlags);
+ return NO_ERROR;
+}
+
+status_t Visualizer::setCaptureSize(uint32_t size)
+{
+ if (size > VISUALIZER_CAPTURE_SIZE_MAX ||
+ size < VISUALIZER_CAPTURE_SIZE_MIN ||
+ popcount(size) != 1) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mCaptureLock);
+ if (mEnabled) {
+ return INVALID_OPERATION;
+ }
+
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE;
+ *((int32_t *)p->data + 1)= size;
+ status_t status = setParameter(p);
+
+ ALOGV("setCaptureSize size %d status %d p->status %d", size, status, p->status);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ if (status == NO_ERROR) {
+ mCaptureSize = size;
+ }
+ }
+
+ return status;
+}
+
+status_t Visualizer::setScalingMode(uint32_t mode) {
+ if ((mode != VISUALIZER_SCALING_MODE_NORMALIZED)
+ && (mode != VISUALIZER_SCALING_MODE_AS_PLAYED)) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mCaptureLock);
+
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_SCALING_MODE;
+ *((int32_t *)p->data + 1)= mode;
+ status_t status = setParameter(p);
+
+ ALOGV("setScalingMode mode %d status %d p->status %d", mode, status, p->status);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ if (status == NO_ERROR) {
+ mScalingMode = mode;
+ }
+ }
+
+ return status;
+}
+
+status_t Visualizer::setMeasurementMode(uint32_t mode) {
+ if ((mode != MEASUREMENT_MODE_NONE)
+ //Note: needs to be handled as a mask when more measurement modes are added
+ && ((mode & MEASUREMENT_MODE_PEAK_RMS) != mode)) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mCaptureLock);
+
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_MEASUREMENT_MODE;
+ *((int32_t *)p->data + 1)= mode;
+ status_t status = setParameter(p);
+
+ ALOGV("setMeasurementMode mode %d status %d p->status %d", mode, status, p->status);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ if (status == NO_ERROR) {
+ mMeasurementMode = mode;
+ }
+ }
+ return status;
+}
+
+status_t Visualizer::getIntMeasurements(uint32_t type, uint32_t number, int32_t *measurements) {
+ if (mMeasurementMode == MEASUREMENT_MODE_NONE) {
+ ALOGE("Cannot retrieve int measurements, no measurement mode set");
+ return INVALID_OPERATION;
+ }
+ if (!(mMeasurementMode & type)) {
+ // measurement type has not been set on this Visualizer
+ ALOGE("Cannot retrieve int measurements, requested measurement mode 0x%x not set(0x%x)",
+ type, mMeasurementMode);
+ return INVALID_OPERATION;
+ }
+ // only peak+RMS measurement supported
+ if ((type != MEASUREMENT_MODE_PEAK_RMS)
+ // for peak+RMS measurement, the results are 2 int32_t values
+ || (number != 2)) {
+ ALOGE("Cannot retrieve int measurements, MEASUREMENT_MODE_PEAK_RMS returns 2 ints, not %d",
+ number);
+ return BAD_VALUE;
+ }
+
+ status_t status = NO_ERROR;
+ if (mEnabled) {
+ uint32_t replySize = number * sizeof(int32_t);
+ status = command(VISUALIZER_CMD_MEASURE,
+ sizeof(uint32_t) /*cmdSize*/,
+ &type /*cmdData*/,
+ &replySize, measurements);
+ ALOGV("getMeasurements() command returned %d", status);
+ if ((status == NO_ERROR) && (replySize == 0)) {
+ status = NOT_ENOUGH_DATA;
+ }
+ } else {
+ ALOGV("getMeasurements() disabled");
+ return INVALID_OPERATION;
+ }
+ return status;
+}
+
+status_t Visualizer::getWaveForm(uint8_t *waveform)
+{
+ if (waveform == NULL) {
+ return BAD_VALUE;
+ }
+ if (mCaptureSize == 0) {
+ return NO_INIT;
+ }
+
+ status_t status = NO_ERROR;
+ if (mEnabled) {
+ uint32_t replySize = mCaptureSize;
+ status = command(VISUALIZER_CMD_CAPTURE, 0, NULL, &replySize, waveform);
+ ALOGV("getWaveForm() command returned %d", status);
+ if ((status == NO_ERROR) && (replySize == 0)) {
+ status = NOT_ENOUGH_DATA;
+ }
+ } else {
+ ALOGV("getWaveForm() disabled");
+ memset(waveform, 0x80, mCaptureSize);
+ }
+ return status;
+}
+
+status_t Visualizer::getFft(uint8_t *fft)
+{
+ if (fft == NULL) {
+ return BAD_VALUE;
+ }
+ if (mCaptureSize == 0) {
+ return NO_INIT;
+ }
+
+ status_t status = NO_ERROR;
+ if (mEnabled) {
+ uint8_t buf[mCaptureSize];
+ status = getWaveForm(buf);
+ if (status == NO_ERROR) {
+ status = doFft(fft, buf);
+ }
+ } else {
+ memset(fft, 0, mCaptureSize);
+ }
+ return status;
+}
+
+status_t Visualizer::doFft(uint8_t *fft, uint8_t *waveform)
+{
+ int32_t workspace[mCaptureSize >> 1];
+ int32_t nonzero = 0;
+
+ for (uint32_t i = 0; i < mCaptureSize; i += 2) {
+ workspace[i >> 1] =
+ ((waveform[i] ^ 0x80) << 24) | ((waveform[i + 1] ^ 0x80) << 8);
+ nonzero |= workspace[i >> 1];
+ }
+
+ if (nonzero) {
+ fixed_fft_real(mCaptureSize >> 1, workspace);
+ }
+
+ for (uint32_t i = 0; i < mCaptureSize; i += 2) {
+ short tmp = workspace[i >> 1] >> 21;
+ while (tmp > 127 || tmp < -128) tmp >>= 1;
+ fft[i] = tmp;
+ tmp = workspace[i >> 1];
+ tmp >>= 5;
+ while (tmp > 127 || tmp < -128) tmp >>= 1;
+ fft[i + 1] = tmp;
+ }
+
+ return NO_ERROR;
+}
+
+void Visualizer::periodicCapture()
+{
+ Mutex::Autolock _l(mCaptureLock);
+ ALOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x",
+ this, mCaptureCallBack, mCaptureFlags);
+ if (mCaptureCallBack != NULL &&
+ (mCaptureFlags & (CAPTURE_WAVEFORM|CAPTURE_FFT)) &&
+ mCaptureSize != 0) {
+ uint8_t waveform[mCaptureSize];
+ status_t status = getWaveForm(waveform);
+ if (status != NO_ERROR) {
+ return;
+ }
+ uint8_t fft[mCaptureSize];
+ if (mCaptureFlags & CAPTURE_FFT) {
+ status = doFft(fft, waveform);
+ }
+ if (status != NO_ERROR) {
+ return;
+ }
+ uint8_t *wavePtr = NULL;
+ uint8_t *fftPtr = NULL;
+ uint32_t waveSize = 0;
+ uint32_t fftSize = 0;
+ if (mCaptureFlags & CAPTURE_WAVEFORM) {
+ wavePtr = waveform;
+ waveSize = mCaptureSize;
+ }
+ if (mCaptureFlags & CAPTURE_FFT) {
+ fftPtr = fft;
+ fftSize = mCaptureSize;
+ }
+ mCaptureCallBack(mCaptureCbkUser, waveSize, wavePtr, fftSize, fftPtr, mSampleRate);
+ }
+}
+
+uint32_t Visualizer::initCaptureSize()
+{
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE;
+ status_t status = getParameter(p);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ }
+
+ uint32_t size = 0;
+ if (status == NO_ERROR) {
+ size = *((int32_t *)p->data + 1);
+ }
+ mCaptureSize = size;
+
+ ALOGV("initCaptureSize size %d status %d", mCaptureSize, status);
+
+ return size;
+}
+
+void Visualizer::controlStatusChanged(bool controlGranted) {
+ if (controlGranted) {
+ // this Visualizer instance regained control of the effect, reset the scaling mode
+ // and capture size as has been cached through it.
+ ALOGV("controlStatusChanged(true) causes effect parameter reset:");
+ ALOGV(" scaling mode reset to %d", mScalingMode);
+ setScalingMode(mScalingMode);
+ ALOGV(" capture size reset to %d", mCaptureSize);
+ setCaptureSize(mCaptureSize);
+ }
+ AudioEffect::controlStatusChanged(controlGranted);
+}
+
+//-------------------------------------------------------------------------
+
+Visualizer::CaptureThread::CaptureThread(Visualizer* receiver, uint32_t captureRate,
+ bool bCanCallJava)
+ : Thread(bCanCallJava), mReceiver(receiver)
+{
+ mSleepTimeUs = 1000000000 / captureRate;
+ ALOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs);
+}
+
+bool Visualizer::CaptureThread::threadLoop()
+{
+ ALOGV("CaptureThread %p enter", this);
+ sp<Visualizer> receiver = mReceiver.promote();
+ if (receiver == NULL) {
+ return false;
+ }
+ while (!exitPending())
+ {
+ usleep(mSleepTimeUs);
+ receiver->periodicCapture();
+ }
+ ALOGV("CaptureThread %p exiting", this);
+ return false;
+}
+
+} // namespace android
diff --git a/media/jni/audioeffect/Visualizer.h b/media/jni/audioeffect/Visualizer.h
new file mode 100644
index 0000000..d4672a9
--- /dev/null
+++ b/media/jni/audioeffect/Visualizer.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef ANDROID_MEDIA_VISUALIZER_H
+#define ANDROID_MEDIA_VISUALIZER_H
+
+#include <media/AudioEffect.h>
+#include <system/audio_effects/effect_visualizer.h>
+#include <utils/Thread.h>
+
+/**
+ * The Visualizer class enables application to retrieve part of the currently playing audio for
+ * visualization purpose. It is not an audio recording interface and only returns partial and low
+ * quality audio content. However, to protect privacy of certain audio data (e.g voice mail) the use
+ * of the visualizer requires the permission android.permission.RECORD_AUDIO.
+ * The audio session ID passed to the constructor indicates which audio content should be
+ * visualized:
+ * - If the session is 0, the audio output mix is visualized
+ * - If the session is not 0, the audio from a particular MediaPlayer or AudioTrack
+ * using this audio session is visualized
+ * Two types of representation of audio content can be captured:
+ * - Waveform data: consecutive 8-bit (unsigned) mono samples by using the getWaveForm() method
+ * - Frequency data: 8-bit magnitude FFT by using the getFft() method
+ *
+ * The length of the capture can be retrieved or specified by calling respectively
+ * getCaptureSize() and setCaptureSize() methods. Note that the size of the FFT
+ * is half of the specified capture size but both sides of the spectrum are returned yielding in a
+ * number of bytes equal to the capture size. The capture size must be a power of 2 in the range
+ * returned by getMinCaptureSize() and getMaxCaptureSize().
+ * In addition to the polling capture mode, a callback mode is also available by installing a
+ * callback function by use of the setCaptureCallBack() method. The rate at which the callback
+ * is called as well as the type of data returned is specified.
+ * Before capturing data, the Visualizer must be enabled by calling the setEnabled() method.
+ * When data capture is not needed any more, the Visualizer should be disabled.
+ */
+
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+class Visualizer: public AudioEffect {
+public:
+
+ enum callback_flags {
+ CAPTURE_WAVEFORM = 0x00000001, // capture callback returns a PCM wave form
+ CAPTURE_FFT = 0x00000002, // apture callback returns a frequency representation
+ CAPTURE_CALL_JAVA = 0x00000004 // the callback thread can call java
+ };
+
+
+ /* Constructor.
+ * See AudioEffect constructor for details on parameters.
+ */
+ Visualizer(const String16& opPackageName,
+ int32_t priority = 0,
+ effect_callback_t cbf = NULL,
+ void* user = NULL,
+ audio_session_t sessionId = AUDIO_SESSION_OUTPUT_MIX);
+
+ ~Visualizer();
+
+ // Declared 'final' because we call this in ~Visualizer().
+ status_t setEnabled(bool enabled) final;
+
+ // maximum capture size in samples
+ static uint32_t getMaxCaptureSize() { return VISUALIZER_CAPTURE_SIZE_MAX; }
+ // minimum capture size in samples
+ static uint32_t getMinCaptureSize() { return VISUALIZER_CAPTURE_SIZE_MIN; }
+ // maximum capture rate in millihertz
+ static uint32_t getMaxCaptureRate() { return CAPTURE_RATE_MAX; }
+
+ // callback used to return periodic PCM or FFT captures to the application. Either one or both
+ // types of data are returned (PCM and FFT) according to flags indicated when installing the
+ // callback. When a type of data is not present, the corresponding size (waveformSize or
+ // fftSize) is 0.
+ typedef void (*capture_cbk_t)(void* user,
+ uint32_t waveformSize,
+ uint8_t *waveform,
+ uint32_t fftSize,
+ uint8_t *fft,
+ uint32_t samplingrate);
+
+ // install a callback to receive periodic captures. The capture rate is specified in milliHertz
+ // and the capture format is according to flags (see callback_flags).
+ status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate);
+
+ // set the capture size capture size must be a power of two in the range
+ // [VISUALIZER_CAPTURE_SIZE_MAX. VISUALIZER_CAPTURE_SIZE_MIN]
+ // must be called when the visualizer is not enabled
+ status_t setCaptureSize(uint32_t size);
+ uint32_t getCaptureSize() { return mCaptureSize; }
+
+ // returns the capture rate indicated when installing the callback
+ uint32_t getCaptureRate() { return mCaptureRate; }
+
+ // returns the sampling rate of the audio being captured
+ uint32_t getSamplingRate() { return mSampleRate; }
+
+ // set the way volume affects the captured data
+ // mode must one of VISUALIZER_SCALING_MODE_NORMALIZED,
+ // VISUALIZER_SCALING_MODE_AS_PLAYED
+ status_t setScalingMode(uint32_t mode);
+ uint32_t getScalingMode() { return mScalingMode; }
+
+ // set which measurements are done on the audio buffers processed by the effect.
+ // valid measurements (mask): MEASUREMENT_MODE_PEAK_RMS
+ status_t setMeasurementMode(uint32_t mode);
+ uint32_t getMeasurementMode() { return mMeasurementMode; }
+
+ // return a set of int32_t measurements
+ status_t getIntMeasurements(uint32_t type, uint32_t number, int32_t *measurements);
+
+ // return a capture in PCM 8 bit unsigned format. The size of the capture is equal to
+ // getCaptureSize()
+ status_t getWaveForm(uint8_t *waveform);
+
+ // return a capture in FFT 8 bit signed format. The size of the capture is equal to
+ // getCaptureSize() but the length of the FFT is half of the size (both parts of the spectrum
+ // are returned
+ status_t getFft(uint8_t *fft);
+ void release();
+
+protected:
+ // from IEffectClient
+ virtual void controlStatusChanged(bool controlGranted);
+
+private:
+
+ static const uint32_t CAPTURE_RATE_MAX = 20000;
+ static const uint32_t CAPTURE_RATE_DEF = 10000;
+ static const uint32_t CAPTURE_SIZE_DEF = VISUALIZER_CAPTURE_SIZE_MAX;
+
+ /* internal class to handle the callback */
+ class CaptureThread : public Thread
+ {
+ public:
+ CaptureThread(Visualizer* visualizer, uint32_t captureRate, bool bCanCallJava = false);
+
+ private:
+ friend class Visualizer;
+ virtual bool threadLoop();
+ wp<Visualizer> mReceiver;
+ Mutex mLock;
+ uint32_t mSleepTimeUs;
+ };
+
+ status_t doFft(uint8_t *fft, uint8_t *waveform);
+ void periodicCapture();
+ uint32_t initCaptureSize();
+
+ Mutex mCaptureLock;
+ uint32_t mCaptureRate;
+ uint32_t mCaptureSize;
+ uint32_t mSampleRate;
+ uint32_t mScalingMode;
+ uint32_t mMeasurementMode;
+ capture_cbk_t mCaptureCallBack;
+ void *mCaptureCbkUser;
+ sp<CaptureThread> mCaptureThread;
+ uint32_t mCaptureFlags;
+};
+
+
+}; // namespace android
+
+#endif // ANDROID_MEDIA_VISUALIZER_H
diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp
index 45de36e..1362433 100644
--- a/media/jni/audioeffect/android_media_Visualizer.cpp
+++ b/media/jni/audioeffect/android_media_Visualizer.cpp
@@ -24,7 +24,7 @@
#include <nativehelper/JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
#include <utils/threads.h>
-#include "media/Visualizer.h"
+#include "Visualizer.h"
#include <nativehelper/ScopedUtfChars.h>
diff --git a/media/jni/audioeffect/exports.lds b/media/jni/audioeffect/exports.lds
new file mode 100644
index 0000000..70491f4
--- /dev/null
+++ b/media/jni/audioeffect/exports.lds
@@ -0,0 +1,6 @@
+{
+ global:
+ *;
+ local:
+ *android10Visualizer*;
+};
diff --git a/media/jni/soundpool/Android.bp b/media/jni/soundpool/Android.bp
index 35b7b01..0be2514 100644
--- a/media/jni/soundpool/Android.bp
+++ b/media/jni/soundpool/Android.bp
@@ -3,11 +3,20 @@
srcs: [
"android_media_SoundPool.cpp",
+ "Sound.cpp",
+ "SoundDecoder.cpp",
+ "SoundManager.cpp",
"SoundPool.cpp",
- "SoundPoolThread.cpp",
+ "Stream.cpp",
+ "StreamManager.cpp",
+ ],
+
+ header_libs: [
+ "libmedia_headers",
],
shared_libs: [
+ "libaudioutils",
"liblog",
"libcutils",
"libutils",
diff --git a/media/jni/soundpool/Sound.cpp b/media/jni/soundpool/Sound.cpp
new file mode 100644
index 0000000..0bbc3e4
--- /dev/null
+++ b/media/jni/soundpool/Sound.cpp
@@ -0,0 +1,241 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SoundPool::Sound"
+#include <utils/Log.h>
+
+#include "Sound.h"
+
+#include <media/NdkMediaCodec.h>
+#include <media/NdkMediaExtractor.h>
+#include <media/NdkMediaFormat.h>
+
+namespace android::soundpool {
+
+constexpr uint32_t kMaxSampleRate = 192000;
+constexpr size_t kDefaultHeapSize = 1024 * 1024; // 1MB (compatible with low mem devices)
+
+Sound::Sound(int32_t soundID, int fd, int64_t offset, int64_t length)
+ : mSoundID(soundID)
+ , mFd(dup(fd))
+ , mOffset(offset)
+ , mLength(length)
+{
+ ALOGV("%s(soundID=%d, fd=%d, offset=%lld, length=%lld)",
+ __func__, soundID, fd, (long long)offset, (long long)length);
+ ALOGW_IF(mFd == -1, "Unable to dup descriptor %d", fd);
+}
+
+Sound::~Sound()
+{
+ ALOGV("%s(soundID=%d, fd=%d)", __func__, mSoundID, mFd.get());
+}
+
+static status_t decode(int fd, int64_t offset, int64_t length,
+ uint32_t *rate, int32_t *channelCount, audio_format_t *audioFormat,
+ audio_channel_mask_t *channelMask, sp<MemoryHeapBase> heap,
+ size_t *sizeInBytes) {
+ ALOGV("%s(fd=%d, offset=%lld, length=%lld, ...)",
+ __func__, fd, (long long)offset, (long long)length);
+ std::unique_ptr<AMediaExtractor, decltype(&AMediaExtractor_delete)> ex{
+ AMediaExtractor_new(), &AMediaExtractor_delete};
+ status_t err = AMediaExtractor_setDataSourceFd(ex.get(), fd, offset, length);
+
+ if (err != AMEDIA_OK) {
+ return err;
+ }
+
+ *audioFormat = AUDIO_FORMAT_PCM_16_BIT; // default format for audio codecs.
+ const size_t numTracks = AMediaExtractor_getTrackCount(ex.get());
+ for (size_t i = 0; i < numTracks; i++) {
+ std::unique_ptr<AMediaFormat, decltype(&AMediaFormat_delete)> format{
+ AMediaExtractor_getTrackFormat(ex.get(), i), &AMediaFormat_delete};
+ const char *mime;
+ if (!AMediaFormat_getString(format.get(), AMEDIAFORMAT_KEY_MIME, &mime)) {
+ return UNKNOWN_ERROR;
+ }
+ if (strncmp(mime, "audio/", 6) == 0) {
+ std::unique_ptr<AMediaCodec, decltype(&AMediaCodec_delete)> codec{
+ AMediaCodec_createDecoderByType(mime), &AMediaCodec_delete};
+ if (codec == nullptr
+ || AMediaCodec_configure(codec.get(), format.get(),
+ nullptr /* window */, nullptr /* drm */, 0 /* flags */) != AMEDIA_OK
+ || AMediaCodec_start(codec.get()) != AMEDIA_OK
+ || AMediaExtractor_selectTrack(ex.get(), i) != AMEDIA_OK) {
+ return UNKNOWN_ERROR;
+ }
+
+ bool sawInputEOS = false;
+ bool sawOutputEOS = false;
+ uint8_t* writePos = static_cast<uint8_t*>(heap->getBase());
+ size_t available = heap->getSize();
+ size_t written = 0;
+ format.reset(AMediaCodec_getOutputFormat(codec.get())); // update format.
+
+ while (!sawOutputEOS) {
+ if (!sawInputEOS) {
+ ssize_t bufidx = AMediaCodec_dequeueInputBuffer(codec.get(), 5000);
+ ALOGV("%s: input buffer %zd", __func__, bufidx);
+ if (bufidx >= 0) {
+ size_t bufsize;
+ uint8_t * const buf = AMediaCodec_getInputBuffer(
+ codec.get(), bufidx, &bufsize);
+ if (buf == nullptr) {
+ ALOGE("%s: AMediaCodec_getInputBuffer returned nullptr, short decode",
+ __func__);
+ break;
+ }
+ int sampleSize = AMediaExtractor_readSampleData(ex.get(), buf, bufsize);
+ ALOGV("%s: read %d", __func__, sampleSize);
+ if (sampleSize < 0) {
+ sampleSize = 0;
+ sawInputEOS = true;
+ ALOGV("%s: EOS", __func__);
+ }
+ const int64_t presentationTimeUs = AMediaExtractor_getSampleTime(ex.get());
+
+ const media_status_t mstatus = AMediaCodec_queueInputBuffer(
+ codec.get(), bufidx,
+ 0 /* offset */, sampleSize, presentationTimeUs,
+ sawInputEOS ? AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM : 0);
+ if (mstatus != AMEDIA_OK) {
+ // AMEDIA_ERROR_UNKNOWN == { -ERANGE -EINVAL -EACCES }
+ ALOGE("%s: AMediaCodec_queueInputBuffer returned status %d,"
+ "short decode",
+ __func__, (int)mstatus);
+ break;
+ }
+ (void)AMediaExtractor_advance(ex.get());
+ }
+ }
+
+ AMediaCodecBufferInfo info;
+ const int status = AMediaCodec_dequeueOutputBuffer(codec.get(), &info, 1);
+ ALOGV("%s: dequeueoutput returned: %d", __func__, status);
+ if (status >= 0) {
+ if (info.flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) {
+ ALOGV("%s: output EOS", __func__);
+ sawOutputEOS = true;
+ }
+ ALOGV("%s: got decoded buffer size %d", __func__, info.size);
+
+ const uint8_t * const buf = AMediaCodec_getOutputBuffer(
+ codec.get(), status, nullptr /* out_size */);
+ if (buf == nullptr) {
+ ALOGE("%s: AMediaCodec_getOutputBuffer returned nullptr, short decode",
+ __func__);
+ break;
+ }
+ const size_t dataSize = std::min((size_t)info.size, available);
+ memcpy(writePos, buf + info.offset, dataSize);
+ writePos += dataSize;
+ written += dataSize;
+ available -= dataSize;
+ const media_status_t mstatus = AMediaCodec_releaseOutputBuffer(
+ codec.get(), status, false /* render */);
+ if (mstatus != AMEDIA_OK) {
+ // AMEDIA_ERROR_UNKNOWN == { -ERANGE -EINVAL -EACCES }
+ ALOGE("%s: AMediaCodec_releaseOutputBuffer"
+ " returned status %d, short decode",
+ __func__, (int)mstatus);
+ break;
+ }
+ if (available == 0) {
+ // there might be more data, but there's no space for it
+ sawOutputEOS = true;
+ }
+ } else if (status == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
+ ALOGV("%s: output buffers changed", __func__);
+ } else if (status == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) {
+ format.reset(AMediaCodec_getOutputFormat(codec.get())); // update format
+ ALOGV("%s: format changed to: %s",
+ __func__, AMediaFormat_toString(format.get()));
+ } else if (status == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
+ ALOGV("%s: no output buffer right now", __func__);
+ } else if (status <= AMEDIA_ERROR_BASE) {
+ ALOGE("%s: decode error: %d", __func__, status);
+ break;
+ } else {
+ ALOGV("%s: unexpected info code: %d", __func__, status);
+ }
+ }
+
+ (void)AMediaCodec_stop(codec.get());
+ if (!AMediaFormat_getInt32(
+ format.get(), AMEDIAFORMAT_KEY_SAMPLE_RATE, (int32_t*) rate) ||
+ !AMediaFormat_getInt32(
+ format.get(), AMEDIAFORMAT_KEY_CHANNEL_COUNT, channelCount)) {
+ return UNKNOWN_ERROR;
+ }
+ if (!AMediaFormat_getInt32(format.get(), AMEDIAFORMAT_KEY_CHANNEL_MASK,
+ (int32_t*) channelMask)) {
+ *channelMask = AUDIO_CHANNEL_NONE;
+ }
+ *sizeInBytes = written;
+ return OK;
+ }
+ }
+ return UNKNOWN_ERROR;
+}
+
+status_t Sound::doLoad()
+{
+ ALOGV("%s()", __func__);
+ status_t status = NO_INIT;
+ if (mFd.get() != -1) {
+ mHeap = new MemoryHeapBase(kDefaultHeapSize);
+
+ ALOGV("%s: start decode", __func__);
+ uint32_t sampleRate;
+ int32_t channelCount;
+ audio_format_t format;
+ audio_channel_mask_t channelMask;
+ status_t status = decode(mFd.get(), mOffset, mLength, &sampleRate, &channelCount, &format,
+ &channelMask, mHeap, &mSizeInBytes);
+ ALOGV("%s: close(%d)", __func__, mFd.get());
+ mFd.reset(); // close
+
+ if (status != NO_ERROR) {
+ ALOGE("%s: unable to load sound", __func__);
+ } else if (sampleRate > kMaxSampleRate) {
+ ALOGE("%s: sample rate (%u) out of range", __func__, sampleRate);
+ status = BAD_VALUE;
+ } else if (channelCount < 1 || channelCount > FCC_8) {
+ ALOGE("%s: sample channel count (%d) out of range", __func__, channelCount);
+ status = BAD_VALUE;
+ } else {
+ // Correctly loaded, proper parameters
+ ALOGV("%s: pointer = %p, sizeInBytes = %zu, sampleRate = %u, channelCount = %d",
+ __func__, mHeap->getBase(), mSizeInBytes, sampleRate, channelCount);
+ mData = new MemoryBase(mHeap, 0, mSizeInBytes);
+ mSampleRate = sampleRate;
+ mChannelCount = channelCount;
+ mFormat = format;
+ mChannelMask = channelMask;
+ mState = READY; // this should be last, as it is an atomic sync point
+ return NO_ERROR;
+ }
+ } else {
+ ALOGE("%s: uninitialized fd, dup failed", __func__);
+ }
+ // ERROR handling
+ mHeap.clear();
+ mState = DECODE_ERROR; // this should be last, as it is an atomic sync point
+ return status;
+}
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/Sound.h b/media/jni/soundpool/Sound.h
new file mode 100644
index 0000000..efe940a
--- /dev/null
+++ b/media/jni/soundpool/Sound.h
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <android-base/unique_fd.h>
+#include <binder/MemoryBase.h>
+#include <binder/MemoryHeapBase.h>
+#include <system/audio.h>
+
+namespace android::soundpool {
+
+class SoundDecoder;
+
+/**
+ * Sound is a resource used by SoundPool, referenced by soundID.
+ *
+ * After loading, it is effectively const so no locking required.
+ * However, in order to guarantee that all the values have been
+ * written properly and read properly, we use the mState as an atomic synchronization
+ * point. So if getState() shows READY, then all the other getters may
+ * be safely read.
+ *
+ * Technical details:
+ * We access the mState atomic value through memory_order_seq_cst
+ *
+ * https://en.cppreference.com/w/cpp/atomic/memory_order
+ *
+ * which provides memory barriers. So if the last value written by the SoundDecoder
+ * is mState, then the compiler ensures no other prior writes by SoundDecoder will be
+ * reordered afterwards, and memory barrier is placed (as necessary) to ensure the
+ * cache is visible to other processors.
+ *
+ * Likewise, if the first value read by SoundPool is mState,
+ * the compiler ensures no reads for that thread will be reordered before mState is read,
+ * and a memory barrier is placed (as necessary) to ensure that the cache is properly
+ * updated with other processor's writes before reading.
+ *
+ * See https://developer.android.com/training/articles/smp for discussions about
+ * the variant load-acquire, store-release semantics.
+ */
+class Sound {
+ friend SoundDecoder; // calls doLoad().
+
+public:
+ enum sound_state : int32_t { LOADING, READY, DECODE_ERROR };
+ // A sound starts in the LOADING state and transitions only once
+ // to either READY or DECODE_ERROR when doLoad() is called.
+
+ Sound(int soundID, int fd, int64_t offset, int64_t length);
+ ~Sound();
+
+ int32_t getSoundID() const { return mSoundID; }
+ int32_t getChannelCount() const { return mChannelCount; }
+ uint32_t getSampleRate() const { return mSampleRate; }
+ audio_format_t getFormat() const { return mFormat; }
+ audio_channel_mask_t getChannelMask() const { return mChannelMask; }
+ size_t getSizeInBytes() const { return mSizeInBytes; }
+ sound_state getState() const { return mState; }
+ uint8_t* getData() const { return static_cast<uint8_t*>(mData->unsecurePointer()); }
+ sp<IMemory> getIMemory() const { return mData; }
+
+private:
+ status_t doLoad(); // only SoundDecoder accesses this.
+
+ size_t mSizeInBytes = 0;
+ const int32_t mSoundID;
+ uint32_t mSampleRate = 0;
+ std::atomic<sound_state> mState = LOADING; // used as synchronization point
+ int32_t mChannelCount = 0;
+ audio_format_t mFormat = AUDIO_FORMAT_INVALID;
+ audio_channel_mask_t mChannelMask = AUDIO_CHANNEL_NONE;
+ base::unique_fd mFd; // initialized in constructor, reset to -1 after loading
+ const int64_t mOffset; // int64_t to match java long, see off64_t
+ const int64_t mLength; // int64_t to match java long, see off64_t
+ sp<IMemory> mData;
+ sp<MemoryHeapBase> mHeap;
+};
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/SoundDecoder.cpp b/media/jni/soundpool/SoundDecoder.cpp
new file mode 100644
index 0000000..12200ef
--- /dev/null
+++ b/media/jni/soundpool/SoundDecoder.cpp
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SoundPool::SoundDecoder"
+#include "utils/Log.h"
+
+#include "SoundDecoder.h"
+
+namespace android::soundpool {
+
+// Maximum Samples that can be background decoded before we block the caller.
+static constexpr size_t kMaxQueueSize = 128;
+
+// The amount of time we wait for a new Sound decode request
+// before the SoundDecoder thread closes.
+static constexpr int32_t kWaitTimeBeforeCloseMs = 1000;
+
+SoundDecoder::SoundDecoder(SoundManager* soundManager, size_t threads)
+ : mSoundManager(soundManager)
+{
+ ALOGV("%s(%p, %zu)", __func__, soundManager, threads);
+ // ThreadPool is created, but we don't launch any threads.
+ mThreadPool = std::make_unique<ThreadPool>(
+ std::min(threads, (size_t)std::thread::hardware_concurrency()),
+ "SoundDecoder_");
+}
+
+SoundDecoder::~SoundDecoder()
+{
+ ALOGV("%s()", __func__);
+ quit();
+}
+
+void SoundDecoder::quit()
+{
+ ALOGV("%s()", __func__);
+ {
+ std::lock_guard lock(mLock);
+ mQuit = true;
+ mQueueSpaceAvailable.notify_all(); // notify all load waiters
+ mQueueDataAvailable.notify_all(); // notify all worker threads
+ }
+ mThreadPool->quit();
+}
+
+void SoundDecoder::run(int32_t id __unused /* ALOGV only */)
+{
+ ALOGV("%s(%d): entering", __func__, id);
+ std::unique_lock lock(mLock);
+ while (!mQuit) {
+ if (mSoundIDs.size() == 0) {
+ ALOGV("%s(%d): waiting", __func__, id);
+ mQueueDataAvailable.wait_for(
+ lock, std::chrono::duration<int32_t, std::milli>(kWaitTimeBeforeCloseMs));
+ if (mSoundIDs.size() == 0) {
+ break; // no new sound, exit this thread.
+ }
+ continue;
+ }
+ const int32_t soundID = mSoundIDs.front();
+ mSoundIDs.pop_front();
+ mQueueSpaceAvailable.notify_one();
+ ALOGV("%s(%d): processing soundID: %d size: %zu", __func__, id, soundID, mSoundIDs.size());
+ lock.unlock();
+ std::shared_ptr<Sound> sound = mSoundManager->findSound(soundID);
+ status_t status = NO_INIT;
+ if (sound.get() != nullptr) {
+ status = sound->doLoad();
+ }
+ ALOGV("%s(%d): notifying loaded soundID:%d status:%d", __func__, id, soundID, status);
+ mSoundManager->notify(SoundPoolEvent(SoundPoolEvent::SOUND_LOADED, soundID, status));
+ lock.lock();
+ }
+ ALOGV("%s(%d): exiting", __func__, id);
+}
+
+void SoundDecoder::loadSound(int32_t soundID)
+{
+ ALOGV("%s(%d)", __func__, soundID);
+ size_t pendingSounds;
+ {
+ std::unique_lock lock(mLock);
+ while (mSoundIDs.size() == kMaxQueueSize) {
+ if (mQuit) return;
+ ALOGV("%s: waiting soundID: %d size: %zu", __func__, soundID, mSoundIDs.size());
+ mQueueSpaceAvailable.wait(lock);
+ }
+ if (mQuit) return;
+ mSoundIDs.push_back(soundID);
+ mQueueDataAvailable.notify_one();
+ ALOGV("%s: adding soundID: %d size: %zu", __func__, soundID, mSoundIDs.size());
+ pendingSounds = mSoundIDs.size();
+ }
+ // Launch threads as needed. The "as needed" is weakly consistent as we release mLock.
+ if (pendingSounds > mThreadPool->getActiveThreadCount()) {
+ const int32_t id __unused = mThreadPool->launch([this](int32_t id) { run(id); });
+ ALOGV_IF(id != 0, "%s: launched thread %d", __func__, id);
+ }
+}
+
+} // end namespace android::soundpool
diff --git a/media/jni/soundpool/SoundDecoder.h b/media/jni/soundpool/SoundDecoder.h
new file mode 100644
index 0000000..1288943
--- /dev/null
+++ b/media/jni/soundpool/SoundDecoder.h
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "SoundPool.h"
+
+#include <deque>
+#include <mutex>
+
+namespace android::soundpool {
+
+/**
+ * SoundDecoder handles background decoding tasks.
+ */
+class SoundDecoder {
+public:
+ SoundDecoder(SoundManager* soundManager, size_t threads);
+ ~SoundDecoder();
+ void loadSound(int32_t soundID);
+ void quit();
+
+private:
+ void run(int32_t id); // The decode thread function.
+
+ SoundManager* const mSoundManager; // set in constructor, has own lock
+ std::unique_ptr<ThreadPool> mThreadPool; // set in constructor, has own lock
+
+ std::mutex mLock;
+ std::condition_variable mQueueSpaceAvailable;
+ std::condition_variable mQueueDataAvailable;
+
+ std::deque<int32_t> mSoundIDs; // GUARDED_BY(mLock);
+ bool mQuit = false; // GUARDED_BY(mLock);
+};
+
+} // end namespace android::soundpool
+
diff --git a/media/jni/soundpool/SoundManager.cpp b/media/jni/soundpool/SoundManager.cpp
new file mode 100644
index 0000000..3c625bf
--- /dev/null
+++ b/media/jni/soundpool/SoundManager.cpp
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SoundPool::SoundManager"
+#include <utils/Log.h>
+
+#include "SoundManager.h"
+
+#include <thread>
+
+#include "SoundDecoder.h"
+
+namespace android::soundpool {
+
+static const size_t kDecoderThreads = std::thread::hardware_concurrency() >= 4 ? 2 : 1;
+
+SoundManager::SoundManager()
+ : mDecoder{std::make_unique<SoundDecoder>(this, kDecoderThreads)}
+{
+ ALOGV("%s()", __func__);
+}
+
+SoundManager::~SoundManager()
+{
+ ALOGV("%s()", __func__);
+ mDecoder->quit();
+
+ std::lock_guard lock(mSoundManagerLock);
+ mSounds.clear();
+}
+
+int32_t SoundManager::load(int fd, int64_t offset, int64_t length, int32_t priority __unused)
+{
+ ALOGV("%s(fd=%d, offset=%lld, length=%lld, priority=%d)",
+ __func__, fd, (long long)offset, (long long)length, priority);
+ int32_t soundID;
+ {
+ std::lock_guard lock(mSoundManagerLock);
+ // mNextSoundID is always positive and does not "integer overflow"
+ do {
+ mNextSoundID = mNextSoundID == INT32_MAX ? 1 : mNextSoundID + 1;
+ } while (findSound_l(mNextSoundID) != nullptr);
+ soundID = mNextSoundID;
+ auto sound = std::make_shared<Sound>(soundID, fd, offset, length);
+ mSounds.emplace(soundID, sound);
+ }
+ // mDecoder->loadSound() must be called outside of mSoundManagerLock.
+ // mDecoder->loadSound() may block on mDecoder message queue space;
+ // the message queue emptying may block on SoundManager::findSound().
+ //
+ // It is theoretically possible that sound loads might decode out-of-order.
+ mDecoder->loadSound(soundID);
+ return soundID;
+}
+
+bool SoundManager::unload(int32_t soundID)
+{
+ ALOGV("%s(soundID=%d)", __func__, soundID);
+ std::lock_guard lock(mSoundManagerLock);
+ return mSounds.erase(soundID) > 0; // erase() returns number of sounds removed.
+}
+
+std::shared_ptr<Sound> SoundManager::findSound(int32_t soundID) const
+{
+ std::lock_guard lock(mSoundManagerLock);
+ return findSound_l(soundID);
+}
+
+std::shared_ptr<Sound> SoundManager::findSound_l(int32_t soundID) const
+{
+ auto it = mSounds.find(soundID);
+ return it != mSounds.end() ? it->second : nullptr;
+}
+
+void SoundManager::setCallback(SoundPool *soundPool, SoundPoolCallback* callback, void* user)
+{
+ mCallbackHandler.setCallback(soundPool, callback, user);
+}
+
+void SoundManager::notify(SoundPoolEvent event)
+{
+ mCallbackHandler.notify(event);
+}
+
+void* SoundManager::getUserData() const
+{
+ return mCallbackHandler.getUserData();
+}
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/SoundManager.h b/media/jni/soundpool/SoundManager.h
new file mode 100644
index 0000000..9201e78
--- /dev/null
+++ b/media/jni/soundpool/SoundManager.h
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "Sound.h"
+
+#include <mutex>
+#include <unordered_map>
+
+namespace android {
+
+class SoundPool;
+
+// for queued events
+class SoundPoolEvent {
+public:
+ explicit SoundPoolEvent(int msg, int arg1 = 0, int arg2 = 0) :
+ mMsg(msg), mArg1(arg1), mArg2(arg2) {}
+ const int mMsg; // MessageType
+ const int mArg1; // soundID
+ const int mArg2; // status
+ enum MessageType { INVALID, SOUND_LOADED };
+};
+
+// callback function prototype
+typedef void SoundPoolCallback(SoundPoolEvent event, SoundPool* soundPool, void* user);
+
+} // namespace android
+
+namespace android::soundpool {
+
+// This class manages Sounds for the SoundPool.
+class SoundManager {
+public:
+ SoundManager();
+ ~SoundManager();
+
+ // Matches corresponding SoundPool API functions
+ int32_t load(int fd, int64_t offset, int64_t length, int32_t priority);
+ bool unload(int32_t soundID);
+ void setCallback(SoundPool* soundPool, SoundPoolCallback* callback, void* user);
+ void* getUserData() const;
+
+ // SoundPool and SoundDecoder access
+ std::shared_ptr<Sound> findSound(int32_t soundID) const;
+
+ // from the SoundDecoder
+ void notify(SoundPoolEvent event);
+
+private:
+
+ // CallbackHandler is used to manage notifications back to the app when a sound
+ // has been loaded. It uses a recursive lock to allow setting the callback
+ // during the callback.
+ class CallbackHandler {
+ public:
+ void setCallback(SoundPool *soundPool, SoundPoolCallback* callback, void* userData)
+ {
+ std::lock_guard<std::recursive_mutex> lock(mCallbackLock);
+ mSoundPool = soundPool;
+ mCallback = callback;
+ mUserData = userData;
+ }
+ void notify(SoundPoolEvent event) const
+ {
+ std::lock_guard<std::recursive_mutex> lock(mCallbackLock);
+ if (mCallback != nullptr) {
+ mCallback(event, mSoundPool, mUserData);
+ // Note: mCallback may call setCallback().
+ // so mCallback, mUserData may have changed.
+ }
+ }
+ void* getUserData() const
+ {
+ std::lock_guard<std::recursive_mutex> lock(mCallbackLock);
+ return mUserData;
+ }
+ private:
+ mutable std::recursive_mutex mCallbackLock; // allow mCallback to setCallback().
+ SoundPool* mSoundPool = nullptr; // GUARDED_BY(mCallbackLock)
+ SoundPoolCallback* mCallback = nullptr; // GUARDED_BY(mCallbackLock)
+ void* mUserData = nullptr; // GUARDED_BY(mCallbackLock)
+ };
+
+ std::shared_ptr<Sound> findSound_l(int32_t soundID) const;
+
+ // The following variables are initialized in constructor and can be accessed anytime.
+ CallbackHandler mCallbackHandler; // has its own lock
+ const std::unique_ptr<SoundDecoder> mDecoder; // has its own lock
+
+ mutable std::mutex mSoundManagerLock;
+ std::unordered_map<int, std::shared_ptr<Sound>> mSounds; // GUARDED_BY(mSoundManagerLock)
+ int32_t mNextSoundID = 0; // GUARDED_BY(mSoundManagerLock)
+};
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 102bbf0..ac44843 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -16,1124 +16,230 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "SoundPool"
-
-#include <chrono>
-#include <inttypes.h>
-#include <thread>
#include <utils/Log.h>
-#define USE_SHARED_MEM_BUFFER
+#include <algorithm>
+#include <thread>
-#include <media/AudioTrack.h>
#include "SoundPool.h"
-#include "SoundPoolThread.h"
-#include <media/NdkMediaCodec.h>
-#include <media/NdkMediaExtractor.h>
-#include <media/NdkMediaFormat.h>
namespace android
{
-int kDefaultBufferCount = 4;
-uint32_t kMaxSampleRate = 48000;
-uint32_t kDefaultSampleRate = 44100;
-uint32_t kDefaultFrameCount = 1200;
-size_t kDefaultHeapSize = 1024 * 1024; // 1MB
+// kManagerThreads = 1 historically.
+// Not really necessary to have more than one, but it does speed things up by about
+// 25% having 2 threads instead of 1 when playing many sounds. Having many threads
+// could starve other AudioFlinger clients with SoundPool activity. It may also cause
+// issues with app loading, e.g. Camera.
+static const size_t kStreamManagerThreads = std::thread::hardware_concurrency() >= 4 ? 2 : 1;
+// kUseApiLock = true prior to R.
+// Set to true to prevent multiple users access internal to the SoundPool API.
+// Set to false to make the SoundPool methods weakly consistent. When set to false,
+// only AutoPause and AutoResume are locked, which are the only two methods that
+// require API level locking for consistency.
+static constexpr bool kUseApiLock = false;
-SoundPool::SoundPool(int maxChannels, const audio_attributes_t* pAttributes)
+namespace {
+// Check input arguments to SoundPool - return "true" to reject request.
+
+bool checkVolume(float *leftVolume, float *rightVolume)
{
- ALOGV("SoundPool constructor: maxChannels=%d, attr.usage=%d, attr.flags=0x%x, attr.tags=%s",
- maxChannels, pAttributes->usage, pAttributes->flags, pAttributes->tags);
-
- // check limits
- mMaxChannels = maxChannels;
- if (mMaxChannels < 1) {
- mMaxChannels = 1;
+ if (*leftVolume != std::clamp(*leftVolume, 0.f, 1.f) ||
+ *rightVolume != std::clamp(*rightVolume, 0.f, 1.f)) {
+ ALOGI("volume l=%f r=%f out of (0.f, 1.f) bounds, using 1.f", *leftVolume, *rightVolume);
+ // for backward compatibility use 1.f.
+ *leftVolume = *rightVolume = 1.f;
}
- else if (mMaxChannels > 32) {
- mMaxChannels = 32;
+ return false;
+}
+
+bool checkRate(float *rate)
+{
+ if (*rate != std::clamp(*rate, 0.125f, 8.f)) {
+ ALOGI("rate %f out of (0.125f, 8.f) bounds, clamping", *rate);
+ // for backward compatibility just clamp
+ *rate = std::clamp(*rate, 0.125f, 8.f);
}
- ALOGW_IF(maxChannels != mMaxChannels, "App requested %d channels", maxChannels);
+ return false;
+}
- mQuit = false;
- mMuted = false;
- mDecodeThread = 0;
- memcpy(&mAttributes, pAttributes, sizeof(audio_attributes_t));
- mAllocated = 0;
- mNextSampleID = 0;
- mNextChannelID = 0;
-
- mCallback = 0;
- mUserData = 0;
-
- mChannelPool = new SoundChannel[mMaxChannels];
- for (int i = 0; i < mMaxChannels; ++i) {
- mChannelPool[i].init(this);
- mChannels.push_back(&mChannelPool[i]);
+bool checkPriority(int32_t *priority)
+{
+ if (*priority < 0) {
+ ALOGI("negative priority %d, should be >= 0.", *priority);
+ // for backward compatibility, ignore.
}
+ return false;
+}
- // start decode thread
- startThreads();
+bool checkLoop(int32_t *loop)
+{
+ if (*loop < -1) {
+ ALOGI("loop %d, should be >= -1", *loop);
+ *loop = -1;
+ }
+ return false;
+}
+
+} // namespace
+
+SoundPool::SoundPool(int32_t maxStreams, const audio_attributes_t* attributes)
+ : mStreamManager(maxStreams, kStreamManagerThreads, attributes)
+{
+ ALOGV("%s(maxStreams=%d, attr={ content_type=%d, usage=%d, flags=0x%x, tags=%s })",
+ __func__, maxStreams,
+ attributes->content_type, attributes->usage, attributes->flags, attributes->tags);
}
SoundPool::~SoundPool()
{
- ALOGV("SoundPool destructor");
- mDecodeThread->quit();
- quit();
-
- Mutex::Autolock lock(&mLock);
-
- mChannels.clear();
- if (mChannelPool)
- delete [] mChannelPool;
- // clean up samples
- ALOGV("clear samples");
- mSamples.clear();
-
- if (mDecodeThread)
- delete mDecodeThread;
+ ALOGV("%s()", __func__);
}
-void SoundPool::addToRestartList(SoundChannel* channel)
+int32_t SoundPool::load(int fd, int64_t offset, int64_t length, int32_t priority)
{
- Mutex::Autolock lock(&mRestartLock);
- if (!mQuit) {
- mRestart.push_back(channel);
- mCondition.signal();
- }
+ ALOGV("%s(fd=%d, offset=%lld, length=%lld, priority=%d)",
+ __func__, fd, (long long)offset, (long long)length, priority);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ return mSoundManager.load(fd, offset, length, priority);
}
-void SoundPool::addToStopList(SoundChannel* channel)
+bool SoundPool::unload(int32_t soundID)
{
- Mutex::Autolock lock(&mRestartLock);
- if (!mQuit) {
- mStop.push_back(channel);
- mCondition.signal();
- }
+ ALOGV("%s(%d)", __func__, soundID);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ return mSoundManager.unload(soundID);
}
-int SoundPool::beginThread(void* arg)
+int32_t SoundPool::play(int32_t soundID, float leftVolume, float rightVolume,
+ int32_t priority, int32_t loop, float rate)
{
- SoundPool* p = (SoundPool*)arg;
- return p->run();
-}
+ ALOGV("%s(soundID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f)",
+ __func__, soundID, leftVolume, rightVolume, priority, loop, rate);
-int SoundPool::run()
-{
- mRestartLock.lock();
- while (!mQuit) {
- mCondition.wait(mRestartLock);
- ALOGV("awake");
- if (mQuit) break;
+ // New for R: check arguments to ensure track can be created.
+ // If SoundPool defers the creation of the AudioTrack to the StreamManager thread,
+ // the failure to create may not be visible to the caller, so this precheck is needed.
+ if (checkVolume(&leftVolume, &rightVolume)
+ || checkPriority(&priority)
+ || checkLoop(&loop)
+ || checkRate(&rate)) return 0;
- while (!mStop.empty()) {
- SoundChannel* channel;
- ALOGV("Getting channel from stop list");
- List<SoundChannel* >::iterator iter = mStop.begin();
- channel = *iter;
- mStop.erase(iter);
- mRestartLock.unlock();
- if (channel != 0) {
- Mutex::Autolock lock(&mLock);
- channel->stop();
- }
- mRestartLock.lock();
- if (mQuit) break;
- }
-
- while (!mRestart.empty()) {
- SoundChannel* channel;
- ALOGV("Getting channel from list");
- List<SoundChannel*>::iterator iter = mRestart.begin();
- channel = *iter;
- mRestart.erase(iter);
- mRestartLock.unlock();
- if (channel != 0) {
- Mutex::Autolock lock(&mLock);
- channel->nextEvent();
- }
- mRestartLock.lock();
- if (mQuit) break;
- }
- }
-
- mStop.clear();
- mRestart.clear();
- mCondition.signal();
- mRestartLock.unlock();
- ALOGV("goodbye");
- return 0;
-}
-
-void SoundPool::quit()
-{
- mRestartLock.lock();
- mQuit = true;
- mCondition.signal();
- mCondition.wait(mRestartLock);
- ALOGV("return from quit");
- mRestartLock.unlock();
-}
-
-bool SoundPool::startThreads()
-{
- createThreadEtc(beginThread, this, "SoundPool");
- if (mDecodeThread == NULL)
- mDecodeThread = new SoundPoolThread(this);
- return mDecodeThread != NULL;
-}
-
-sp<Sample> SoundPool::findSample(int sampleID)
-{
- Mutex::Autolock lock(&mLock);
- return findSample_l(sampleID);
-}
-
-sp<Sample> SoundPool::findSample_l(int sampleID)
-{
- return mSamples.valueFor(sampleID);
-}
-
-SoundChannel* SoundPool::findChannel(int channelID)
-{
- for (int i = 0; i < mMaxChannels; ++i) {
- if (mChannelPool[i].channelID() == channelID) {
- return &mChannelPool[i];
- }
- }
- return NULL;
-}
-
-SoundChannel* SoundPool::findNextChannel(int channelID)
-{
- for (int i = 0; i < mMaxChannels; ++i) {
- if (mChannelPool[i].nextChannelID() == channelID) {
- return &mChannelPool[i];
- }
- }
- return NULL;
-}
-
-int SoundPool::load(int fd, int64_t offset, int64_t length, int priority __unused)
-{
- ALOGV("load: fd=%d, offset=%" PRId64 ", length=%" PRId64 ", priority=%d",
- fd, offset, length, priority);
- int sampleID;
- {
- Mutex::Autolock lock(&mLock);
- sampleID = ++mNextSampleID;
- sp<Sample> sample = new Sample(sampleID, fd, offset, length);
- mSamples.add(sampleID, sample);
- sample->startLoad();
- }
- // mDecodeThread->loadSample() must be called outside of mLock.
- // mDecodeThread->loadSample() may block on mDecodeThread message queue space;
- // the message queue emptying may block on SoundPool::findSample().
- //
- // It theoretically possible that sample loads might decode out-of-order.
- mDecodeThread->loadSample(sampleID);
- return sampleID;
-}
-
-bool SoundPool::unload(int sampleID)
-{
- ALOGV("unload: sampleID=%d", sampleID);
- Mutex::Autolock lock(&mLock);
- return mSamples.removeItem(sampleID) >= 0; // removeItem() returns index or BAD_VALUE
-}
-
-int SoundPool::play(int sampleID, float leftVolume, float rightVolume,
- int priority, int loop, float rate)
-{
- ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
- sampleID, leftVolume, rightVolume, priority, loop, rate);
- SoundChannel* channel;
- int channelID;
-
- Mutex::Autolock lock(&mLock);
-
- if (mQuit) {
- return 0;
- }
- // is sample ready?
- sp<Sample> sample(findSample_l(sampleID));
- if ((sample == 0) || (sample->state() != Sample::READY)) {
- ALOGW(" sample %d not READY", sampleID);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ const std::shared_ptr<soundpool::Sound> sound = mSoundManager.findSound(soundID);
+ if (sound == nullptr || sound->getState() != soundpool::Sound::READY) {
+ ALOGW("%s soundID %d not READY", __func__, soundID);
return 0;
}
- dump();
-
- // allocate a channel
- channel = allocateChannel_l(priority, sampleID);
-
- // no channel allocated - return 0
- if (!channel) {
- ALOGV("No channel allocated");
- return 0;
- }
-
- channelID = ++mNextChannelID;
-
- ALOGV("play channel %p state = %d", channel, channel->state());
- channel->play(sample, channelID, leftVolume, rightVolume, priority, loop, rate);
- return channelID;
-}
-
-SoundChannel* SoundPool::allocateChannel_l(int priority, int sampleID)
-{
- List<SoundChannel*>::iterator iter;
- SoundChannel* channel = NULL;
-
- // check if channel for given sampleID still available
- if (!mChannels.empty()) {
- for (iter = mChannels.begin(); iter != mChannels.end(); ++iter) {
- if (sampleID == (*iter)->getPrevSampleID() && (*iter)->state() == SoundChannel::IDLE) {
- channel = *iter;
- mChannels.erase(iter);
- ALOGV("Allocated recycled channel for same sampleID");
- break;
- }
- }
- }
-
- // allocate any channel
- if (!channel && !mChannels.empty()) {
- iter = mChannels.begin();
- if (priority >= (*iter)->priority()) {
- channel = *iter;
- mChannels.erase(iter);
- ALOGV("Allocated active channel");
- }
- }
-
- // update priority and put it back in the list
- if (channel) {
- channel->setPriority(priority);
- for (iter = mChannels.begin(); iter != mChannels.end(); ++iter) {
- if (priority < (*iter)->priority()) {
- break;
- }
- }
- mChannels.insert(iter, channel);
- }
- return channel;
-}
-
-// move a channel from its current position to the front of the list
-void SoundPool::moveToFront_l(SoundChannel* channel)
-{
- for (List<SoundChannel*>::iterator iter = mChannels.begin(); iter != mChannels.end(); ++iter) {
- if (*iter == channel) {
- mChannels.erase(iter);
- mChannels.push_front(channel);
- break;
- }
- }
-}
-
-void SoundPool::pause(int channelID)
-{
- ALOGV("pause(%d)", channelID);
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->pause();
- }
+ const int32_t streamID = mStreamManager.queueForPlay(
+ sound, soundID, leftVolume, rightVolume, priority, loop, rate);
+ ALOGV("%s returned %d", __func__, streamID);
+ return streamID;
}
void SoundPool::autoPause()
{
- ALOGV("autoPause()");
- Mutex::Autolock lock(&mLock);
- for (int i = 0; i < mMaxChannels; ++i) {
- SoundChannel* channel = &mChannelPool[i];
- channel->autoPause();
- }
-}
-
-void SoundPool::resume(int channelID)
-{
- ALOGV("resume(%d)", channelID);
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->resume();
- }
-}
-
-void SoundPool::mute(bool muting)
-{
- ALOGV("mute(%d)", muting);
- Mutex::Autolock lock(&mLock);
- mMuted = muting;
- if (!mChannels.empty()) {
- for (List<SoundChannel*>::iterator iter = mChannels.begin();
- iter != mChannels.end(); ++iter) {
- (*iter)->mute(muting);
- }
- }
+ ALOGV("%s()", __func__);
+ auto apiLock = std::make_unique<std::lock_guard<std::mutex>>(mApiLock);
+ mStreamManager.forEach([](soundpool::Stream *stream) { stream->autoPause(); });
}
void SoundPool::autoResume()
{
- ALOGV("autoResume()");
- Mutex::Autolock lock(&mLock);
- for (int i = 0; i < mMaxChannels; ++i) {
- SoundChannel* channel = &mChannelPool[i];
- channel->autoResume();
+ ALOGV("%s()", __func__);
+ auto apiLock = std::make_unique<std::lock_guard<std::mutex>>(mApiLock);
+ mStreamManager.forEach([](soundpool::Stream *stream) { stream->autoResume(); });
+}
+
+void SoundPool::mute(bool muting)
+{
+ ALOGV("%s(%d)", __func__, muting);
+ auto apiLock = std::make_unique<std::lock_guard<std::mutex>>(mApiLock);
+ mStreamManager.forEach([=](soundpool::Stream *stream) { stream->mute(muting); });
+}
+
+void SoundPool::pause(int32_t streamID)
+{
+ ALOGV("%s(%d)", __func__, streamID);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ if (soundpool::Stream* stream = mStreamManager.findStream(streamID)) {
+ stream->pause(streamID);
}
}
-void SoundPool::stop(int channelID)
+void SoundPool::resume(int32_t streamID)
{
- ALOGV("stop(%d)", channelID);
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->stop();
- } else {
- channel = findNextChannel(channelID);
- if (channel)
- channel->clearNextEvent();
+ ALOGV("%s(%d)", __func__, streamID);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ if (soundpool::Stream* stream = mStreamManager.findStream(streamID)) {
+ stream->resume(streamID);
}
}
-void SoundPool::setVolume(int channelID, float leftVolume, float rightVolume)
+void SoundPool::stop(int32_t streamID)
{
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->setVolume(leftVolume, rightVolume);
+ ALOGV("%s(%d)", __func__, streamID);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ soundpool::Stream* stream = mStreamManager.findStream(streamID);
+ if (stream != nullptr && stream->requestStop(streamID)) {
+ mStreamManager.moveToRestartQueue(stream);
}
}
-void SoundPool::setPriority(int channelID, int priority)
+void SoundPool::setVolume(int32_t streamID, float leftVolume, float rightVolume)
{
- ALOGV("setPriority(%d, %d)", channelID, priority);
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->setPriority(priority);
+ ALOGV("%s(%d, %f %f)", __func__, streamID, leftVolume, rightVolume);
+ if (checkVolume(&leftVolume, &rightVolume)) return;
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ if (soundpool::Stream* stream = mStreamManager.findStream(streamID)) {
+ stream->setVolume(streamID, leftVolume, rightVolume);
}
}
-void SoundPool::setLoop(int channelID, int loop)
+void SoundPool::setPriority(int32_t streamID, int32_t priority)
{
- ALOGV("setLoop(%d, %d)", channelID, loop);
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->setLoop(loop);
+ ALOGV("%s(%d, %d)", __func__, streamID, priority);
+ if (checkPriority(&priority)) return;
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ if (soundpool::Stream* stream = mStreamManager.findStream(streamID)) {
+ stream->setPriority(streamID, priority);
}
}
-void SoundPool::setRate(int channelID, float rate)
+void SoundPool::setLoop(int32_t streamID, int32_t loop)
{
- ALOGV("setRate(%d, %f)", channelID, rate);
- Mutex::Autolock lock(&mLock);
- SoundChannel* channel = findChannel(channelID);
- if (channel) {
- channel->setRate(rate);
+ ALOGV("%s(%d, %d)", __func__, streamID, loop);
+ if (checkLoop(&loop)) return;
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ if (soundpool::Stream* stream = mStreamManager.findStream(streamID)) {
+ stream->setLoop(streamID, loop);
}
}
-// call with lock held
-void SoundPool::done_l(SoundChannel* channel)
+void SoundPool::setRate(int32_t streamID, float rate)
{
- ALOGV("done_l(%d)", channel->channelID());
- // if "stolen", play next event
- if (channel->nextChannelID() != 0) {
- ALOGV("add to restart list");
- addToRestartList(channel);
- }
-
- // return to idle state
- else {
- ALOGV("move to front");
- moveToFront_l(channel);
+ ALOGV("%s(%d, %f)", __func__, streamID, rate);
+ if (checkRate(&rate)) return;
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ if (soundpool::Stream* stream = mStreamManager.findStream(streamID)) {
+ stream->setRate(streamID, rate);
}
}
void SoundPool::setCallback(SoundPoolCallback* callback, void* user)
{
- Mutex::Autolock lock(&mCallbackLock);
- mCallback = callback;
- mUserData = user;
+ ALOGV("%s(%p, %p)", __func__, callback, user);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ mSoundManager.setCallback(this, callback, user);
}
-void SoundPool::notify(SoundPoolEvent event)
+void* SoundPool::getUserData() const
{
- Mutex::Autolock lock(&mCallbackLock);
- if (mCallback != NULL) {
- mCallback(event, this, mUserData);
- }
-}
-
-void SoundPool::dump()
-{
- for (int i = 0; i < mMaxChannels; ++i) {
- mChannelPool[i].dump();
- }
-}
-
-
-Sample::Sample(int sampleID, int fd, int64_t offset, int64_t length)
-{
- init();
- mSampleID = sampleID;
- mFd = dup(fd);
- mOffset = offset;
- mLength = length;
- ALOGV("create sampleID=%d, fd=%d, offset=%" PRId64 " length=%" PRId64,
- mSampleID, mFd, mLength, mOffset);
-}
-
-void Sample::init()
-{
- mSize = 0;
- mRefCount = 0;
- mSampleID = 0;
- mState = UNLOADED;
- mFd = -1;
- mOffset = 0;
- mLength = 0;
-}
-
-Sample::~Sample()
-{
- ALOGV("Sample::destructor sampleID=%d, fd=%d", mSampleID, mFd);
- if (mFd > 0) {
- ALOGV("close(%d)", mFd);
- ::close(mFd);
- }
-}
-
-static status_t decode(int fd, int64_t offset, int64_t length,
- uint32_t *rate, int *numChannels, audio_format_t *audioFormat,
- audio_channel_mask_t *channelMask, sp<MemoryHeapBase> heap,
- size_t *memsize) {
-
- ALOGV("fd %d, offset %" PRId64 ", size %" PRId64, fd, offset, length);
- AMediaExtractor *ex = AMediaExtractor_new();
- status_t err = AMediaExtractor_setDataSourceFd(ex, fd, offset, length);
-
- if (err != AMEDIA_OK) {
- AMediaExtractor_delete(ex);
- return err;
- }
-
- *audioFormat = AUDIO_FORMAT_PCM_16_BIT;
-
- size_t numTracks = AMediaExtractor_getTrackCount(ex);
- for (size_t i = 0; i < numTracks; i++) {
- AMediaFormat *format = AMediaExtractor_getTrackFormat(ex, i);
- const char *mime;
- if (!AMediaFormat_getString(format, AMEDIAFORMAT_KEY_MIME, &mime)) {
- AMediaExtractor_delete(ex);
- AMediaFormat_delete(format);
- return UNKNOWN_ERROR;
- }
- if (strncmp(mime, "audio/", 6) == 0) {
-
- AMediaCodec *codec = AMediaCodec_createDecoderByType(mime);
- if (codec == NULL
- || AMediaCodec_configure(codec, format,
- NULL /* window */, NULL /* drm */, 0 /* flags */) != AMEDIA_OK
- || AMediaCodec_start(codec) != AMEDIA_OK
- || AMediaExtractor_selectTrack(ex, i) != AMEDIA_OK) {
- AMediaExtractor_delete(ex);
- AMediaCodec_delete(codec);
- AMediaFormat_delete(format);
- return UNKNOWN_ERROR;
- }
-
- bool sawInputEOS = false;
- bool sawOutputEOS = false;
- uint8_t* writePos = static_cast<uint8_t*>(heap->getBase());
- size_t available = heap->getSize();
- size_t written = 0;
-
- AMediaFormat_delete(format);
- format = AMediaCodec_getOutputFormat(codec);
-
- while (!sawOutputEOS) {
- if (!sawInputEOS) {
- ssize_t bufidx = AMediaCodec_dequeueInputBuffer(codec, 5000);
- ALOGV("input buffer %zd", bufidx);
- if (bufidx >= 0) {
- size_t bufsize;
- uint8_t *buf = AMediaCodec_getInputBuffer(codec, bufidx, &bufsize);
- if (buf == nullptr) {
- ALOGE("AMediaCodec_getInputBuffer returned nullptr, short decode");
- break;
- }
- int sampleSize = AMediaExtractor_readSampleData(ex, buf, bufsize);
- ALOGV("read %d", sampleSize);
- if (sampleSize < 0) {
- sampleSize = 0;
- sawInputEOS = true;
- ALOGV("EOS");
- }
- int64_t presentationTimeUs = AMediaExtractor_getSampleTime(ex);
-
- media_status_t mstatus = AMediaCodec_queueInputBuffer(codec, bufidx,
- 0 /* offset */, sampleSize, presentationTimeUs,
- sawInputEOS ? AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM : 0);
- if (mstatus != AMEDIA_OK) {
- // AMEDIA_ERROR_UNKNOWN == { -ERANGE -EINVAL -EACCES }
- ALOGE("AMediaCodec_queueInputBuffer returned status %d, short decode",
- (int)mstatus);
- break;
- }
- (void)AMediaExtractor_advance(ex);
- }
- }
-
- AMediaCodecBufferInfo info;
- int status = AMediaCodec_dequeueOutputBuffer(codec, &info, 1);
- ALOGV("dequeueoutput returned: %d", status);
- if (status >= 0) {
- if (info.flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) {
- ALOGV("output EOS");
- sawOutputEOS = true;
- }
- ALOGV("got decoded buffer size %d", info.size);
-
- uint8_t *buf = AMediaCodec_getOutputBuffer(codec, status, NULL /* out_size */);
- if (buf == nullptr) {
- ALOGE("AMediaCodec_getOutputBuffer returned nullptr, short decode");
- break;
- }
- size_t dataSize = info.size;
- if (dataSize > available) {
- dataSize = available;
- }
- memcpy(writePos, buf + info.offset, dataSize);
- writePos += dataSize;
- written += dataSize;
- available -= dataSize;
- media_status_t mstatus = AMediaCodec_releaseOutputBuffer(
- codec, status, false /* render */);
- if (mstatus != AMEDIA_OK) {
- // AMEDIA_ERROR_UNKNOWN == { -ERANGE -EINVAL -EACCES }
- ALOGE("AMediaCodec_releaseOutputBuffer returned status %d, short decode",
- (int)mstatus);
- break;
- }
- if (available == 0) {
- // there might be more data, but there's no space for it
- sawOutputEOS = true;
- }
- } else if (status == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
- ALOGV("output buffers changed");
- } else if (status == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) {
- AMediaFormat_delete(format);
- format = AMediaCodec_getOutputFormat(codec);
- ALOGV("format changed to: %s", AMediaFormat_toString(format));
- } else if (status == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
- ALOGV("no output buffer right now");
- } else if (status <= AMEDIA_ERROR_BASE) {
- ALOGE("decode error: %d", status);
- break;
- } else {
- ALOGV("unexpected info code: %d", status);
- }
- }
-
- (void)AMediaCodec_stop(codec);
- (void)AMediaCodec_delete(codec);
- (void)AMediaExtractor_delete(ex);
- if (!AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_SAMPLE_RATE, (int32_t*) rate) ||
- !AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_CHANNEL_COUNT, numChannels)) {
- (void)AMediaFormat_delete(format);
- return UNKNOWN_ERROR;
- }
- if (!AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_CHANNEL_MASK,
- (int32_t*) channelMask)) {
- *channelMask = AUDIO_CHANNEL_NONE;
- }
- (void)AMediaFormat_delete(format);
- *memsize = written;
- return OK;
- }
- (void)AMediaFormat_delete(format);
- }
- (void)AMediaExtractor_delete(ex);
- return UNKNOWN_ERROR;
-}
-
-status_t Sample::doLoad()
-{
- uint32_t sampleRate;
- int numChannels;
- audio_format_t format;
- audio_channel_mask_t channelMask;
- status_t status;
- mHeap = new MemoryHeapBase(kDefaultHeapSize);
-
- ALOGV("Start decode");
- status = decode(mFd, mOffset, mLength, &sampleRate, &numChannels, &format,
- &channelMask, mHeap, &mSize);
- ALOGV("close(%d)", mFd);
- ::close(mFd);
- mFd = -1;
- if (status != NO_ERROR) {
- ALOGE("Unable to load sample");
- goto error;
- }
- ALOGV("pointer = %p, size = %zu, sampleRate = %u, numChannels = %d",
- mHeap->getBase(), mSize, sampleRate, numChannels);
-
- if (sampleRate > kMaxSampleRate) {
- ALOGE("Sample rate (%u) out of range", sampleRate);
- status = BAD_VALUE;
- goto error;
- }
-
- if ((numChannels < 1) || (numChannels > FCC_8)) {
- ALOGE("Sample channel count (%d) out of range", numChannels);
- status = BAD_VALUE;
- goto error;
- }
-
- mData = new MemoryBase(mHeap, 0, mSize);
- mSampleRate = sampleRate;
- mNumChannels = numChannels;
- mFormat = format;
- mChannelMask = channelMask;
- mState = READY;
- return NO_ERROR;
-
-error:
- mHeap.clear();
- return status;
-}
-
-
-void SoundChannel::init(SoundPool* soundPool)
-{
- mSoundPool = soundPool;
- mPrevSampleID = -1;
-}
-
-// call with sound pool lock held
-void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftVolume,
- float rightVolume, int priority, int loop, float rate)
-{
- sp<AudioTrack> oldTrack;
- sp<AudioTrack> newTrack;
- status_t status = NO_ERROR;
-
- { // scope for the lock
- Mutex::Autolock lock(&mLock);
-
- ALOGV("SoundChannel::play %p: sampleID=%d, channelID=%d, leftVolume=%f, rightVolume=%f,"
- " priority=%d, loop=%d, rate=%f",
- this, sample->sampleID(), nextChannelID, leftVolume, rightVolume,
- priority, loop, rate);
-
- // if not idle, this voice is being stolen
- if (mState != IDLE) {
- ALOGV("channel %d stolen - event queued for channel %d", channelID(), nextChannelID);
- mNextEvent.set(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate);
- stop_l();
- return;
- }
-
- // initialize track
- size_t afFrameCount;
- uint32_t afSampleRate;
- audio_stream_type_t streamType =
- AudioSystem::attributesToStreamType(*mSoundPool->attributes());
- if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) {
- afFrameCount = kDefaultFrameCount;
- }
- if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) {
- afSampleRate = kDefaultSampleRate;
- }
- int numChannels = sample->numChannels();
- uint32_t sampleRate = uint32_t(float(sample->sampleRate()) * rate + 0.5);
- size_t frameCount = 0;
-
- if (loop) {
- const audio_format_t format = sample->format();
- const size_t frameSize = audio_is_linear_pcm(format)
- ? numChannels * audio_bytes_per_sample(format) : 1;
- frameCount = sample->size() / frameSize;
- }
-
-#ifndef USE_SHARED_MEM_BUFFER
- uint32_t totalFrames = (kDefaultBufferCount * afFrameCount * sampleRate) / afSampleRate;
- // Ensure minimum audio buffer size in case of short looped sample
- if(frameCount < totalFrames) {
- frameCount = totalFrames;
- }
-#endif
-
- // check if the existing track has the same sample id.
- if (mAudioTrack != 0 && mPrevSampleID == sample->sampleID()) {
- // the sample rate may fail to change if the audio track is a fast track.
- if (mAudioTrack->setSampleRate(sampleRate) == NO_ERROR) {
- newTrack = mAudioTrack;
- ALOGV("reusing track %p for sample %d", mAudioTrack.get(), sample->sampleID());
- }
- }
- if (newTrack == 0) {
- // mToggle toggles each time a track is started on a given channel.
- // The toggle is concatenated with the SoundChannel address and passed to AudioTrack
- // as callback user data. This enables the detection of callbacks received from the old
- // audio track while the new one is being started and avoids processing them with
- // wrong audio audio buffer size (mAudioBufferSize)
- unsigned long toggle = mToggle ^ 1;
- void *userData = (void *)((unsigned long)this | toggle);
- audio_channel_mask_t sampleChannelMask = sample->channelMask();
- // When sample contains a not none channel mask, use it as is.
- // Otherwise, use channel count to calculate channel mask.
- audio_channel_mask_t channelMask = sampleChannelMask != AUDIO_CHANNEL_NONE
- ? sampleChannelMask : audio_channel_out_mask_from_count(numChannels);
-
- // do not create a new audio track if current track is compatible with sample parameters
- #ifdef USE_SHARED_MEM_BUFFER
- newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
- channelMask, sample->getIMemory(), AUDIO_OUTPUT_FLAG_FAST, callback, userData,
- 0 /*default notification frames*/, AUDIO_SESSION_ALLOCATE,
- AudioTrack::TRANSFER_DEFAULT,
- NULL /*offloadInfo*/, -1 /*uid*/, -1 /*pid*/, mSoundPool->attributes());
- #else
- uint32_t bufferFrames = (totalFrames + (kDefaultBufferCount - 1)) / kDefaultBufferCount;
- newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
- channelMask, frameCount, AUDIO_OUTPUT_FLAG_FAST, callback, userData,
- bufferFrames, AUDIO_SESSION_ALLOCATE, AudioTrack::TRANSFER_DEFAULT,
- NULL /*offloadInfo*/, -1 /*uid*/, -1 /*pid*/, mSoundPool->attributes());
- #endif
- oldTrack = mAudioTrack;
- status = newTrack->initCheck();
- if (status != NO_ERROR) {
- ALOGE("Error creating AudioTrack");
- // newTrack goes out of scope, so reference count drops to zero
- goto exit;
- }
- // From now on, AudioTrack callbacks received with previous toggle value will be ignored.
- mToggle = toggle;
- mAudioTrack = newTrack;
- ALOGV("using new track %p for sample %d", newTrack.get(), sample->sampleID());
- }
- if (mMuted) {
- newTrack->setVolume(0.0f, 0.0f);
- } else {
- newTrack->setVolume(leftVolume, rightVolume);
- }
- newTrack->setLoop(0, frameCount, loop);
- mPos = 0;
- mSample = sample;
- mChannelID = nextChannelID;
- mPriority = priority;
- mLoop = loop;
- mLeftVolume = leftVolume;
- mRightVolume = rightVolume;
- mNumChannels = numChannels;
- mRate = rate;
- clearNextEvent();
- mState = PLAYING;
- mAudioTrack->start();
- mAudioBufferSize = newTrack->frameCount()*newTrack->frameSize();
- }
-
-exit:
- ALOGV("delete oldTrack %p", oldTrack.get());
- if (status != NO_ERROR) {
- mAudioTrack.clear();
- }
-}
-
-void SoundChannel::nextEvent()
-{
- sp<Sample> sample;
- int nextChannelID;
- float leftVolume;
- float rightVolume;
- int priority;
- int loop;
- float rate;
-
- // check for valid event
- {
- Mutex::Autolock lock(&mLock);
- nextChannelID = mNextEvent.channelID();
- if (nextChannelID == 0) {
- ALOGV("stolen channel has no event");
- return;
- }
-
- sample = mNextEvent.sample();
- leftVolume = mNextEvent.leftVolume();
- rightVolume = mNextEvent.rightVolume();
- priority = mNextEvent.priority();
- loop = mNextEvent.loop();
- rate = mNextEvent.rate();
- }
-
- ALOGV("Starting stolen channel %d -> %d", channelID(), nextChannelID);
- play(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate);
-}
-
-void SoundChannel::callback(int event, void* user, void *info)
-{
- SoundChannel* channel = static_cast<SoundChannel*>((void *)((unsigned long)user & ~1));
-
- channel->process(event, info, (unsigned long)user & 1);
-}
-
-void SoundChannel::process(int event, void *info, unsigned long toggle)
-{
- //ALOGV("process(%d)", mChannelID);
-
- Mutex::Autolock lock(&mLock);
-
- AudioTrack::Buffer* b = NULL;
- if (event == AudioTrack::EVENT_MORE_DATA) {
- b = static_cast<AudioTrack::Buffer *>(info);
- }
-
- if (mToggle != toggle) {
- ALOGV("process wrong toggle %p channel %d", this, mChannelID);
- if (b != NULL) {
- b->size = 0;
- }
- return;
- }
-
- sp<Sample> sample = mSample;
-
-// ALOGV("SoundChannel::process event %d", event);
-
- if (event == AudioTrack::EVENT_MORE_DATA) {
-
- // check for stop state
- if (b->size == 0) return;
-
- if (mState == IDLE) {
- b->size = 0;
- return;
- }
-
- if (sample != 0) {
- // fill buffer
- uint8_t* q = (uint8_t*) b->i8;
- size_t count = 0;
-
- if (mPos < (int)sample->size()) {
- uint8_t* p = sample->data() + mPos;
- count = sample->size() - mPos;
- if (count > b->size) {
- count = b->size;
- }
- memcpy(q, p, count);
-// ALOGV("fill: q=%p, p=%p, mPos=%u, b->size=%u, count=%d", q, p, mPos, b->size,
-// count);
- } else if (mPos < mAudioBufferSize) {
- count = mAudioBufferSize - mPos;
- if (count > b->size) {
- count = b->size;
- }
- memset(q, 0, count);
-// ALOGV("fill extra: q=%p, mPos=%u, b->size=%u, count=%d", q, mPos, b->size, count);
- }
-
- mPos += count;
- b->size = count;
- //ALOGV("buffer=%p, [0]=%d", b->i16, b->i16[0]);
- }
- } else if (event == AudioTrack::EVENT_UNDERRUN || event == AudioTrack::EVENT_BUFFER_END) {
- ALOGV("process %p channel %d event %s",
- this, mChannelID, (event == AudioTrack::EVENT_UNDERRUN) ? "UNDERRUN" :
- "BUFFER_END");
- // Only BUFFER_END should happen as we use static tracks.
- setVolume_l(0.f, 0.f); // set volume to 0 to indicate no need to ramp volume down.
- mSoundPool->addToStopList(this);
- } else if (event == AudioTrack::EVENT_LOOP_END) {
- ALOGV("End loop %p channel %d", this, mChannelID);
- } else if (event == AudioTrack::EVENT_NEW_IAUDIOTRACK) {
- ALOGV("process %p channel %d NEW_IAUDIOTRACK", this, mChannelID);
- } else {
- ALOGW("SoundChannel::process unexpected event %d", event);
- }
-}
-
-
-// call with lock held
-bool SoundChannel::doStop_l()
-{
- if (mState != IDLE) {
- ALOGV("stop");
- if (mLeftVolume != 0.f || mRightVolume != 0.f) {
- setVolume_l(0.f, 0.f);
- if (mSoundPool->attributes()->usage != AUDIO_USAGE_GAME) {
- // Since we're forcibly halting the previously playing content,
- // we sleep here to ensure the volume is ramped down before we stop the track.
- // Ideally the sleep time is the mixer period, or an approximation thereof
- // (Fast vs Normal tracks are different).
- ALOGV("sleeping: ChannelID:%d SampleID:%d", mChannelID, mSample->sampleID());
- std::this_thread::sleep_for(std::chrono::milliseconds(20));
- }
- }
- mAudioTrack->stop();
- mPrevSampleID = mSample->sampleID();
- mSample.clear();
- mState = IDLE;
- mPriority = IDLE_PRIORITY;
- return true;
- }
- return false;
-}
-
-// call with lock held and sound pool lock held
-void SoundChannel::stop_l()
-{
- if (doStop_l()) {
- mSoundPool->done_l(this);
- }
-}
-
-// call with sound pool lock held
-void SoundChannel::stop()
-{
- bool stopped;
- {
- Mutex::Autolock lock(&mLock);
- stopped = doStop_l();
- }
-
- if (stopped) {
- mSoundPool->done_l(this);
- }
-}
-
-//FIXME: Pause is a little broken right now
-void SoundChannel::pause()
-{
- Mutex::Autolock lock(&mLock);
- if (mState == PLAYING) {
- ALOGV("pause track");
- mState = PAUSED;
- mAudioTrack->pause();
- }
-}
-
-void SoundChannel::autoPause()
-{
- Mutex::Autolock lock(&mLock);
- if (mState == PLAYING) {
- ALOGV("pause track");
- mState = PAUSED;
- mAutoPaused = true;
- mAudioTrack->pause();
- }
-}
-
-void SoundChannel::resume()
-{
- Mutex::Autolock lock(&mLock);
- if (mState == PAUSED) {
- ALOGV("resume track");
- mState = PLAYING;
- mAutoPaused = false;
- mAudioTrack->start();
- }
-}
-
-void SoundChannel::autoResume()
-{
- Mutex::Autolock lock(&mLock);
- if (mAutoPaused && (mState == PAUSED)) {
- ALOGV("resume track");
- mState = PLAYING;
- mAutoPaused = false;
- mAudioTrack->start();
- }
-}
-
-void SoundChannel::setRate(float rate)
-{
- Mutex::Autolock lock(&mLock);
- if (mAudioTrack != NULL && mSample != 0) {
- uint32_t sampleRate = uint32_t(float(mSample->sampleRate()) * rate + 0.5);
- mAudioTrack->setSampleRate(sampleRate);
- mRate = rate;
- }
-}
-
-// call with lock held
-void SoundChannel::setVolume_l(float leftVolume, float rightVolume)
-{
- mLeftVolume = leftVolume;
- mRightVolume = rightVolume;
- if (mAudioTrack != NULL && !mMuted)
- mAudioTrack->setVolume(leftVolume, rightVolume);
-}
-
-void SoundChannel::setVolume(float leftVolume, float rightVolume)
-{
- Mutex::Autolock lock(&mLock);
- setVolume_l(leftVolume, rightVolume);
-}
-
-void SoundChannel::mute(bool muting)
-{
- Mutex::Autolock lock(&mLock);
- mMuted = muting;
- if (mAudioTrack != NULL) {
- if (mMuted) {
- mAudioTrack->setVolume(0.0f, 0.0f);
- } else {
- mAudioTrack->setVolume(mLeftVolume, mRightVolume);
- }
- }
-}
-
-void SoundChannel::setLoop(int loop)
-{
- Mutex::Autolock lock(&mLock);
- if (mAudioTrack != NULL && mSample != 0) {
- uint32_t loopEnd = mSample->size()/mNumChannels/
- ((mSample->format() == AUDIO_FORMAT_PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t));
- mAudioTrack->setLoop(0, loopEnd, loop);
- mLoop = loop;
- }
-}
-
-SoundChannel::~SoundChannel()
-{
- ALOGV("SoundChannel destructor %p", this);
- {
- Mutex::Autolock lock(&mLock);
- clearNextEvent();
- doStop_l();
- }
- // do not call AudioTrack destructor with mLock held as it will wait for the AudioTrack
- // callback thread to exit which may need to execute process() and acquire the mLock.
- mAudioTrack.clear();
-}
-
-void SoundChannel::dump()
-{
- ALOGV("mState = %d mChannelID=%d, mNumChannels=%d, mPos = %d, mPriority=%d, mLoop=%d",
- mState, mChannelID, mNumChannels, mPos, mPriority, mLoop);
-}
-
-void SoundEvent::set(const sp<Sample>& sample, int channelID, float leftVolume,
- float rightVolume, int priority, int loop, float rate)
-{
- mSample = sample;
- mChannelID = channelID;
- mLeftVolume = leftVolume;
- mRightVolume = rightVolume;
- mPriority = priority;
- mLoop = loop;
- mRate =rate;
+ ALOGV("%s()", __func__);
+ auto apiLock = kUseApiLock ? std::make_unique<std::lock_guard<std::mutex>>(mApiLock) : nullptr;
+ return mSoundManager.getUserData();
}
} // end namespace android
diff --git a/media/jni/soundpool/SoundPool.h b/media/jni/soundpool/SoundPool.h
index 01e4faa..d5b16ef 100644
--- a/media/jni/soundpool/SoundPool.h
+++ b/media/jni/soundpool/SoundPool.h
@@ -14,227 +14,59 @@
* limitations under the License.
*/
-#ifndef SOUNDPOOL_H_
-#define SOUNDPOOL_H_
+#pragma once
-#include <utils/threads.h>
-#include <utils/List.h>
-#include <utils/Vector.h>
-#include <utils/KeyedVector.h>
-#include <media/AudioTrack.h>
-#include <binder/MemoryHeapBase.h>
-#include <binder/MemoryBase.h>
+#include "SoundManager.h"
+#include "StreamManager.h"
namespace android {
-static const int IDLE_PRIORITY = -1;
-
-// forward declarations
-class SoundEvent;
-class SoundPoolThread;
-class SoundPool;
-
-// for queued events
-class SoundPoolEvent {
-public:
- explicit SoundPoolEvent(int msg, int arg1=0, int arg2=0) :
- mMsg(msg), mArg1(arg1), mArg2(arg2) {}
- int mMsg;
- int mArg1;
- int mArg2;
- enum MessageType { INVALID, SAMPLE_LOADED };
-};
-
-// callback function prototype
-typedef void SoundPoolCallback(SoundPoolEvent event, SoundPool* soundPool, void* user);
-
-// tracks samples used by application
-class Sample : public RefBase {
-public:
- enum sample_state { UNLOADED, LOADING, READY, UNLOADING };
- Sample(int sampleID, int fd, int64_t offset, int64_t length);
- ~Sample();
- int sampleID() { return mSampleID; }
- int numChannels() { return mNumChannels; }
- int sampleRate() { return mSampleRate; }
- audio_format_t format() { return mFormat; }
- audio_channel_mask_t channelMask() { return mChannelMask; }
- size_t size() { return mSize; }
- int state() { return mState; }
- uint8_t* data() { return static_cast<uint8_t*>(mData->unsecurePointer()); }
- status_t doLoad();
- void startLoad() { mState = LOADING; }
- sp<IMemory> getIMemory() { return mData; }
-
-private:
- void init();
-
- size_t mSize;
- volatile int32_t mRefCount;
- uint16_t mSampleID;
- uint16_t mSampleRate;
- uint8_t mState;
- uint8_t mNumChannels;
- audio_format_t mFormat;
- audio_channel_mask_t mChannelMask;
- int mFd;
- int64_t mOffset;
- int64_t mLength;
- sp<IMemory> mData;
- sp<MemoryHeapBase> mHeap;
-};
-
-// stores pending events for stolen channels
-class SoundEvent
-{
-public:
- SoundEvent() : mChannelID(0), mLeftVolume(0), mRightVolume(0),
- mPriority(IDLE_PRIORITY), mLoop(0), mRate(0) {}
- void set(const sp<Sample>& sample, int channelID, float leftVolume,
- float rightVolume, int priority, int loop, float rate);
- sp<Sample> sample() { return mSample; }
- int channelID() { return mChannelID; }
- float leftVolume() { return mLeftVolume; }
- float rightVolume() { return mRightVolume; }
- int priority() { return mPriority; }
- int loop() { return mLoop; }
- float rate() { return mRate; }
- void clear() { mChannelID = 0; mSample.clear(); }
-
-protected:
- sp<Sample> mSample;
- int mChannelID;
- float mLeftVolume;
- float mRightVolume;
- int mPriority;
- int mLoop;
- float mRate;
-};
-
-// for channels aka AudioTracks
-class SoundChannel : public SoundEvent {
-public:
- enum state { IDLE, RESUMING, STOPPING, PAUSED, PLAYING };
- SoundChannel() : mState(IDLE), mNumChannels(1),
- mPos(0), mToggle(0), mAutoPaused(false), mMuted(false) {}
- ~SoundChannel();
- void init(SoundPool* soundPool);
- void play(const sp<Sample>& sample, int channelID, float leftVolume, float rightVolume,
- int priority, int loop, float rate);
- void setVolume_l(float leftVolume, float rightVolume);
- void setVolume(float leftVolume, float rightVolume);
- void mute(bool muting);
- void stop_l();
- void stop();
- void pause();
- void autoPause();
- void resume();
- void autoResume();
- void setRate(float rate);
- int state() { return mState; }
- void setPriority(int priority) { mPriority = priority; }
- void setLoop(int loop);
- int numChannels() { return mNumChannels; }
- void clearNextEvent() { mNextEvent.clear(); }
- void nextEvent();
- int nextChannelID() { return mNextEvent.channelID(); }
- void dump();
- int getPrevSampleID(void) { return mPrevSampleID; }
-
-private:
- static void callback(int event, void* user, void *info);
- void process(int event, void *info, unsigned long toggle);
- bool doStop_l();
-
- SoundPool* mSoundPool;
- sp<AudioTrack> mAudioTrack;
- SoundEvent mNextEvent;
- Mutex mLock;
- int mState;
- int mNumChannels;
- int mPos;
- int mAudioBufferSize;
- unsigned long mToggle;
- bool mAutoPaused;
- int mPrevSampleID;
- bool mMuted;
-};
-
-// application object for managing a pool of sounds
+/**
+ * Native class for Java SoundPool, manages a pool of sounds.
+ *
+ * See the Android SoundPool Java documentation for description of valid values.
+ * https://developer.android.com/reference/android/media/SoundPool
+ */
class SoundPool {
- friend class SoundPoolThread;
- friend class SoundChannel;
public:
- SoundPool(int maxChannels, const audio_attributes_t* pAttributes);
+ SoundPool(int32_t maxStreams, const audio_attributes_t* attributes);
~SoundPool();
- int load(int fd, int64_t offset, int64_t length, int priority);
- bool unload(int sampleID);
- int play(int sampleID, float leftVolume, float rightVolume, int priority,
- int loop, float rate);
- void pause(int channelID);
- void mute(bool muting);
+
+ // SoundPool Java API support
+ int32_t load(int fd, int64_t offset, int64_t length, int32_t priority);
+ bool unload(int32_t soundID);
+ int32_t play(int32_t soundID, float leftVolume, float rightVolume, int32_t priority,
+ int32_t loop, float rate);
+ void pause(int32_t streamID);
void autoPause();
- void resume(int channelID);
+ void resume(int32_t streamID);
void autoResume();
- void stop(int channelID);
- void setVolume(int channelID, float leftVolume, float rightVolume);
- void setPriority(int channelID, int priority);
- void setLoop(int channelID, int loop);
- void setRate(int channelID, float rate);
- const audio_attributes_t* attributes() { return &mAttributes; }
-
- // called from SoundPoolThread
- void sampleLoaded(int sampleID);
- sp<Sample> findSample(int sampleID);
-
- // called from AudioTrack thread
- void done_l(SoundChannel* channel);
-
- // callback function
+ void stop(int32_t streamID);
+ void setVolume(int32_t streamID, float leftVolume, float rightVolume);
+ void setPriority(int32_t streamID, int32_t priority);
+ void setLoop(int32_t streamID, int32_t loop);
+ void setRate(int32_t streamID, float rate);
void setCallback(SoundPoolCallback* callback, void* user);
- void* getUserData() { return mUserData; }
+ void* getUserData() const;
+
+ // not exposed in the public Java API, used for internal playerSetVolume() muting.
+ void mute(bool muting);
private:
- SoundPool() {} // no default constructor
- bool startThreads();
- sp<Sample> findSample_l(int sampleID);
- SoundChannel* findChannel (int channelID);
- SoundChannel* findNextChannel (int channelID);
- SoundChannel* allocateChannel_l(int priority, int sampleID);
- void moveToFront_l(SoundChannel* channel);
- void notify(SoundPoolEvent event);
- void dump();
- // restart thread
- void addToRestartList(SoundChannel* channel);
- void addToStopList(SoundChannel* channel);
- static int beginThread(void* arg);
- int run();
- void quit();
+ // Constructor initialized variables
+ // Can access without lock as they are internally locked,
+ // though care needs to be taken that the final result composed of
+ // individually consistent actions are consistent.
+ soundpool::SoundManager mSoundManager;
+ soundpool::StreamManager mStreamManager;
- Mutex mLock;
- Mutex mRestartLock;
- Condition mCondition;
- SoundPoolThread* mDecodeThread;
- SoundChannel* mChannelPool;
- List<SoundChannel*> mChannels;
- List<SoundChannel*> mRestart;
- List<SoundChannel*> mStop;
- DefaultKeyedVector< int, sp<Sample> > mSamples;
- int mMaxChannels;
- audio_attributes_t mAttributes;
- int mAllocated;
- int mNextSampleID;
- int mNextChannelID;
- bool mQuit;
- bool mMuted;
-
- // callback
- Mutex mCallbackLock;
- SoundPoolCallback* mCallback;
- void* mUserData;
+ // mApiLock serializes SoundPool application calls (configurable by kUseApiLock).
+ // It only locks at the SoundPool layer and not below. At this level,
+ // mApiLock is only required for autoPause() and autoResume() to prevent zippering
+ // of the individual pauses and resumes, and mute() for self-interaction with itself.
+ // It is optional for all other apis.
+ mutable std::mutex mApiLock;
};
} // end namespace android
-
-#endif /*SOUNDPOOL_H_*/
diff --git a/media/jni/soundpool/SoundPoolThread.cpp b/media/jni/soundpool/SoundPoolThread.cpp
deleted file mode 100644
index ba3b482..0000000
--- a/media/jni/soundpool/SoundPoolThread.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "SoundPoolThread"
-#include "utils/Log.h"
-
-#include "SoundPoolThread.h"
-
-namespace android {
-
-void SoundPoolThread::write(SoundPoolMsg msg) {
- Mutex::Autolock lock(&mLock);
- while (mMsgQueue.size() >= maxMessages) {
- mCondition.wait(mLock);
- }
-
- // if thread is quitting, don't add to queue
- if (mRunning) {
- mMsgQueue.push(msg);
- mCondition.signal();
- }
-}
-
-const SoundPoolMsg SoundPoolThread::read() {
- Mutex::Autolock lock(&mLock);
- while (mMsgQueue.size() == 0) {
- mCondition.wait(mLock);
- }
- SoundPoolMsg msg = mMsgQueue[0];
- mMsgQueue.removeAt(0);
- mCondition.signal();
- return msg;
-}
-
-void SoundPoolThread::quit() {
- Mutex::Autolock lock(&mLock);
- if (mRunning) {
- mRunning = false;
- mMsgQueue.clear();
- mMsgQueue.push(SoundPoolMsg(SoundPoolMsg::KILL, 0));
- mCondition.signal();
- mCondition.wait(mLock);
- }
- ALOGV("return from quit");
-}
-
-SoundPoolThread::SoundPoolThread(SoundPool* soundPool) :
- mSoundPool(soundPool)
-{
- mMsgQueue.setCapacity(maxMessages);
- if (createThreadEtc(beginThread, this, "SoundPoolThread")) {
- mRunning = true;
- }
-}
-
-SoundPoolThread::~SoundPoolThread()
-{
- quit();
-}
-
-int SoundPoolThread::beginThread(void* arg) {
- ALOGV("beginThread");
- SoundPoolThread* soundPoolThread = (SoundPoolThread*)arg;
- return soundPoolThread->run();
-}
-
-int SoundPoolThread::run() {
- ALOGV("run");
- for (;;) {
- SoundPoolMsg msg = read();
- ALOGV("Got message m=%d, mData=%d", msg.mMessageType, msg.mData);
- switch (msg.mMessageType) {
- case SoundPoolMsg::KILL:
- ALOGV("goodbye");
- return NO_ERROR;
- case SoundPoolMsg::LOAD_SAMPLE:
- doLoadSample(msg.mData);
- break;
- default:
- ALOGW("run: Unrecognized message %d\n",
- msg.mMessageType);
- break;
- }
- }
-}
-
-void SoundPoolThread::loadSample(int sampleID) {
- write(SoundPoolMsg(SoundPoolMsg::LOAD_SAMPLE, sampleID));
-}
-
-void SoundPoolThread::doLoadSample(int sampleID) {
- sp <Sample> sample = mSoundPool->findSample(sampleID);
- status_t status = -1;
- if (sample != 0) {
- status = sample->doLoad();
- }
- mSoundPool->notify(SoundPoolEvent(SoundPoolEvent::SAMPLE_LOADED, sampleID, status));
-}
-
-} // end namespace android
diff --git a/media/jni/soundpool/SoundPoolThread.h b/media/jni/soundpool/SoundPoolThread.h
deleted file mode 100644
index 7b3e1dd..0000000
--- a/media/jni/soundpool/SoundPoolThread.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef SOUNDPOOLTHREAD_H_
-#define SOUNDPOOLTHREAD_H_
-
-#include <utils/threads.h>
-#include <utils/Vector.h>
-#include <media/AudioTrack.h>
-
-#include "SoundPool.h"
-
-namespace android {
-
-class SoundPoolMsg {
-public:
- enum MessageType { INVALID, KILL, LOAD_SAMPLE };
- SoundPoolMsg() : mMessageType(INVALID), mData(0) {}
- SoundPoolMsg(MessageType MessageType, int data) :
- mMessageType(MessageType), mData(data) {}
- uint16_t mMessageType;
- uint16_t mData;
-};
-
-/*
- * This class handles background requests from the SoundPool
- */
-class SoundPoolThread {
-public:
- explicit SoundPoolThread(SoundPool* SoundPool);
- ~SoundPoolThread();
- void loadSample(int sampleID);
- void quit();
- void write(SoundPoolMsg msg);
-
-private:
- static const size_t maxMessages = 128;
-
- static int beginThread(void* arg);
- int run();
- void doLoadSample(int sampleID);
- const SoundPoolMsg read();
-
- Mutex mLock;
- Condition mCondition;
- Vector<SoundPoolMsg> mMsgQueue;
- SoundPool* mSoundPool;
- bool mRunning;
-};
-
-} // end namespace android
-
-#endif /*SOUNDPOOLTHREAD_H_*/
diff --git a/media/jni/soundpool/Stream.cpp b/media/jni/soundpool/Stream.cpp
new file mode 100644
index 0000000..e7d4d90
--- /dev/null
+++ b/media/jni/soundpool/Stream.cpp
@@ -0,0 +1,448 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SoundPool::Stream"
+#include <utils/Log.h>
+
+#include "Stream.h"
+
+#include "StreamManager.h"
+
+namespace android::soundpool {
+
+Stream::~Stream()
+{
+ ALOGV("%s(%p)", __func__, this);
+}
+
+void Stream::autoPause()
+{
+ std::lock_guard lock(mLock);
+ if (mState == PLAYING) {
+ ALOGV("%s: track streamID: %d", __func__, (int)mStreamID);
+ mState = PAUSED;
+ mAutoPaused = true;
+ if (mAudioTrack != nullptr) {
+ mAudioTrack->pause();
+ }
+ }
+}
+
+void Stream::autoResume()
+{
+ std::lock_guard lock(mLock);
+ if (mAutoPaused) {
+ if (mState == PAUSED) {
+ ALOGV("%s: track streamID: %d", __func__, (int)mStreamID);
+ mState = PLAYING;
+ if (mAudioTrack != nullptr) {
+ mAudioTrack->start();
+ }
+ }
+ mAutoPaused = false; // New for R: always reset autopause (consistent with API spec).
+ }
+}
+
+void Stream::mute(bool muting)
+{
+ std::lock_guard lock(mLock);
+ mMuted = muting;
+ if (mAudioTrack != nullptr) {
+ if (mMuted) {
+ mAudioTrack->setVolume(0.0f, 0.0f);
+ } else {
+ mAudioTrack->setVolume(mLeftVolume, mRightVolume);
+ }
+ }
+}
+
+void Stream::pause(int32_t streamID)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ if (mState == PLAYING) {
+ ALOGV("%s: track streamID: %d", __func__, streamID);
+ mState = PAUSED;
+ if (mAudioTrack != nullptr) {
+ mAudioTrack->pause();
+ }
+ }
+ }
+}
+
+void Stream::resume(int32_t streamID)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ if (mState == PAUSED) {
+ ALOGV("%s: track streamID: %d", __func__, streamID);
+ mState = PLAYING;
+ if (mAudioTrack != nullptr) {
+ mAudioTrack->start();
+ }
+ mAutoPaused = false; // TODO: is this right? (ambiguous per spec), move outside?
+ }
+ }
+}
+
+void Stream::setRate(int32_t streamID, float rate)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ mRate = rate;
+ if (mAudioTrack != nullptr && mSound != nullptr) {
+ const uint32_t sampleRate = uint32_t(float(mSound->getSampleRate()) * rate + 0.5);
+ mAudioTrack->setSampleRate(sampleRate);
+ }
+ }
+}
+
+void Stream::setVolume_l(float leftVolume, float rightVolume)
+{
+ mLeftVolume = leftVolume;
+ mRightVolume = rightVolume;
+ if (mAudioTrack != nullptr && !mMuted) {
+ mAudioTrack->setVolume(leftVolume, rightVolume);
+ }
+}
+
+void Stream::setVolume(int32_t streamID, float leftVolume, float rightVolume)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ setVolume_l(leftVolume, rightVolume);
+ }
+}
+
+void Stream::setPriority(int32_t streamID, int32_t priority)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ mPriority = priority;
+ }
+}
+
+void Stream::setLoop(int32_t streamID, int32_t loop)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ if (mAudioTrack != nullptr && mSound != nullptr) {
+ const uint32_t loopEnd = mSound->getSizeInBytes() / mSound->getChannelCount() /
+ (mSound->getFormat() == AUDIO_FORMAT_PCM_16_BIT
+ ? sizeof(int16_t) : sizeof(uint8_t));
+ mAudioTrack->setLoop(0, loopEnd, loop);
+ }
+ mLoop = loop;
+ }
+}
+
+void Stream::setPlay(
+ int32_t streamID, const std::shared_ptr<Sound> &sound, int32_t soundID,
+ float leftVolume, float rightVolume, int32_t priority, int32_t loop, float rate)
+{
+ std::lock_guard lock(mLock);
+ // We must be idle, or we must be repurposing a pending Stream.
+ LOG_ALWAYS_FATAL_IF(mState != IDLE && mAudioTrack != nullptr, "State %d must be IDLE", mState);
+ mSound = sound;
+ mSoundID = soundID;
+ mLeftVolume = leftVolume;
+ mRightVolume = rightVolume;
+ mPriority = priority;
+ mLoop = loop;
+ mRate = rate;
+ mState = PLAYING;
+ mAutoPaused = false; // New for R (consistent with Java API spec).
+ mStreamID = streamID; // prefer this to be the last, as it is an atomic sync point
+}
+
+void Stream::setStopTimeNs(int64_t stopTimeNs)
+{
+ std::lock_guard lock(mLock);
+ mStopTimeNs = stopTimeNs;
+}
+
+bool Stream::requestStop(int32_t streamID)
+{
+ std::lock_guard lock(mLock);
+ if (streamID == mStreamID) {
+ if (mAudioTrack != nullptr) {
+ if (mState == PLAYING && !mMuted && (mLeftVolume != 0.f || mRightVolume != 0.f)) {
+ setVolume_l(0.f, 0.f);
+ mStopTimeNs = systemTime() + kStopWaitTimeNs;
+ } else {
+ mStopTimeNs = systemTime();
+ }
+ return true; // must be queued on the restart list.
+ }
+ stop_l();
+ }
+ return false;
+}
+
+void Stream::stop()
+{
+ std::lock_guard lock(mLock);
+ stop_l();
+}
+
+void Stream::stop_l()
+{
+ if (mState != IDLE) {
+ if (mAudioTrack != nullptr) {
+ mAudioTrack->stop();
+ }
+ mSound.reset();
+ mState = IDLE;
+ }
+}
+
+void Stream::clearAudioTrack()
+{
+ // This will invoke the destructor which waits for the AudioTrack thread to join,
+ // and is currently the only safe way to ensure there are no callbacks afterwards.
+ mAudioTrack.clear();
+}
+
+Stream* Stream::getPairStream() const
+{
+ return mStreamManager->getPairStream(this);
+}
+
+Stream* Stream::playPairStream() {
+ Stream* pairStream = getPairStream();
+ LOG_ALWAYS_FATAL_IF(pairStream == nullptr, "No pair stream!");
+ sp<AudioTrack> releaseTracks[2];
+ {
+ // TODO: Do we really want to force a simultaneous synchronization between
+ // the stream and its pair?
+
+ // note locking order - the paired stream is obtained before the queued stream.
+ // we can invert the locking order, but it is slightly more optimal to do it this way.
+ std::lock_guard lockp(pairStream->mLock);
+ if (pairStream->mSound == nullptr) {
+ return nullptr; // no pair sound
+ }
+ {
+ std::lock_guard lock(mLock);
+ LOG_ALWAYS_FATAL_IF(mState != IDLE, "State: %d must be IDLE", mState);
+ // TODO: do we want a specific set() here?
+ pairStream->mAudioTrack = mAudioTrack;
+ pairStream->mSoundID = mSoundID; // optimization to reuse AudioTrack.
+ pairStream->mToggle = mToggle;
+ pairStream->mAutoPaused = mAutoPaused; // save autopause state
+ pairStream->mMuted = mMuted;
+ mAudioTrack.clear(); // the pair owns the audiotrack.
+ mSound.reset();
+ mSoundID = 0;
+ }
+ // TODO: do we need a specific play_l() anymore?
+ const int pairState = pairStream->mState;
+ pairStream->play_l(pairStream->mSound, pairStream->mStreamID,
+ pairStream->mLeftVolume, pairStream->mRightVolume, pairStream->mPriority,
+ pairStream->mLoop, pairStream->mRate, releaseTracks);
+ if (pairStream->mState == IDLE) {
+ return nullptr; // AudioTrack error
+ }
+ if (pairState == PAUSED) { // reestablish pause
+ pairStream->mState = PAUSED;
+ pairStream->mAudioTrack->pause();
+ }
+ }
+ // release tracks outside of Stream lock
+ return pairStream;
+}
+
+void Stream::play_l(const std::shared_ptr<Sound>& sound, int32_t nextStreamID,
+ float leftVolume, float rightVolume, int32_t priority, int32_t loop, float rate,
+ sp<AudioTrack> releaseTracks[2])
+{
+ // These tracks are released without the lock.
+ sp<AudioTrack> &oldTrack = releaseTracks[0];
+ sp<AudioTrack> &newTrack = releaseTracks[1];
+ status_t status = NO_ERROR;
+
+ {
+ ALOGV("%s(%p)(soundID=%d, streamID=%d, leftVolume=%f, rightVolume=%f,"
+ " priority=%d, loop=%d, rate=%f)",
+ __func__, this, sound->getSoundID(), nextStreamID, leftVolume, rightVolume,
+ priority, loop, rate);
+
+ // initialize track
+ const audio_stream_type_t streamType =
+ AudioSystem::attributesToStreamType(*mStreamManager->getAttributes());
+ const int32_t channelCount = sound->getChannelCount();
+ const uint32_t sampleRate = uint32_t(float(sound->getSampleRate()) * rate + 0.5);
+ size_t frameCount = 0;
+
+ if (loop) {
+ const audio_format_t format = sound->getFormat();
+ const size_t frameSize = audio_is_linear_pcm(format)
+ ? channelCount * audio_bytes_per_sample(format) : 1;
+ frameCount = sound->getSizeInBytes() / frameSize;
+ }
+
+ // check if the existing track has the same sound id.
+ if (mAudioTrack != nullptr && mSoundID == sound->getSoundID()) {
+ // the sample rate may fail to change if the audio track is a fast track.
+ if (mAudioTrack->setSampleRate(sampleRate) == NO_ERROR) {
+ newTrack = mAudioTrack;
+ ALOGV("%s: reusing track %p for sound %d",
+ __func__, mAudioTrack.get(), sound->getSoundID());
+ }
+ }
+ if (newTrack == 0) {
+ // mToggle toggles each time a track is started on a given stream.
+ // The toggle is concatenated with the Stream address and passed to AudioTrack
+ // as callback user data. This enables the detection of callbacks received from the old
+ // audio track while the new one is being started and avoids processing them with
+ // wrong audio audio buffer size (mAudioBufferSize)
+ auto toggle = mToggle ^ 1;
+ void* userData = (void*)((uintptr_t)this | toggle);
+ audio_channel_mask_t soundChannelMask = sound->getChannelMask();
+ // When sound contains a valid channel mask, use it as is.
+ // Otherwise, use stream count to calculate channel mask.
+ audio_channel_mask_t channelMask = soundChannelMask != AUDIO_CHANNEL_NONE
+ ? soundChannelMask : audio_channel_out_mask_from_count(channelCount);
+
+ // do not create a new audio track if current track is compatible with sound parameters
+
+ newTrack = new AudioTrack(streamType, sampleRate, sound->getFormat(),
+ channelMask, sound->getIMemory(), AUDIO_OUTPUT_FLAG_FAST,
+ staticCallback, userData,
+ 0 /*default notification frames*/, AUDIO_SESSION_ALLOCATE,
+ AudioTrack::TRANSFER_DEFAULT,
+ nullptr /*offloadInfo*/, -1 /*uid*/, -1 /*pid*/,
+ mStreamManager->getAttributes());
+
+ oldTrack = mAudioTrack;
+ status = newTrack->initCheck();
+ if (status != NO_ERROR) {
+ ALOGE("%s: error creating AudioTrack", __func__);
+ // newTrack goes out of scope, so reference count drops to zero
+ goto exit;
+ }
+ // From now on, AudioTrack callbacks received with previous toggle value will be ignored.
+ mToggle = toggle;
+ mAudioTrack = newTrack;
+ ALOGV("%s: using new track %p for sound %d",
+ __func__, newTrack.get(), sound->getSoundID());
+ }
+ if (mMuted) {
+ newTrack->setVolume(0.0f, 0.0f);
+ } else {
+ newTrack->setVolume(leftVolume, rightVolume);
+ }
+ newTrack->setLoop(0, frameCount, loop);
+ mAudioTrack->start();
+ mSound = sound;
+ mSoundID = sound->getSoundID();
+ mPriority = priority;
+ mLoop = loop;
+ mLeftVolume = leftVolume;
+ mRightVolume = rightVolume;
+ mRate = rate;
+ mState = PLAYING;
+ mStopTimeNs = 0;
+ mStreamID = nextStreamID; // prefer this to be the last, as it is an atomic sync point
+ }
+
+exit:
+ ALOGV("%s: delete oldTrack %p", __func__, oldTrack.get());
+ if (status != NO_ERROR) {
+ // TODO: should we consider keeping the soundID if the old track is OK?
+ // Do not attempt to restart this track (should we remove the stream id?)
+ mState = IDLE;
+ mSoundID = 0;
+ mSound.reset();
+ mAudioTrack.clear(); // actual release from releaseTracks[]
+ }
+}
+
+/* static */
+void Stream::staticCallback(int event, void* user, void* info)
+{
+ const uintptr_t userAsInt = (uintptr_t)user;
+ Stream* stream = reinterpret_cast<Stream*>(userAsInt & ~1);
+ stream->callback(event, info, userAsInt & 1, 0 /* tries */);
+}
+
+void Stream::callback(int event, void* info, int toggle, int tries)
+{
+ ALOGV("%s streamID %d", __func__, (int)mStreamID);
+ int32_t activeStreamIDToRestart = 0;
+ {
+ std::unique_lock lock(mLock);
+
+ if (mAudioTrack == nullptr) {
+ // The AudioTrack is either with this stream or its pair.
+ // if this swaps a few times, the toggle is bound to be wrong, so we fail then.
+ //
+ // TODO: Modify AudioTrack callbacks to avoid the hacky toggle and retry
+ // logic here.
+ if (tries < 3) {
+ lock.unlock();
+ getPairStream()->callback(event, info, toggle, tries + 1);
+ } else {
+ ALOGW("%s streamID %d cannot find track", __func__, (int)mStreamID);
+ }
+ return;
+ }
+ if (mToggle != toggle) {
+ ALOGD("%s streamID %d wrong toggle", __func__, (int)mStreamID);
+ return;
+ }
+ switch (event) {
+ case AudioTrack::EVENT_MORE_DATA:
+ ALOGW("%s streamID %d Invalid EVENT_MORE_DATA for static track",
+ __func__, (int)mStreamID);
+ break;
+ case AudioTrack::EVENT_UNDERRUN:
+ ALOGW("%s streamID %d Invalid EVENT_UNDERRUN for static track",
+ __func__, (int)mStreamID);
+ break;
+ case AudioTrack::EVENT_BUFFER_END:
+ ALOGV("%s streamID %d EVENT_BUFFER_END", __func__, (int)mStreamID);
+ if (mState != IDLE) {
+ activeStreamIDToRestart = mStreamID;
+ mStopTimeNs = systemTime();
+ }
+ break;
+ case AudioTrack::EVENT_LOOP_END:
+ ALOGV("%s streamID %d EVENT_LOOP_END", __func__, (int)mStreamID);
+ break;
+ case AudioTrack::EVENT_NEW_IAUDIOTRACK:
+ ALOGV("%s streamID %d NEW_IAUDIOTRACK", __func__, (int)mStreamID);
+ break;
+ default:
+ ALOGW("%s streamID %d Invalid event %d", __func__, (int)mStreamID, event);
+ break;
+ }
+ } // lock ends here. This is on the callback thread, no need to be precise.
+ if (activeStreamIDToRestart > 0) {
+ // Restart only if a particular streamID is still current and active.
+ ALOGV("%s: moveToRestartQueue %d", __func__, activeStreamIDToRestart);
+ mStreamManager->moveToRestartQueue(this, activeStreamIDToRestart);
+ }
+}
+
+void Stream::dump() const
+{
+ ALOGV("mPairStream=%p, mState=%d, mStreamID=%d, mSoundID=%d, mPriority=%d, mLoop=%d",
+ getPairStream(), mState, (int)mStreamID, mSoundID, mPriority, mLoop);
+}
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/Stream.h b/media/jni/soundpool/Stream.h
new file mode 100644
index 0000000..82d2690
--- /dev/null
+++ b/media/jni/soundpool/Stream.h
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "Sound.h"
+
+#include <audio_utils/clock.h>
+#include <media/AudioTrack.h>
+
+namespace android::soundpool {
+
+// This is the amount of time to wait after stop is called when stealing an
+// AudioTrack to allow the sound to ramp down. If this is 0, glitches
+// may occur when stealing an AudioTrack.
+inline constexpr int64_t kStopWaitTimeNs = 20 * NANOS_PER_MILLISECOND;
+
+inline constexpr size_t kCacheLineSize = 64; /* std::hardware_constructive_interference_size */
+
+class StreamManager; // forward decl
+
+/**
+ * A Stream is associated with a StreamID exposed to the app to play a Sound.
+ *
+ * The Stream uses monitor locking strategy on mLock.
+ * https://en.wikipedia.org/wiki/Monitor_(synchronization)
+ *
+ * where public methods are guarded by a lock (as needed)
+ *
+ * For Java equivalent APIs, see
+ * https://developer.android.com/reference/android/media/SoundPool
+ *
+ * Streams are paired by the StreamManager, so one stream in the pair may be "stopping"
+ * while the other stream of the pair has been prepared to run
+ * (and the streamID returned to the app) pending its pair to be stopped.
+ * The pair of a Stream may be obtained by calling getPairStream(),
+ * where this->getPairStream()->getPairStream() == this; (pair is a commutative relationship).
+ *
+ * playPairStream() and getPairPriority() access the paired stream.
+ * See also StreamManager.h for details of physical layout implications of paired streams.
+ */
+class alignas(kCacheLineSize) Stream {
+public:
+ enum state { IDLE, PAUSED, PLAYING };
+ // The PAUSED, PLAYING state directly corresponds to the AudioTrack state of an active Stream.
+ //
+ // The IDLE state indicates an inactive Stream. An IDLE Stream may have a non-nullptr
+ // AudioTrack, which may be recycled for use if the SoundID matches the next Stream playback.
+ //
+ // PAUSED -> PLAYING through resume() (see also autoResume())
+ // PLAYING -> PAUSED through pause() (see also autoPause())
+ //
+ // IDLE is the initial state of a Stream and also when a stream becomes inactive.
+ // {PAUSED, PLAYING} -> IDLE through stop() (or if the Sound finishes playing)
+ // IDLE -> PLAYING through play(). (there is no way to start a Stream in paused mode).
+
+ ~Stream();
+ void setStreamManager(StreamManager* streamManager) { // non-nullptr
+ mStreamManager = streamManager; // set in StreamManager constructor, not changed
+ }
+
+ // The following methods are monitor locked by mLock.
+ //
+ // For methods taking a streamID:
+ // if the streamID matches the Stream's mStreamID, then method proceeds
+ // else the command is ignored with no effect.
+
+ // returns true if the stream needs to be explicitly stopped.
+ bool requestStop(int32_t streamID);
+ void stop(); // explicit stop(), typically called from the worker thread.
+ void clearAudioTrack();
+ void pause(int32_t streamID);
+ void autoPause(); // see the Java SoundPool.autoPause documentation for details.
+ void resume(int32_t streamID);
+ void autoResume();
+ void mute(bool muting);
+ void dump() const;
+
+ // returns the pair stream if successful, nullptr otherwise
+ Stream* playPairStream();
+
+ // These parameters are explicitly checked in the SoundPool class
+ // so never deviate from the Java API specified values.
+ void setVolume(int32_t streamID, float leftVolume, float rightVolume);
+ void setRate(int32_t streamID, float rate);
+ void setPriority(int32_t streamID, int priority);
+ void setLoop(int32_t streamID, int loop);
+ void setPlay(int32_t streamID, const std::shared_ptr<Sound> &sound, int32_t soundID,
+ float leftVolume, float rightVolume, int32_t priority, int32_t loop, float rate);
+ void setStopTimeNs(int64_t stopTimeNs); // systemTime() clock monotonic.
+
+ // The following getters are not locked and have weak consistency.
+ // These are considered advisory only - being stale is of nuisance.
+ int32_t getPriority() const { return mPriority; }
+ int32_t getPairPriority() const { return getPairStream()->getPriority(); }
+ int64_t getStopTimeNs() const { return mStopTimeNs; }
+
+ int32_t getStreamID() const { return mStreamID; } // Can change with setPlay()
+ int32_t getSoundID() const { return mSoundID; } // Can change with play_l()
+ bool hasSound() const { return mSound.get() != nullptr; }
+
+ Stream* getPairStream() const; // this never changes. See top of header.
+
+private:
+ void play_l(const std::shared_ptr<Sound>& sound, int streamID,
+ float leftVolume, float rightVolume, int priority, int loop, float rate,
+ sp<AudioTrack> releaseTracks[2]);
+ void stop_l();
+ void setVolume_l(float leftVolume, float rightVolume);
+
+ // For use with AudioTrack callback.
+ static void staticCallback(int event, void* user, void* info);
+ void callback(int event, void* info, int toggle, int tries);
+
+ // StreamManager should be set on construction and not changed.
+ // release mLock before calling into StreamManager
+ StreamManager* mStreamManager = nullptr;
+
+ mutable std::mutex mLock;
+ std::atomic_int32_t mStreamID = 0; // Note: valid streamIDs are always positive.
+ int mState = IDLE;
+ std::shared_ptr<Sound> mSound; // Non-null if playing.
+ int32_t mSoundID = 0; // The sound ID associated with the AudioTrack.
+ float mLeftVolume = 0.f;
+ float mRightVolume = 0.f;
+ int32_t mPriority = INT32_MIN;
+ int32_t mLoop = 0;
+ float mRate = 0.f;
+ bool mAutoPaused = false;
+ bool mMuted = false;
+
+ sp<AudioTrack> mAudioTrack;
+ int mToggle = 0;
+ int64_t mStopTimeNs = 0; // if nonzero, time to wait for stop.
+};
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/StreamManager.cpp b/media/jni/soundpool/StreamManager.cpp
new file mode 100644
index 0000000..8928c47
--- /dev/null
+++ b/media/jni/soundpool/StreamManager.cpp
@@ -0,0 +1,407 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SoundPool::StreamManager"
+#include <utils/Log.h>
+
+#include "StreamManager.h"
+
+#include <audio_utils/clock.h>
+#include <audio_utils/roundup.h>
+
+namespace android::soundpool {
+
+// kMaxStreams is number that should be less than the current AudioTrack max per UID of 40.
+// It is the maximum number of AudioTrack resources allowed in the SoundPool.
+// We suggest a value at least 4 or greater to allow CTS tests to pass.
+static constexpr int32_t kMaxStreams = 32;
+
+// kStealActiveStream_OldestFirst = false historically (Q and earlier)
+// Changing to true could break app expectations but could change behavior beneficially.
+// In R, we change this to true, as it is the correct way per SoundPool documentation.
+static constexpr bool kStealActiveStream_OldestFirst = true;
+
+// kPlayOnCallingThread = true prior to R.
+// Changing to false means calls to play() are almost instantaneous instead of taking around
+// ~10ms to launch the AudioTrack. It is perhaps 100x faster.
+static constexpr bool kPlayOnCallingThread = false;
+
+// Amount of time for a StreamManager thread to wait before closing.
+static constexpr int64_t kWaitTimeBeforeCloseNs = 9 * NANOS_PER_SECOND;
+
+////////////
+
+StreamMap::StreamMap(int32_t streams) {
+ ALOGV("%s(%d)", __func__, streams);
+ if (streams > kMaxStreams) {
+ ALOGW("%s: requested %d streams, clamping to %d", __func__, streams, kMaxStreams);
+ streams = kMaxStreams;
+ } else if (streams < 1) {
+ ALOGW("%s: requested %d streams, clamping to 1", __func__, streams);
+ streams = 1;
+ }
+ mStreamPoolSize = streams * 2;
+ mStreamPool.reset(new Stream[mStreamPoolSize]);
+ // we use a perfect hash table with 2x size to map StreamIDs to Stream pointers.
+ mPerfectHash = std::make_unique<PerfectHash<int32_t, Stream *>>(roundup(mStreamPoolSize * 2));
+}
+
+Stream* StreamMap::findStream(int32_t streamID) const
+{
+ Stream *stream = lookupStreamFromId(streamID);
+ return stream != nullptr && stream->getStreamID() == streamID ? stream : nullptr;
+}
+
+size_t StreamMap::streamPosition(const Stream* stream) const
+{
+ ptrdiff_t index = stream - mStreamPool.get();
+ LOG_ALWAYS_FATAL_IF(index < 0 || index >= mStreamPoolSize,
+ "%s: stream position out of range: %td", __func__, index);
+ return (size_t)index;
+}
+
+Stream* StreamMap::lookupStreamFromId(int32_t streamID) const
+{
+ return streamID > 0 ? mPerfectHash->getValue(streamID).load() : nullptr;
+}
+
+int32_t StreamMap::getNextIdForStream(Stream* stream) const {
+ // even though it is const, it mutates the internal hash table.
+ const int32_t id = mPerfectHash->generateKey(
+ stream,
+ [] (Stream *stream) {
+ return stream == nullptr ? 0 : stream->getStreamID();
+ }, /* getKforV() */
+ stream->getStreamID() /* oldID */);
+ return id;
+}
+
+////////////
+
+StreamManager::StreamManager(
+ int32_t streams, size_t threads, const audio_attributes_t* attributes)
+ : StreamMap(streams)
+ , mAttributes(*attributes)
+{
+ ALOGV("%s(%d, %zu, ...)", __func__, streams, threads);
+ forEach([this](Stream *stream) {
+ stream->setStreamManager(this);
+ if ((streamPosition(stream) & 1) == 0) { // put the first stream of pair as available.
+ mAvailableStreams.insert(stream);
+ }
+ });
+
+ mThreadPool = std::make_unique<ThreadPool>(
+ std::min(threads, (size_t)std::thread::hardware_concurrency()),
+ "SoundPool_");
+}
+
+StreamManager::~StreamManager()
+{
+ ALOGV("%s", __func__);
+ {
+ std::unique_lock lock(mStreamManagerLock);
+ mQuit = true;
+ mStreamManagerCondition.notify_all();
+ }
+ mThreadPool->quit();
+
+ // call stop on the stream pool
+ forEach([](Stream *stream) { stream->stop(); });
+
+ // This invokes the destructor on the AudioTracks -
+ // we do it here to ensure that AudioTrack callbacks will not occur
+ // afterwards.
+ forEach([](Stream *stream) { stream->clearAudioTrack(); });
+}
+
+
+int32_t StreamManager::queueForPlay(const std::shared_ptr<Sound> &sound,
+ int32_t soundID, float leftVolume, float rightVolume,
+ int32_t priority, int32_t loop, float rate)
+{
+ ALOGV("%s(sound=%p, soundID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f)",
+ __func__, sound.get(), soundID, leftVolume, rightVolume, priority, loop, rate);
+ bool launchThread = false;
+ int32_t streamID = 0;
+
+ { // for lock
+ std::unique_lock lock(mStreamManagerLock);
+ Stream *newStream = nullptr;
+ bool fromAvailableQueue = false;
+ ALOGV("%s: mStreamManagerLock lock acquired", __func__);
+
+ sanityCheckQueue_l();
+ // find an available stream, prefer one that has matching sound id.
+ if (mAvailableStreams.size() > 0) {
+ newStream = *mAvailableStreams.begin();
+ for (auto stream : mAvailableStreams) {
+ if (stream->getSoundID() == soundID) {
+ newStream = stream;
+ break;
+ }
+ }
+ if (newStream != nullptr) {
+ newStream->setStopTimeNs(systemTime());
+ }
+ fromAvailableQueue = true;
+ }
+
+ // also look in the streams restarting (if the paired stream doesn't have a pending play)
+ if (newStream == nullptr || newStream->getSoundID() != soundID) {
+ for (auto [unused , stream] : mRestartStreams) {
+ if (!stream->getPairStream()->hasSound()) {
+ if (stream->getSoundID() == soundID) {
+ newStream = stream;
+ break;
+ } else if (newStream == nullptr) {
+ newStream = stream;
+ }
+ }
+ }
+ }
+
+ // no available streams, look for one to steal from the active list
+ if (newStream == nullptr) {
+ for (auto stream : mActiveStreams) {
+ if (stream->getPriority() <= priority) {
+ if (newStream == nullptr
+ || newStream->getPriority() > stream->getPriority()) {
+ newStream = stream;
+ }
+ }
+ }
+ if (newStream != nullptr) { // we need to mute as it is still playing.
+ (void)newStream->requestStop(newStream->getStreamID());
+ }
+ }
+
+ // none found, look for a stream that is restarting, evict one.
+ if (newStream == nullptr) {
+ for (auto [unused, stream] : mRestartStreams) {
+ if (stream->getPairPriority() <= priority) {
+ newStream = stream;
+ break;
+ }
+ }
+ }
+
+ // DO NOT LOOK into mProcessingStreams as those are held by the StreamManager threads.
+
+ if (newStream == nullptr) {
+ ALOGD("%s: unable to find stream, returning 0", __func__);
+ return 0; // unable to find available stream
+ }
+
+ Stream *pairStream = newStream->getPairStream();
+ streamID = getNextIdForStream(pairStream);
+ pairStream->setPlay(
+ streamID, sound, soundID, leftVolume, rightVolume, priority, loop, rate);
+ if (fromAvailableQueue && kPlayOnCallingThread) {
+ removeFromQueues_l(newStream);
+ mProcessingStreams.emplace(newStream);
+ lock.unlock();
+ if (Stream* nextStream = newStream->playPairStream()) {
+ lock.lock();
+ ALOGV("%s: starting streamID:%d", __func__, nextStream->getStreamID());
+ addToActiveQueue_l(nextStream);
+ } else {
+ lock.lock();
+ mAvailableStreams.insert(newStream);
+ streamID = 0;
+ }
+ mProcessingStreams.erase(newStream);
+ } else {
+ launchThread = moveToRestartQueue_l(newStream) && needMoreThreads_l();
+ }
+ sanityCheckQueue_l();
+ ALOGV("%s: mStreamManagerLock released", __func__);
+ } // lock
+
+ if (launchThread) {
+ const int32_t id __unused = mThreadPool->launch([this](int32_t id) { run(id); });
+ ALOGV_IF(id != 0, "%s: launched thread %d", __func__, id);
+ }
+ ALOGV("%s: returning %d", __func__, streamID);
+ return streamID;
+}
+
+void StreamManager::moveToRestartQueue(
+ Stream* stream, int32_t activeStreamIDToMatch)
+{
+ ALOGV("%s(stream(ID)=%d, activeStreamIDToMatch=%d)",
+ __func__, stream->getStreamID(), activeStreamIDToMatch);
+ bool restart;
+ {
+ std::lock_guard lock(mStreamManagerLock);
+ sanityCheckQueue_l();
+ if (mProcessingStreams.count(stream) > 0 ||
+ mProcessingStreams.count(stream->getPairStream()) > 0) {
+ ALOGD("%s: attempting to restart processing stream(%d)",
+ __func__, stream->getStreamID());
+ restart = false;
+ } else {
+ moveToRestartQueue_l(stream, activeStreamIDToMatch);
+ restart = needMoreThreads_l();
+ }
+ sanityCheckQueue_l();
+ }
+ if (restart) {
+ const int32_t id __unused = mThreadPool->launch([this](int32_t id) { run(id); });
+ ALOGV_IF(id != 0, "%s: launched thread %d", __func__, id);
+ }
+}
+
+bool StreamManager::moveToRestartQueue_l(
+ Stream* stream, int32_t activeStreamIDToMatch)
+{
+ ALOGV("%s(stream(ID)=%d, activeStreamIDToMatch=%d)",
+ __func__, stream->getStreamID(), activeStreamIDToMatch);
+ if (activeStreamIDToMatch > 0 && stream->getStreamID() != activeStreamIDToMatch) {
+ return false;
+ }
+ const ssize_t found = removeFromQueues_l(stream, activeStreamIDToMatch);
+ if (found < 0) return false;
+
+ LOG_ALWAYS_FATAL_IF(found > 1, "stream on %zd > 1 stream lists", found);
+
+ addToRestartQueue_l(stream);
+ mStreamManagerCondition.notify_one();
+ return true;
+}
+
+ssize_t StreamManager::removeFromQueues_l(
+ Stream* stream, int32_t activeStreamIDToMatch) {
+ size_t found = 0;
+ for (auto it = mActiveStreams.begin(); it != mActiveStreams.end(); ++it) {
+ if (*it == stream) {
+ mActiveStreams.erase(it); // we erase the iterator and break (otherwise it not safe).
+ ++found;
+ break;
+ }
+ }
+ // activeStreamIDToMatch is nonzero indicates we proceed only if found.
+ if (found == 0 && activeStreamIDToMatch > 0) {
+ return -1; // special code: not present on active streams, ignore restart request
+ }
+
+ for (auto it = mRestartStreams.begin(); it != mRestartStreams.end(); ++it) {
+ if (it->second == stream) {
+ mRestartStreams.erase(it);
+ ++found;
+ break;
+ }
+ }
+ found += mAvailableStreams.erase(stream);
+
+ // streams on mProcessingStreams are undergoing processing by the StreamManager thread
+ // and do not participate in normal stream migration.
+ return found;
+}
+
+void StreamManager::addToRestartQueue_l(Stream *stream) {
+ mRestartStreams.emplace(stream->getStopTimeNs(), stream);
+}
+
+void StreamManager::addToActiveQueue_l(Stream *stream) {
+ if (kStealActiveStream_OldestFirst) {
+ mActiveStreams.push_back(stream); // oldest to newest
+ } else {
+ mActiveStreams.push_front(stream); // newest to oldest
+ }
+}
+
+void StreamManager::run(int32_t id)
+{
+ ALOGV("%s(%d) entering", __func__, id);
+ int64_t waitTimeNs = kWaitTimeBeforeCloseNs;
+ std::unique_lock lock(mStreamManagerLock);
+ while (!mQuit) {
+ mStreamManagerCondition.wait_for(
+ lock, std::chrono::duration<int64_t, std::nano>(waitTimeNs));
+ ALOGV("%s(%d) awake", __func__, id);
+
+ sanityCheckQueue_l();
+
+ if (mQuit || (mRestartStreams.empty() && waitTimeNs == kWaitTimeBeforeCloseNs)) {
+ break; // end the thread
+ }
+
+ waitTimeNs = kWaitTimeBeforeCloseNs;
+ while (!mQuit && !mRestartStreams.empty()) {
+ const nsecs_t nowNs = systemTime();
+ auto it = mRestartStreams.begin();
+ Stream* const stream = it->second;
+ const int64_t diffNs = stream->getStopTimeNs() - nowNs;
+ if (diffNs > 0) {
+ waitTimeNs = std::min(waitTimeNs, diffNs);
+ break;
+ }
+ mRestartStreams.erase(it);
+ mProcessingStreams.emplace(stream);
+ lock.unlock();
+ stream->stop();
+ ALOGV("%s(%d) stopping streamID:%d", __func__, id, stream->getStreamID());
+ if (Stream* nextStream = stream->playPairStream()) {
+ ALOGV("%s(%d) starting streamID:%d", __func__, id, nextStream->getStreamID());
+ lock.lock();
+ if (nextStream->getStopTimeNs() > 0) {
+ // the next stream was stopped before we can move it to the active queue.
+ ALOGV("%s(%d) stopping started streamID:%d",
+ __func__, id, nextStream->getStreamID());
+ moveToRestartQueue_l(nextStream);
+ } else {
+ addToActiveQueue_l(nextStream);
+ }
+ } else {
+ lock.lock();
+ mAvailableStreams.insert(stream);
+ }
+ mProcessingStreams.erase(stream);
+ sanityCheckQueue_l();
+ }
+ }
+ ALOGV("%s(%d) exiting", __func__, id);
+}
+
+void StreamManager::dump() const
+{
+ forEach([](const Stream *stream) { stream->dump(); });
+}
+
+void StreamManager::sanityCheckQueue_l() const
+{
+ // We want to preserve the invariant that each stream pair is exactly on one of the queues.
+ const size_t availableStreams = mAvailableStreams.size();
+ const size_t restartStreams = mRestartStreams.size();
+ const size_t activeStreams = mActiveStreams.size();
+ const size_t processingStreams = mProcessingStreams.size();
+ const size_t managedStreams = availableStreams + restartStreams + activeStreams
+ + processingStreams;
+ const size_t totalStreams = getStreamMapSize() >> 1;
+ LOG_ALWAYS_FATAL_IF(managedStreams != totalStreams,
+ "%s: mAvailableStreams:%zu + mRestartStreams:%zu + "
+ "mActiveStreams:%zu + mProcessingStreams:%zu = %zu != total streams %zu",
+ __func__, availableStreams, restartStreams, activeStreams, processingStreams,
+ managedStreams, totalStreams);
+ ALOGV("%s: mAvailableStreams:%zu + mRestartStreams:%zu + "
+ "mActiveStreams:%zu + mProcessingStreams:%zu = %zu (total streams: %zu)",
+ __func__, availableStreams, restartStreams, activeStreams, processingStreams,
+ managedStreams, totalStreams);
+}
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/StreamManager.h b/media/jni/soundpool/StreamManager.h
new file mode 100644
index 0000000..8c98ac9
--- /dev/null
+++ b/media/jni/soundpool/StreamManager.h
@@ -0,0 +1,467 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "Stream.h"
+
+#include <condition_variable>
+#include <future>
+#include <list>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <unordered_set>
+#include <vector>
+
+#include <utils/AndroidThreads.h>
+
+namespace android::soundpool {
+
+// TODO: Move helper classes to a utility file, with separate test.
+
+/**
+ * JavaThread is used like std::thread but for threads that may call the JVM.
+ *
+ * std::thread does not easily attach to the JVM. We need JVM capable threads
+ * from createThreadEtc() since android binder call optimization may attempt to
+ * call back into Java if the SoundPool runs in system server.
+ *
+ *
+ * No locking is required - the member variables are inherently thread-safe.
+ */
+class JavaThread {
+public:
+ JavaThread(std::function<void()> f, const char *name)
+ : mF{std::move(f)} {
+ createThreadEtc(staticFunction, this, name);
+ }
+
+ JavaThread(JavaThread &&) = delete; // uses "this" ptr, not moveable.
+
+ void join() const {
+ mFuture.wait();
+ }
+
+ bool isClosed() const {
+ return mIsClosed;
+ }
+
+private:
+ static int staticFunction(void *data) {
+ JavaThread *jt = static_cast<JavaThread *>(data);
+ jt->mF();
+ jt->mIsClosed = true;
+ jt->mPromise.set_value();
+ return 0;
+ }
+
+ // No locking is provided as these variables are initialized in the constructor
+ // and the members referenced are thread-safe objects.
+ // (mFuture.wait() can block multiple threads.)
+ // Note the order of member variables is reversed for destructor.
+ const std::function<void()> mF;
+ // Used in join() to block until the thread completes.
+ // See https://en.cppreference.com/w/cpp/thread/promise for the void specialization of
+ // promise.
+ std::promise<void> mPromise;
+ std::future<void> mFuture{mPromise.get_future()};
+ std::atomic_bool mIsClosed = false;
+};
+
+/**
+ * The ThreadPool manages thread lifetimes of SoundPool worker threads.
+ *
+ * TODO: the (eventual) goal of ThreadPool is to transparently and cooperatively
+ * maximize CPU utilization while avoiding starvation of other applications.
+ * Some possibilities:
+ *
+ * We should create worker threads when we have SoundPool work and the system is idle.
+ * CPU cycles are "use-it-or-lose-it" when the system is idle.
+ *
+ * We should adjust the priority of worker threads so that the second (and subsequent) worker
+ * threads have lower priority (should we try to promote priority also?).
+ *
+ * We should throttle the spawning of new worker threads, spacing over time, to avoid
+ * creating too many new threads all at once, on initialization.
+ */
+class ThreadPool {
+public:
+ ThreadPool(size_t maxThreadCount, std::string name)
+ : mMaxThreadCount(maxThreadCount)
+ , mName{std::move(name)} { }
+
+ ~ThreadPool() { quit(); }
+
+ size_t getActiveThreadCount() const { return mActiveThreadCount; }
+ size_t getMaxThreadCount() const { return mMaxThreadCount; }
+
+ void quit() {
+ std::list<std::unique_ptr<JavaThread>> threads;
+ {
+ std::lock_guard lock(mThreadLock);
+ if (mQuit) return; // already joined.
+ mQuit = true;
+ threads = std::move(mThreads);
+ mThreads.clear();
+ }
+ // mQuit set under lock, no more threads will be created.
+ for (auto &thread : threads) {
+ thread->join();
+ thread.reset();
+ }
+ LOG_ALWAYS_FATAL_IF(mActiveThreadCount != 0,
+ "Invalid Active Threads: %zu", (size_t)mActiveThreadCount);
+ }
+
+ // returns a non-zero id if successful, the id is to help logging messages.
+ int32_t launch(std::function<void(int32_t /* id */)> f) {
+ std::list<std::unique_ptr<JavaThread>> threadsToRelease; // release outside of lock.
+ std::lock_guard lock(mThreadLock);
+ if (mQuit) return 0; // ignore if we have quit
+
+ // clean up threads.
+ for (auto it = mThreads.begin(); it != mThreads.end(); ) {
+ if ((*it)->isClosed()) {
+ threadsToRelease.emplace_back(std::move(*it));
+ it = mThreads.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ const size_t threadCount = mThreads.size();
+ if (threadCount < mMaxThreadCount) {
+ // if the id wraps, we don't care about collisions. it's just for logging.
+ mNextThreadId = mNextThreadId == INT32_MAX ? 1 : ++mNextThreadId;
+ const int32_t id = mNextThreadId;
+ mThreads.emplace_back(std::make_unique<JavaThread>(
+ [this, id, mf = std::move(f)] { mf(id); --mActiveThreadCount; },
+ (mName + std::to_string(id)).c_str()));
+ ++mActiveThreadCount;
+ return id;
+ }
+ return 0;
+ }
+
+ // TODO: launch only if load average is low.
+ // This gets the load average
+ // See also std::thread::hardware_concurrency() for the concurrent capability.
+ static double getLoadAvg() {
+ double loadAvg[1];
+ if (getloadavg(loadAvg, std::size(loadAvg)) > 0) {
+ return loadAvg[0];
+ }
+ return -1.;
+ }
+
+private:
+ const size_t mMaxThreadCount;
+ const std::string mName;
+
+ std::atomic_size_t mActiveThreadCount = 0;
+
+ std::mutex mThreadLock;
+ bool mQuit = false; // GUARDED_BY(mThreadLock)
+ int32_t mNextThreadId = 0; // GUARDED_BY(mThreadLock)
+ std::list<std::unique_ptr<JavaThread>> mThreads; // GUARDED_BY(mThreadLock)
+};
+
+/**
+ * A Perfect HashTable for IDs (key) to pointers (value).
+ *
+ * There are no collisions. Why? because we generate the IDs for you to look up :-).
+ *
+ * The goal of this hash table is to map an integer ID handle > 0 to a pointer.
+ * We give these IDs in monotonic order (though we may skip if it were to cause a collision).
+ *
+ * The size of the hashtable must be large enough to accommodate the max number of keys.
+ * We suggest 2x.
+ *
+ * Readers are lockless
+ * Single writer could be lockless, but we allow multiple writers through an internal lock.
+ *
+ * For the Key type K, valid keys generated are > 0 (signed or unsigned)
+ * For the Value type V, values are pointers - nullptr means empty.
+ */
+template <typename K, typename V>
+class PerfectHash {
+public:
+ PerfectHash(size_t hashCapacity)
+ : mHashCapacity(hashCapacity)
+ , mK2V{new std::atomic<V>[hashCapacity]()} {
+ }
+
+ // Generate a key for a value V.
+ // There is a testing function getKforV() which checks what the value reports as its key.
+ //
+ // Calls back into getKforV under lock.
+ //
+ // We expect that the hashCapacity is 2x the number of stored keys in order
+ // to have one or two tries to find an empty slot
+ K generateKey(V value, std::function<K(V)> getKforV, K oldKey = 0) {
+ std::lock_guard lock(mHashLock);
+ // try to remove the old key.
+ if (oldKey > 0) { // key valid
+ const V v = getValue(oldKey);
+ if (v != nullptr) { // value still valid
+ const K atPosition = getKforV(v);
+ if (atPosition < 0 || // invalid value
+ atPosition == oldKey || // value's key still valid and matches old key
+ ((atPosition ^ oldKey) & (mHashCapacity - 1)) != 0) { // stale key entry
+ getValue(oldKey) = nullptr; // invalidate
+ }
+ } // else if value is invalid, no need to invalidate.
+ }
+ // check if we are invalidating only.
+ if (value == nullptr) return 0;
+ // now insert the new value and return the key.
+ size_t tries = 0;
+ for (; tries < mHashCapacity; ++tries) {
+ mNextKey = mNextKey == std::numeric_limits<K>::max() ? 1 : mNextKey + 1;
+ const V v = getValue(mNextKey);
+ //ALOGD("tries: %zu, key:%d value:%p", tries, (int)mNextKey, v);
+ if (v == nullptr) break; // empty
+ const K atPosition = getKforV(v);
+ //ALOGD("tries: %zu key atPosition:%d", tries, (int)atPosition);
+ if (atPosition < 0 || // invalid value
+ ((atPosition ^ mNextKey) & (mHashCapacity - 1)) != 0) { // stale key entry
+ break;
+ }
+ }
+ LOG_ALWAYS_FATAL_IF(tries == mHashCapacity, "hash table overflow!");
+ //ALOGD("%s: found after %zu tries", __func__, tries);
+ getValue(mNextKey) = value;
+ return mNextKey;
+ }
+
+ std::atomic<V> &getValue(K key) { return mK2V[key & (mHashCapacity - 1)]; }
+ const std::atomic_int32_t &getValue(K key) const { return mK2V[key & (mHashCapacity - 1)]; }
+
+private:
+ mutable std::mutex mHashLock;
+ const size_t mHashCapacity; // size of mK2V no lock needed.
+ std::unique_ptr<std::atomic<V>[]> mK2V; // no lock needed for read access.
+ K mNextKey{}; // GUARDED_BY(mHashLock)
+};
+
+/**
+ * StreamMap contains the all the valid streams available to SoundPool.
+ *
+ * There is no Lock required for this class because the streams are
+ * allocated in the constructor, the lookup is lockless, and the Streams
+ * returned are locked internally.
+ *
+ * The lookup uses a perfect hash.
+ * It is possible to use a lockless hash table or to use a stripe-locked concurrent
+ * hashmap for essentially lock-free lookup.
+ *
+ * This follows Map-Reduce parallelism model.
+ * https://en.wikipedia.org/wiki/MapReduce
+ *
+ * Conceivably the forEach could be parallelized using std::for_each with a
+ * std::execution::par policy.
+ *
+ * https://en.cppreference.com/w/cpp/algorithm/for_each
+ */
+class StreamMap {
+public:
+ explicit StreamMap(int32_t streams);
+
+ // Returns the stream associated with streamID or nullptr if not found.
+ // This need not be locked.
+ // The stream ID will never migrate to another Stream, but it may change
+ // underneath you. The Stream operations that take a streamID will confirm
+ // that the streamID matches under the Stream lock before executing otherwise
+ // it ignores the command as stale.
+ Stream* findStream(int32_t streamID) const;
+
+ // Iterates through the stream pool applying the function f.
+ // Since this enumerates over every single stream, it is unlocked.
+ //
+ // See related: https://en.cppreference.com/w/cpp/algorithm/for_each
+ void forEach(std::function<void(const Stream *)>f) const {
+ for (size_t i = 0; i < mStreamPoolSize; ++i) {
+ f(&mStreamPool[i]);
+ }
+ }
+
+ void forEach(std::function<void(Stream *)>f) {
+ for (size_t i = 0; i < mStreamPoolSize; ++i) {
+ f(&mStreamPool[i]);
+ }
+ }
+
+ // Returns the pair stream for a given Stream.
+ // This need not be locked as it is a property of the pointer address.
+ Stream* getPairStream(const Stream* stream) const {
+ const size_t index = streamPosition(stream);
+ return &mStreamPool[index ^ 1];
+ }
+
+ // find the position of the stream in mStreamPool array.
+ size_t streamPosition(const Stream* stream) const; // no lock needed
+
+ size_t getStreamMapSize() const {
+ return mStreamPoolSize;
+ }
+
+ // find the next valid ID for a stream and store in hash table.
+ int32_t getNextIdForStream(Stream* stream) const;
+
+private:
+
+ // use the hash table to attempt to find the stream.
+ // nullptr is returned if the lookup fails.
+ Stream* lookupStreamFromId(int32_t streamID) const;
+
+ // The stream pool is initialized in the constructor, effectively const.
+ // no locking required for access.
+ //
+ // The constructor parameter "streams" results in streams pairs of streams.
+ // We have twice as many streams because we wish to return a streamID "handle"
+ // back to the app immediately, while we may be stopping the other stream in the
+ // pair to get its AudioTrack :-).
+ //
+ // Of the stream pair, only one of the streams may have an AudioTrack.
+ // The fixed association of a stream pair allows callbacks from the AudioTrack
+ // to be associated properly to either one or the other of the stream pair.
+ //
+ // TODO: The stream pair arrangement can be removed if we have better AudioTrack
+ // callback handling (being able to remove and change the callback after construction).
+ //
+ // Streams may be accessed anytime off of the stream pool
+ // as there is internal locking on each stream.
+ std::unique_ptr<Stream[]> mStreamPool; // no lock needed for access.
+ size_t mStreamPoolSize; // no lock needed for access.
+
+ // In order to find the Stream from a StreamID, we could do a linear lookup in mStreamPool.
+ // As an alternative, one could use stripe-locked or lock-free concurrent hashtables.
+ //
+ // When considering linear search vs hashmap, verify the typical use-case size.
+ // Linear search is faster than std::unordered_map (circa 2018) for less than 40 elements.
+ // [ Skarupke, M. (2018), "You Can Do Better than std::unordered_map: New and Recent
+ // Improvements to Hash Table Performance." C++Now 2018. cppnow.org, see
+ // https://www.youtube.com/watch?v=M2fKMP47slQ ]
+ //
+ // Here, we use a PerfectHash of Id to Stream *, since we can control the
+ // StreamID returned to the user. This allows O(1) read access to mStreamPool lock-free.
+ //
+ // We prefer that the next stream ID is monotonic for aesthetic reasons
+ // (if we didn't care about monotonicity, a simple method is to apply a generation count
+ // to each stream in the unused upper bits of its index in mStreamPool for the id).
+ //
+ std::unique_ptr<PerfectHash<int32_t, Stream *>> mPerfectHash;
+};
+
+/**
+ * StreamManager is used to manage the streams (accessed by StreamID from Java).
+ *
+ * Locking order (proceeds from application to component).
+ * SoundPool mApiLock (if needed) -> StreamManager mStreamManagerLock
+ * -> pair Stream mLock -> queued Stream mLock
+ */
+class StreamManager : public StreamMap {
+public:
+ // Note: the SoundPool pointer is only used for stream initialization.
+ // It is not stored in StreamManager.
+ StreamManager(int32_t streams, size_t threads, const audio_attributes_t* attributes);
+ ~StreamManager();
+
+ // Returns positive streamID on success, 0 on failure. This is locked.
+ int32_t queueForPlay(const std::shared_ptr<Sound> &sound,
+ int32_t soundID, float leftVolume, float rightVolume,
+ int32_t priority, int32_t loop, float rate);
+
+ ///////////////////////////////////////////////////////////////////////
+ // Called from soundpool::Stream
+
+ const audio_attributes_t* getAttributes() const { return &mAttributes; }
+
+ // Moves the stream to the restart queue (called upon BUFFER_END of the static track)
+ // this is locked internally.
+ // If activeStreamIDToMatch is nonzero, it will only move to the restart queue
+ // if the streamIDToMatch is found on the active queue.
+ void moveToRestartQueue(Stream* stream, int32_t activeStreamIDToMatch = 0);
+
+private:
+
+ void run(int32_t id); // worker thread, takes lock internally.
+ void dump() const; // no lock needed
+
+ // returns true if more worker threads are needed.
+ bool needMoreThreads_l() {
+ return mRestartStreams.size() > 0 &&
+ (mThreadPool->getActiveThreadCount() == 0
+ || std::distance(mRestartStreams.begin(),
+ mRestartStreams.upper_bound(systemTime()))
+ > (ptrdiff_t)mThreadPool->getActiveThreadCount());
+ }
+
+ // returns true if the stream was added.
+ bool moveToRestartQueue_l(Stream* stream, int32_t activeStreamIDToMatch = 0);
+ // returns number of queues the stream was removed from (should be 0 or 1);
+ // a special code of -1 is returned if activeStreamIDToMatch is > 0 and
+ // the stream wasn't found on the active queue.
+ ssize_t removeFromQueues_l(Stream* stream, int32_t activeStreamIDToMatch = 0);
+ void addToRestartQueue_l(Stream *stream);
+ void addToActiveQueue_l(Stream *stream);
+ void sanityCheckQueue_l() const;
+
+ const audio_attributes_t mAttributes;
+ std::unique_ptr<ThreadPool> mThreadPool; // locked internally
+
+ // mStreamManagerLock is used to lock access for transitions between the
+ // 4 stream queues by the Manager Thread or by the user initiated play().
+ // A stream pair has exactly one stream on exactly one of the queues.
+ std::mutex mStreamManagerLock;
+ std::condition_variable mStreamManagerCondition;
+
+ bool mQuit = false; // GUARDED_BY(mStreamManagerLock)
+
+ // There are constructor arg "streams" pairs of streams, only one of each
+ // pair on the 4 stream queues below. The other stream in the pair serves as
+ // placeholder to accumulate user changes, pending actual availability of the
+ // AudioTrack, as it may be in use, requiring stop-then-restart.
+ //
+ // The 4 queues are implemented in the appropriate STL container based on perceived
+ // optimality.
+
+ // 1) mRestartStreams: Streams awaiting stop.
+ // The paired stream may be active (but with no AudioTrack), and will be restarted
+ // with an active AudioTrack when the current stream is stopped.
+ std::multimap<int64_t /* stopTimeNs */, Stream*>
+ mRestartStreams; // GUARDED_BY(mStreamManagerLock)
+
+ // 2) mActiveStreams: Streams that are active.
+ // The paired stream will be inactive.
+ // This is in order of specified by kStealActiveStream_OldestFirst
+ std::list<Stream*> mActiveStreams; // GUARDED_BY(mStreamManagerLock)
+
+ // 3) mAvailableStreams: Streams that are inactive.
+ // The paired stream will also be inactive.
+ // No particular order.
+ std::unordered_set<Stream*> mAvailableStreams; // GUARDED_BY(mStreamManagerLock)
+
+ // 4) mProcessingStreams: Streams that are being processed by the ManagerThreads
+ // When on this queue, the stream and its pair are not available for stealing.
+ // Each ManagerThread will have at most one stream on the mProcessingStreams queue.
+ // The paired stream may be active or restarting.
+ // No particular order.
+ std::unordered_set<Stream*> mProcessingStreams; // GUARDED_BY(mStreamManagerLock)
+};
+
+} // namespace android::soundpool
diff --git a/media/jni/soundpool/tests/Android.bp b/media/jni/soundpool/tests/Android.bp
new file mode 100644
index 0000000..96ec4e5
--- /dev/null
+++ b/media/jni/soundpool/tests/Android.bp
@@ -0,0 +1,28 @@
+cc_binary {
+ name: "soundpool_stress",
+ host_supported: false,
+
+ include_dirs: [
+ "frameworks/base/media/jni/"
+ ],
+
+ shared_libs: [
+ "libaudioutils",
+ "libbinder",
+ "liblog",
+ "libmedia",
+ "libsoundpool",
+ "libstagefright",
+ "libutils",
+ ],
+
+ srcs: [
+ "soundpool_stress.cpp"
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wextra",
+ ],
+}
diff --git a/media/jni/soundpool/tests/build_and_run.sh b/media/jni/soundpool/tests/build_and_run.sh
new file mode 100755
index 0000000..741f2ef
--- /dev/null
+++ b/media/jni/soundpool/tests/build_and_run.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Run samples from this directory
+#
+
+if [ -z "$ANDROID_BUILD_TOP" ]; then
+ echo "Android build environment not set"
+ exit -1
+fi
+
+# ensure we have mm
+. $ANDROID_BUILD_TOP/build/envsetup.sh
+
+mm
+
+echo "waiting for device"
+
+adb root && adb wait-for-device remount
+
+echo "========================================"
+echo "testing soundpool_stress"
+uidir="/product/media/audio/notifications"
+adb push $OUT/system/bin/soundpool_stress /system/bin
+
+# test SoundPool playback of all the UI sound samples (loaded twice) looping 10s 1 thread.
+#adb shell /system/bin/soundpool_stress -l -1 $uidir/*.ogg $uidir/*.ogg
+
+# performance test SoundPool playback of all the UI sound samples (x2)
+# 1 iterations, looping, 1 second playback, 4 threads.
+adb shell /system/bin/soundpool_stress -i 1 -l -1 -p 1 -t 4 $uidir/*.ogg $uidir/*.ogg
diff --git a/media/jni/soundpool/tests/soundpool_stress.cpp b/media/jni/soundpool/tests/soundpool_stress.cpp
new file mode 100644
index 0000000..212662f
--- /dev/null
+++ b/media/jni/soundpool/tests/soundpool_stress.cpp
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "soundpool"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
+#include <atomic>
+#include <future>
+#include <mutex>
+#include <set>
+#include <vector>
+
+#include <audio_utils/clock.h>
+#include <binder/ProcessState.h>
+#include <media/stagefright/MediaExtractorFactory.h>
+#include <soundpool/SoundPool.h> // direct include, this is not an NDK feature.
+#include <system/audio.h>
+#include <utils/Log.h>
+
+using namespace android;
+
+// Errors and diagnostic messages all go to stdout.
+
+namespace {
+
+void usage(const char *name)
+{
+ printf("Usage: %s "
+ "[-i #iterations] [-l #loop] [-p #playback_seconds] [-s #streams] [-t #threads] "
+ "[-z #snoozeSec] <input-file>+\n", name);
+ printf("Uses soundpool to load and play a file (the first 10 seconds)\n");
+ printf(" -i #iterations, default 1\n");
+ printf(" -l #loop looping mode, -1 forever\n");
+ printf(" -p #playback_seconds, default 10\n");
+ printf(" -s #streams for concurrent sound playback, default 20\n");
+ printf(" -t #threads, default 1\n");
+ printf(" -z #snoozeSec after stopping, -1 forever, default 0\n");
+ printf(" <input-file>+ files to be played\n");
+}
+
+std::atomic_int32_t gErrors{};
+std::atomic_int32_t gWarnings{};
+
+void printEvent(const SoundPoolEvent *event) {
+ printf("{ msg:%d id:%d status:%d }\n", event->mMsg, event->mArg1, event->mArg2);
+}
+
+class CallbackManager {
+public:
+ int32_t getNumberEvents(int32_t soundID) {
+ std::lock_guard lock(mLock);
+ return mEvents[soundID] > 0;
+ }
+
+ void setSoundPool(SoundPool* soundPool) {
+ std::lock_guard lock(mLock);
+ mSoundPool = soundPool;
+ }
+
+ void callback(SoundPoolEvent event, const SoundPool *soundPool) {
+ std::lock_guard lock(mLock);
+ printEvent(&event);
+ if (soundPool != mSoundPool) {
+ printf("ERROR: mismatched soundpool: %p\n", soundPool);
+ ++gErrors;
+ return;
+ }
+ if (event.mMsg != 1 /* SoundPoolEvent::SOUND_LOADED */) {
+ printf("ERROR: invalid event msg: %d\n", event.mMsg);
+ ++gErrors;
+ return;
+ }
+ if (event.mArg2 != 0) {
+ printf("ERROR: event status(%d) != 0\n", event.mArg2);
+ ++gErrors;
+ return;
+ }
+ if (event.mArg1 <= 0) {
+ printf("ERROR: event soundID(%d) < 0\n", event.mArg1);
+ ++gErrors;
+ return;
+ }
+ ++mEvents[event.mArg1];
+ }
+
+private:
+ std::mutex mLock;
+ SoundPool *mSoundPool = nullptr;
+ std::map<int32_t /* soundID */, int32_t /* count */> mEvents;
+} gCallbackManager;
+
+
+void StaticCallbackManager(SoundPoolEvent event, SoundPool* soundPool, void* user) {
+ ((CallbackManager *)user)->callback(event, soundPool);
+}
+
+void testStreams(SoundPool *soundPool, const std::vector<const char *> &filenames,
+ int loop, int playSec)
+{
+ const int64_t startTimeNs = systemTime();
+ std::vector<int32_t> soundIDs;
+ for (auto filename : filenames) {
+ struct stat st;
+ if (stat(filename, &st) < 0) {
+ printf("ERROR: cannot stat %s\n", filename);
+ return;
+ }
+ const uint64_t length = uint64_t(st.st_size);
+ const int inp = open(filename, O_RDONLY);
+ if (inp < 0) {
+ printf("ERROR: cannot open %s\n", filename);
+ return;
+ }
+ printf("loading (%s) size (%llu)\n", filename, (unsigned long long)length);
+ const int32_t soundID = soundPool->load(
+ inp, 0 /*offset*/, length, 0 /*priority - unused*/);
+ if (soundID == 0) {
+ printf("ERROR: cannot load %s\n", filename);
+ return;
+ }
+ close(inp);
+ soundIDs.emplace_back(soundID);
+ printf("loaded %s soundID(%d)\n", filename, soundID);
+ }
+ const int64_t requestLoadTimeNs = systemTime();
+ printf("\nrequestLoadTimeMs: %d\n",
+ (int)((requestLoadTimeNs - startTimeNs) / NANOS_PER_MILLISECOND));
+
+ // create stream & get Id (playing)
+ const float maxVol = 1.f;
+ const float silentVol = 0.f;
+ const int priority = 0; // lowest
+ const float rate = 1.f; // normal
+
+ // Loading is done by a SoundPool Worker thread.
+ // TODO: Use SoundPool::setCallback() for wait
+
+ for (int32_t soundID : soundIDs) {
+ while (true) {
+ const int32_t streamID =
+ soundPool->play(soundID, silentVol, silentVol, priority, 0 /*loop*/, rate);
+ if (streamID != 0) {
+ const int32_t events = gCallbackManager.getNumberEvents(soundID);
+ if (events != 1) {
+ printf("WARNING: successful play for streamID:%d soundID:%d"
+ " but callback events(%d) != 1\n", streamID, soundID, events);
+ ++gWarnings;
+ }
+ soundPool->stop(streamID);
+ break;
+ }
+ usleep(1000);
+ }
+ printf("[%d]", soundID);
+ fflush(stdout);
+ }
+
+ const int64_t loadTimeNs = systemTime();
+ printf("\nloadTimeMs: %d\n", (int)((loadTimeNs - startTimeNs) / NANOS_PER_MILLISECOND));
+
+ // check and play (overlap with above).
+ std::vector<int32_t> streamIDs;
+ for (int32_t soundID : soundIDs) {
+ printf("\nplaying soundID=%d", soundID);
+ const int32_t streamID = soundPool->play(soundID, maxVol, maxVol, priority, loop, rate);
+ if (streamID == 0) {
+ printf(" failed! ERROR");
+ ++gErrors;
+ } else {
+ printf(" streamID=%d", streamID);
+ streamIDs.emplace_back(streamID);
+ }
+ }
+ const int64_t playTimeNs = systemTime();
+ printf("\nplayTimeMs: %d\n", (int)((playTimeNs - loadTimeNs) / NANOS_PER_MILLISECOND));
+
+ for (int i = 0; i < playSec; ++i) {
+ sleep(1);
+ printf(".");
+ fflush(stdout);
+ }
+
+ for (int32_t streamID : streamIDs) {
+ soundPool->stop(streamID);
+ }
+
+ for (int32_t soundID : soundIDs) {
+ soundPool->unload(soundID);
+ }
+ printf("\nDone!\n");
+}
+
+} // namespace
+
+int main(int argc, char *argv[])
+{
+ const char * const me = argv[0];
+
+ int iterations = 1;
+ int loop = 0; // disable looping
+ int maxStreams = 40; // change to have more concurrent playback streams
+ int playSec = 10;
+ int snoozeSec = 0;
+ int threadCount = 1;
+ for (int ch; (ch = getopt(argc, argv, "i:l:p:s:t:z:")) != -1; ) {
+ switch (ch) {
+ case 'i':
+ iterations = atoi(optarg);
+ break;
+ case 'l':
+ loop = atoi(optarg);
+ break;
+ case 'p':
+ playSec = atoi(optarg);
+ break;
+ case 's':
+ maxStreams = atoi(optarg);
+ break;
+ case 't':
+ threadCount = atoi(optarg);
+ break;
+ case 'z':
+ snoozeSec = atoi(optarg);
+ break;
+ default:
+ usage(me);
+ return EXIT_FAILURE;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ if (argc <= 0) {
+ usage(me);
+ return EXIT_FAILURE;
+ }
+
+ std::vector<const char *> filenames(argv, argv + argc);
+
+ android::ProcessState::self()->startThreadPool();
+
+ // O and later requires data sniffer registration for proper file type detection
+ MediaExtractorFactory::LoadExtractors();
+
+ // create soundpool
+ audio_attributes_t aa = {
+ .content_type = AUDIO_CONTENT_TYPE_MUSIC,
+ .usage = AUDIO_USAGE_MEDIA,
+ };
+ auto soundPool = std::make_unique<SoundPool>(maxStreams, &aa);
+
+ gCallbackManager.setSoundPool(soundPool.get());
+ soundPool->setCallback(StaticCallbackManager, &gCallbackManager);
+
+ const int64_t startTimeNs = systemTime();
+
+ for (int it = 0; it < iterations; ++it) {
+ // One instance:
+ // testStreams(soundPool.get(), filenames, loop, playSec);
+
+ // Test multiple instances
+ std::vector<std::future<void>> threads(threadCount);
+ printf("testing %zu threads\n", threads.size());
+ for (auto &thread : threads) {
+ thread = std::async(std::launch::async,
+ [&]{ testStreams(soundPool.get(), filenames, loop, playSec);});
+ }
+ // automatically joins.
+ }
+
+ const int64_t endTimeNs = systemTime();
+
+ // snooze before cleaning up to examine soundpool dumpsys state after stop
+ for (int i = 0; snoozeSec < 0 || i < snoozeSec; ++i) {
+ printf("z");
+ fflush(stdout);
+ sleep(1);
+ };
+
+ gCallbackManager.setSoundPool(nullptr);
+ soundPool.reset();
+
+ printf("total time in ms: %lld\n", (endTimeNs - startTimeNs) / NANOS_PER_MILLISECOND);
+ if (gWarnings != 0) {
+ printf("%d warnings!\n", gWarnings.load());
+ }
+ if (gErrors != 0) {
+ printf("%d errors!\n", gErrors.load());
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/media/native/midi/Android.bp b/media/native/midi/Android.bp
index a0d2050..2da45b6 100644
--- a/media/native/midi/Android.bp
+++ b/media/native/midi/Android.bp
@@ -17,6 +17,7 @@
srcs: [
"amidi.cpp",
+ "MidiDeviceInfo.cpp",
":IMidiDeviceServer.aidl",
],
@@ -31,12 +32,14 @@
"-fvisibility=hidden",
],
+ header_libs: [
+ "media_ndk_headers",
+ ],
+
shared_libs: [
"liblog",
"libbinder",
"libutils",
- "libmedia",
- "libmediandk",
"libandroid_runtime",
],
diff --git a/media/native/midi/MidiDeviceInfo.cpp b/media/native/midi/MidiDeviceInfo.cpp
new file mode 100644
index 0000000..ac68d26
--- /dev/null
+++ b/media/native/midi/MidiDeviceInfo.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "MidiDeviceInfo"
+
+#include <MidiDeviceInfo.h>
+
+#include <binder/Parcel.h>
+#include <log/log.h>
+#include <utils/Errors.h>
+#include <utils/String16.h>
+
+namespace android {
+namespace media {
+namespace midi {
+
+// The constant values need to be kept in sync with MidiDeviceInfo.java.
+// static
+const char* const MidiDeviceInfo::PROPERTY_NAME = "name";
+const char* const MidiDeviceInfo::PROPERTY_MANUFACTURER = "manufacturer";
+const char* const MidiDeviceInfo::PROPERTY_PRODUCT = "product";
+const char* const MidiDeviceInfo::PROPERTY_VERSION = "version";
+const char* const MidiDeviceInfo::PROPERTY_SERIAL_NUMBER = "serial_number";
+const char* const MidiDeviceInfo::PROPERTY_ALSA_CARD = "alsa_card";
+const char* const MidiDeviceInfo::PROPERTY_ALSA_DEVICE = "alsa_device";
+
+String16 MidiDeviceInfo::getProperty(const char* propertyName) {
+ String16 value;
+ if (mProperties.getString(String16(propertyName), &value)) {
+ return value;
+ } else {
+ return String16();
+ }
+}
+
+#define RETURN_IF_FAILED(calledOnce) \
+ { \
+ status_t returnStatus = calledOnce; \
+ if (returnStatus) { \
+ ALOGE("Failed at %s:%d (%s)", __FILE__, __LINE__, __func__); \
+ return returnStatus; \
+ } \
+ }
+
+status_t MidiDeviceInfo::writeToParcel(Parcel* parcel) const {
+ // Needs to be kept in sync with code in MidiDeviceInfo.java
+ RETURN_IF_FAILED(parcel->writeInt32(mType));
+ RETURN_IF_FAILED(parcel->writeInt32(mId));
+ RETURN_IF_FAILED(parcel->writeInt32((int32_t)mInputPortNames.size()));
+ RETURN_IF_FAILED(parcel->writeInt32((int32_t)mOutputPortNames.size()));
+ RETURN_IF_FAILED(writeStringVector(parcel, mInputPortNames));
+ RETURN_IF_FAILED(writeStringVector(parcel, mOutputPortNames));
+ RETURN_IF_FAILED(parcel->writeInt32(mIsPrivate ? 1 : 0));
+ RETURN_IF_FAILED(mProperties.writeToParcel(parcel));
+ // This corresponds to "extra" properties written by Java code
+ RETURN_IF_FAILED(mProperties.writeToParcel(parcel));
+ return OK;
+}
+
+status_t MidiDeviceInfo::readFromParcel(const Parcel* parcel) {
+ // Needs to be kept in sync with code in MidiDeviceInfo.java
+ RETURN_IF_FAILED(parcel->readInt32(&mType));
+ RETURN_IF_FAILED(parcel->readInt32(&mId));
+ int32_t inputPortCount;
+ RETURN_IF_FAILED(parcel->readInt32(&inputPortCount));
+ int32_t outputPortCount;
+ RETURN_IF_FAILED(parcel->readInt32(&outputPortCount));
+ RETURN_IF_FAILED(readStringVector(parcel, &mInputPortNames, inputPortCount));
+ RETURN_IF_FAILED(readStringVector(parcel, &mOutputPortNames, outputPortCount));
+ int32_t isPrivate;
+ RETURN_IF_FAILED(parcel->readInt32(&isPrivate));
+ mIsPrivate = isPrivate == 1;
+ RETURN_IF_FAILED(mProperties.readFromParcel(parcel));
+ // Ignore "extra" properties as they may contain Java Parcelables
+ return OK;
+}
+
+status_t MidiDeviceInfo::readStringVector(
+ const Parcel* parcel, Vector<String16> *vectorPtr, size_t defaultLength) {
+ std::unique_ptr<std::vector<std::unique_ptr<String16>>> v;
+ status_t result = parcel->readString16Vector(&v);
+ if (result != OK) return result;
+ vectorPtr->clear();
+ if (v.get() != nullptr) {
+ for (const auto& iter : *v) {
+ if (iter.get() != nullptr) {
+ vectorPtr->push_back(*iter);
+ } else {
+ vectorPtr->push_back(String16());
+ }
+ }
+ } else {
+ vectorPtr->resize(defaultLength);
+ }
+ return OK;
+}
+
+status_t MidiDeviceInfo::writeStringVector(Parcel* parcel, const Vector<String16>& vector) const {
+ std::vector<String16> v;
+ for (size_t i = 0; i < vector.size(); ++i) {
+ v.push_back(vector[i]);
+ }
+ return parcel->writeString16Vector(v);
+}
+
+// Vector does not define operator==
+static inline bool areVectorsEqual(const Vector<String16>& lhs, const Vector<String16>& rhs) {
+ if (lhs.size() != rhs.size()) return false;
+ for (size_t i = 0; i < lhs.size(); ++i) {
+ if (lhs[i] != rhs[i]) return false;
+ }
+ return true;
+}
+
+bool operator==(const MidiDeviceInfo& lhs, const MidiDeviceInfo& rhs) {
+ return (lhs.mType == rhs.mType && lhs.mId == rhs.mId &&
+ areVectorsEqual(lhs.mInputPortNames, rhs.mInputPortNames) &&
+ areVectorsEqual(lhs.mOutputPortNames, rhs.mOutputPortNames) &&
+ lhs.mProperties == rhs.mProperties &&
+ lhs.mIsPrivate == rhs.mIsPrivate);
+}
+
+} // namespace midi
+} // namespace media
+} // namespace android
diff --git a/media/native/midi/MidiDeviceInfo.h b/media/native/midi/MidiDeviceInfo.h
new file mode 100644
index 0000000..5b4a241
--- /dev/null
+++ b/media/native/midi/MidiDeviceInfo.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef ANDROID_MEDIA_MIDI_DEVICE_INFO_H
+#define ANDROID_MEDIA_MIDI_DEVICE_INFO_H
+
+#include <binder/Parcelable.h>
+#include <binder/PersistableBundle.h>
+#include <utils/String16.h>
+#include <utils/Vector.h>
+
+namespace android {
+namespace media {
+namespace midi {
+
+class MidiDeviceInfo : public Parcelable {
+public:
+ MidiDeviceInfo() = default;
+ virtual ~MidiDeviceInfo() = default;
+ MidiDeviceInfo(const MidiDeviceInfo& midiDeviceInfo) = default;
+
+ status_t writeToParcel(Parcel* parcel) const override;
+ status_t readFromParcel(const Parcel* parcel) override;
+
+ int getType() const { return mType; }
+ int getUid() const { return mId; }
+ bool isPrivate() const { return mIsPrivate; }
+ const Vector<String16>& getInputPortNames() const { return mInputPortNames; }
+ const Vector<String16>& getOutputPortNames() const { return mOutputPortNames; }
+ String16 getProperty(const char* propertyName);
+
+ // The constants need to be kept in sync with MidiDeviceInfo.java
+ enum {
+ TYPE_USB = 1,
+ TYPE_VIRTUAL = 2,
+ TYPE_BLUETOOTH = 3,
+ };
+ static const char* const PROPERTY_NAME;
+ static const char* const PROPERTY_MANUFACTURER;
+ static const char* const PROPERTY_PRODUCT;
+ static const char* const PROPERTY_VERSION;
+ static const char* const PROPERTY_SERIAL_NUMBER;
+ static const char* const PROPERTY_ALSA_CARD;
+ static const char* const PROPERTY_ALSA_DEVICE;
+
+ friend bool operator==(const MidiDeviceInfo& lhs, const MidiDeviceInfo& rhs);
+ friend bool operator!=(const MidiDeviceInfo& lhs, const MidiDeviceInfo& rhs) {
+ return !(lhs == rhs);
+ }
+
+private:
+ status_t readStringVector(
+ const Parcel* parcel, Vector<String16> *vectorPtr, size_t defaultLength);
+ status_t writeStringVector(Parcel* parcel, const Vector<String16>& vector) const;
+
+ int32_t mType;
+ int32_t mId;
+ Vector<String16> mInputPortNames;
+ Vector<String16> mOutputPortNames;
+ os::PersistableBundle mProperties;
+ bool mIsPrivate;
+};
+
+} // namespace midi
+} // namespace media
+} // namespace android
+
+#endif // ANDROID_MEDIA_MIDI_DEVICE_INFO_H
diff --git a/media/native/midi/amidi.cpp b/media/native/midi/amidi.cpp
index 46f2815..35c4d42 100644
--- a/media/native/midi/amidi.cpp
+++ b/media/native/midi/amidi.cpp
@@ -26,7 +26,7 @@
#include <core_jni_helpers.h>
#include "android/media/midi/BpMidiDeviceServer.h"
-#include "media/MidiDeviceInfo.h"
+#include "MidiDeviceInfo.h"
#include "include/amidi/AMidi.h"
#include "amidi_internal.h"
diff --git a/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl b/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl
index c022388..347e4e8 100644
--- a/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl
+++ b/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl
@@ -33,9 +33,10 @@
* you do not need to call this API directly. The change will be reported for you.
*
* @param changeId The ID of the compatibility change taking effect.
+ * @param userId The ID of the user that the operation is done for.
* @param packageName The package name of the app in question.
*/
- void reportChangeByPackageName(long changeId, @utf8InCpp String packageName);
+ void reportChangeByPackageName(long changeId, @utf8InCpp String packageName, int userId);
/**
* Reports that a compatibility change is affecting an app process now.
@@ -64,9 +65,10 @@
*
* @param changeId The ID of the compatibility change in question.
* @param packageName The package name of the app in question.
+ * @param userId The ID of the user that the operation is done for.
* @return {@code true} if the change is enabled for the current app.
*/
- boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName);
+ boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName, int userId);
/**
* Query if a given compatibility change is enabled for an app process. This method should
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index 53c0122..b34b31a 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -294,7 +294,7 @@
auto& aSurfaceControlStats = aSurfaceTransactionStats.aSurfaceControlStats;
- for (const auto& [surfaceControl, acquireTime, previousReleaseFence] : surfaceControlStats) {
+ for (const auto& [surfaceControl, acquireTime, previousReleaseFence, transformHint] : surfaceControlStats) {
ASurfaceControl* aSurfaceControl = reinterpret_cast<ASurfaceControl*>(surfaceControl.get());
aSurfaceControlStats[aSurfaceControl].acquireTime = acquireTime;
aSurfaceControlStats[aSurfaceControl].previousReleaseFence = previousReleaseFence;
diff --git a/native/android/system_fonts.cpp b/native/android/system_fonts.cpp
index 9791da6..45f42f1b5 100644
--- a/native/android/system_fonts.cpp
+++ b/native/android/system_fonts.cpp
@@ -16,6 +16,8 @@
#include <jni.h>
+#define LOG_TAG "SystemFont"
+
#include <android/font.h>
#include <android/font_matcher.h>
#include <android/system_fonts.h>
@@ -47,9 +49,14 @@
using XmlCharUniquePtr = std::unique_ptr<xmlChar, XmlCharDeleter>;
using XmlDocUniquePtr = std::unique_ptr<xmlDoc, XmlDocDeleter>;
+struct ParserState {
+ xmlNode* mFontNode = nullptr;
+ XmlCharUniquePtr mLocale;
+};
+
struct ASystemFontIterator {
XmlDocUniquePtr mXmlDoc;
- xmlNode* mFontNode;
+ ParserState state;
// The OEM customization XML.
XmlDocUniquePtr mCustomizationXmlDoc;
@@ -97,6 +104,7 @@
const xmlChar* FAMILY_TAG = BAD_CAST("family");
const xmlChar* FONT_TAG = BAD_CAST("font");
+const xmlChar* LOCALE_ATTR_NAME = BAD_CAST("lang");
xmlNode* firstElement(xmlNode* node, const xmlChar* tag) {
for (xmlNode* child = node->children; child; child = child->next) {
@@ -116,9 +124,9 @@
return nullptr;
}
-void copyFont(const XmlDocUniquePtr& xmlDoc, xmlNode* fontNode, AFont* out,
+void copyFont(const XmlDocUniquePtr& xmlDoc, const ParserState& state, AFont* out,
const std::string& pathPrefix) {
- const xmlChar* LOCALE_ATTR_NAME = BAD_CAST("lang");
+ xmlNode* fontNode = state.mFontNode;
XmlCharUniquePtr filePathStr(
xmlNodeListGetString(xmlDoc.get(), fontNode->xmlChildrenNode, 1));
out->mFilePath = pathPrefix + xmlTrim(
@@ -139,9 +147,10 @@
out->mCollectionIndex = indexStr ?
strtol(reinterpret_cast<const char*>(indexStr.get()), nullptr, 10) : 0;
- XmlCharUniquePtr localeStr(xmlGetProp(xmlDoc->parent, LOCALE_ATTR_NAME));
out->mLocale.reset(
- localeStr ? new std::string(reinterpret_cast<const char*>(localeStr.get())) : nullptr);
+ state.mLocale ?
+ new std::string(reinterpret_cast<const char*>(state.mLocale.get()))
+ : nullptr);
const xmlChar* TAG_ATTR_NAME = BAD_CAST("tag");
const xmlChar* STYLEVALUE_ATTR_NAME = BAD_CAST("stylevalue");
@@ -178,25 +187,27 @@
return S_ISREG(st.st_mode);
}
-xmlNode* findFirstFontNode(const XmlDocUniquePtr& doc) {
+bool findFirstFontNode(const XmlDocUniquePtr& doc, ParserState* state) {
xmlNode* familySet = xmlDocGetRootElement(doc.get());
if (familySet == nullptr) {
- return nullptr;
+ return false;
}
xmlNode* family = firstElement(familySet, FAMILY_TAG);
if (family == nullptr) {
- return nullptr;
+ return false;
}
+ state->mLocale.reset(xmlGetProp(family, LOCALE_ATTR_NAME));
xmlNode* font = firstElement(family, FONT_TAG);
while (font == nullptr) {
family = nextSibling(family, FAMILY_TAG);
if (family == nullptr) {
- return nullptr;
+ return false;
}
font = firstElement(family, FONT_TAG);
}
- return font;
+ state->mFontNode = font;
+ return font != nullptr;
}
} // namespace
@@ -272,38 +283,38 @@
return result.release();
}
-xmlNode* findNextFontNode(const XmlDocUniquePtr& xmlDoc, xmlNode* fontNode) {
- if (fontNode == nullptr) {
+bool findNextFontNode(const XmlDocUniquePtr& xmlDoc, ParserState* state) {
+ if (state->mFontNode == nullptr) {
if (!xmlDoc) {
- return nullptr; // Already at the end.
+ return false; // Already at the end.
} else {
// First time to query font.
- return findFirstFontNode(xmlDoc);
+ return findFirstFontNode(xmlDoc, state);
}
} else {
- xmlNode* nextNode = nextSibling(fontNode, FONT_TAG);
+ xmlNode* nextNode = nextSibling(state->mFontNode, FONT_TAG);
while (nextNode == nullptr) {
- xmlNode* family = nextSibling(fontNode->parent, FAMILY_TAG);
+ xmlNode* family = nextSibling(state->mFontNode->parent, FAMILY_TAG);
if (family == nullptr) {
break;
}
+ state->mLocale.reset(xmlGetProp(family, LOCALE_ATTR_NAME));
nextNode = firstElement(family, FONT_TAG);
}
- return nextNode;
+ state->mFontNode = nextNode;
+ return nextNode != nullptr;
}
}
AFont* ASystemFontIterator_next(ASystemFontIterator* ite) {
LOG_ALWAYS_FATAL_IF(ite == nullptr, "nullptr has passed as iterator argument");
if (ite->mXmlDoc) {
- ite->mFontNode = findNextFontNode(ite->mXmlDoc, ite->mFontNode);
- if (ite->mFontNode == nullptr) {
+ if (!findNextFontNode(ite->mXmlDoc, &ite->state)) {
// Reached end of the XML file. Continue OEM customization.
ite->mXmlDoc.reset();
- ite->mFontNode = nullptr;
} else {
std::unique_ptr<AFont> font = std::make_unique<AFont>();
- copyFont(ite->mXmlDoc, ite->mFontNode, font.get(), "/system/fonts/");
+ copyFont(ite->mXmlDoc, ite->state, font.get(), "/system/fonts/");
if (!isFontFileAvailable(font->mFilePath)) {
return ASystemFontIterator_next(ite);
}
@@ -312,15 +323,13 @@
}
if (ite->mCustomizationXmlDoc) {
// TODO: Filter only customizationType="new-named-family"
- ite->mFontNode = findNextFontNode(ite->mCustomizationXmlDoc, ite->mFontNode);
- if (ite->mFontNode == nullptr) {
+ if (!findNextFontNode(ite->mCustomizationXmlDoc, &ite->state)) {
// Reached end of the XML file. Finishing
ite->mCustomizationXmlDoc.reset();
- ite->mFontNode = nullptr;
return nullptr;
} else {
std::unique_ptr<AFont> font = std::make_unique<AFont>();
- copyFont(ite->mCustomizationXmlDoc, ite->mFontNode, font.get(), "/product/fonts/");
+ copyFont(ite->mCustomizationXmlDoc, ite->state, font.get(), "/product/fonts/");
if (!isFontFileAvailable(font->mFilePath)) {
return ASystemFontIterator_next(ite);
}
@@ -351,7 +360,7 @@
const char* AFont_getLocale(const AFont* font) {
LOG_ALWAYS_FATAL_IF(font == nullptr, "nullptr has passed to font argument");
- return font->mLocale ? nullptr : font->mLocale->c_str();
+ return font->mLocale ? font->mLocale->c_str() : nullptr;
}
size_t AFont_getCollectionIndex(const AFont* font) {
diff --git a/packages/CarSystemUI/Android.bp b/packages/CarSystemUI/Android.bp
index 672879a..b2451c9 100644
--- a/packages/CarSystemUI/Android.bp
+++ b/packages/CarSystemUI/Android.bp
@@ -63,6 +63,64 @@
}
+android_library {
+ name: "CarSystemUI-tests",
+ manifest: "tests/AndroidManifest.xml",
+ resource_dirs: [
+ "tests/res",
+ "res-keyguard",
+ "res",
+ ],
+ srcs: [
+ "tests/src/**/*.java",
+ "src/**/*.java",
+ "src/**/I*.aidl",
+ ],
+ static_libs: [
+ "SystemUI-tests",
+ "CarNotificationLib",
+ "SystemUIPluginLib",
+ "SystemUISharedLib",
+ "SettingsLib",
+ "android.car.userlib",
+ "androidx.legacy_legacy-support-v4",
+ "androidx.recyclerview_recyclerview",
+ "androidx.preference_preference",
+ "androidx.appcompat_appcompat",
+ "androidx.mediarouter_mediarouter",
+ "androidx.palette_palette",
+ "androidx.legacy_legacy-preference-v14",
+ "androidx.leanback_leanback",
+ "androidx.slice_slice-core",
+ "androidx.slice_slice-view",
+ "androidx.slice_slice-builders",
+ "androidx.arch.core_core-runtime",
+ "androidx.lifecycle_lifecycle-extensions",
+ "SystemUI-tags",
+ "SystemUI-proto",
+ "metrics-helper-lib",
+ "androidx.test.rules", "hamcrest-library",
+ "mockito-target-inline-minus-junit4",
+ "testables",
+ "truth-prebuilt",
+ "dagger2-2.19",
+ "//external/kotlinc:kotlin-annotations",
+ ],
+ libs: [
+ "android.test.runner",
+ "telephony-common",
+ "android.test.base",
+ "android.car",
+ ],
+
+ aaptflags: [
+ "--extra-packages",
+ "com.android.systemui",
+ ],
+
+ plugins: ["dagger2-compiler-2.19"],
+}
+
android_app {
name: "CarSystemUI",
diff --git a/packages/CarSystemUI/res/layout/car_navigation_bar_unprovisioned.xml b/packages/CarSystemUI/res/layout/car_navigation_bar_unprovisioned.xml
index 1cf48c5..0f964fd 100644
--- a/packages/CarSystemUI/res/layout/car_navigation_bar_unprovisioned.xml
+++ b/packages/CarSystemUI/res/layout/car_navigation_bar_unprovisioned.xml
@@ -31,14 +31,15 @@
android:paddingStart="@*android:dimen/car_padding_5"
android:paddingEnd="@*android:dimen/car_padding_5">
- <com.android.systemui.navigationbar.car.CarNavigationButton
+ <com.android.systemui.navigationbar.car.CarFacetButton
android:id="@+id/home"
android:layout_width="@*android:dimen/car_touch_target_size"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
- android:src="@drawable/car_ic_overview"
+ systemui:icon="@drawable/car_ic_overview"
systemui:intent="intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.HOME;launchFlags=0x14000000;end"
- />
+ systemui:selectedIcon="@drawable/car_ic_overview_selected"
+ systemui:useMoreIcon="false"/>
</LinearLayout>
</com.android.systemui.navigationbar.car.CarNavigationBarView>
diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml
index fe042fe..329225c 100644
--- a/packages/CarSystemUI/res/values/config.xml
+++ b/packages/CarSystemUI/res/values/config.xml
@@ -40,6 +40,21 @@
slots that may be reused for things like IME control. -->
<integer name="config_maxNotificationIcons">0</integer>
+ <!--
+ Initial alpha percent value for the background when the notification
+ shade is open. Should be a number between, and inclusive, 0 and 100.
+ If the number is 0, then the background alpha starts off fully
+ transparent. If the number if 100, then the background alpha starts off
+ fully opaque. -->
+ <integer name="config_initialNotificationBackgroundAlpha">0</integer>
+ <!--
+ Final alpha percent value for the background when the notification
+ shade is fully open. Should be a number between, and inclusive, 0 and
+ 100. If this value is smaller than
+ config_initialNotificationBackgroundAlpha, the background will default
+ to a constant alpha percent value using the initial alpha. -->
+ <integer name="config_finalNotificationBackgroundAlpha">100</integer>
+
<!-- SystemUI Services: The classes of the stuff to start. -->
<string-array name="config_systemUIServiceComponents" translatable="false">
<item>com.android.systemui.util.NotificationChannels</item>
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java
index 011d5ea..be4b889 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java
@@ -20,6 +20,7 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.ViewMediatorCallback;
+import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.navigationbar.car.CarFacetButtonController;
import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index b1067f8..93e553f 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -23,6 +23,7 @@
import com.android.systemui.car.CarNotificationEntryManager;
import com.android.systemui.car.CarNotificationInterruptionStateProvider;
+import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.power.EnhancedEstimates;
@@ -101,6 +102,9 @@
CarSystemUIRootComponent systemUIRootComponent);
@Binds
+ public abstract StatusBar bindStatusBar(CarStatusBar statusBar);
+
+ @Binds
@IntoMap
@ClassKey(StatusBar.class)
public abstract SystemUI providesStatusBar(CarStatusBar statusBar);
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java
index 325c988..c2847c8 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java
@@ -16,6 +16,12 @@
package com.android.systemui;
+import com.android.systemui.dagger.DependencyBinder;
+import com.android.systemui.dagger.DependencyProvider;
+import com.android.systemui.dagger.SystemServicesModule;
+import com.android.systemui.dagger.SystemUIModule;
+import com.android.systemui.dagger.SystemUIRootComponent;
+
import javax.inject.Singleton;
import dagger.Component;
@@ -26,6 +32,7 @@
DependencyProvider.class,
DependencyBinder.class,
SystemUIFactory.ContextHolder.class,
+ SystemServicesModule.class,
SystemUIModule.class,
CarSystemUIModule.class,
CarSystemUIBinder.class
diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java
index 5bb3530..98b91ebd 100644
--- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java
@@ -16,8 +16,6 @@
package com.android.systemui.navigationbar.car;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.content.Context;
import android.graphics.PixelFormat;
import android.inputmethodservice.InputMethodService;
@@ -35,11 +33,10 @@
import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NavigationBarController;
-import com.android.systemui.statusbar.car.hvac.HvacController;
-import com.android.systemui.statusbar.car.hvac.TemperatureView;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -47,22 +44,19 @@
import java.io.PrintWriter;
import javax.inject.Inject;
-import javax.inject.Named;
import dagger.Lazy;
/** Navigation bars customized for the automotive use case. */
public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks {
- private final NavigationBarViewFactory mNavigationBarViewFactory;
+ private final CarNavigationBarController mCarNavigationBarController;
private final WindowManager mWindowManager;
private final DeviceProvisionedController mDeviceProvisionedController;
private final Lazy<FacetButtonTaskStackListener> mFacetButtonTaskStackListener;
private final Handler mMainHandler;
private final Lazy<KeyguardStateController> mKeyguardStateController;
- private final Lazy<CarFacetButtonController> mFacetButtonController;
private final Lazy<NavigationBarController> mNavigationBarController;
- private final Lazy<HvacController> mHvacController;
private IStatusBarService mBarService;
private CommandQueue mCommandQueue;
@@ -84,33 +78,23 @@
// it's open.
private boolean mDeviceIsSetUpForUser = true;
- // Configuration values for if nav bars should be shown.
- private boolean mShowBottom;
- private boolean mShowLeft;
- private boolean mShowRight;
-
-
@Inject
public CarNavigationBar(Context context,
- NavigationBarViewFactory navigationBarViewFactory,
+ CarNavigationBarController carNavigationBarController,
WindowManager windowManager,
DeviceProvisionedController deviceProvisionedController,
Lazy<FacetButtonTaskStackListener> facetButtonTaskStackListener,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler,
+ @MainHandler Handler mainHandler,
Lazy<KeyguardStateController> keyguardStateController,
- Lazy<CarFacetButtonController> facetButtonController,
- Lazy<NavigationBarController> navigationBarController,
- Lazy<HvacController> hvacController) {
+ Lazy<NavigationBarController> navigationBarController) {
super(context);
- mNavigationBarViewFactory = navigationBarViewFactory;
+ mCarNavigationBarController = carNavigationBarController;
mWindowManager = windowManager;
mDeviceProvisionedController = deviceProvisionedController;
mFacetButtonTaskStackListener = facetButtonTaskStackListener;
mMainHandler = mainHandler;
mKeyguardStateController = keyguardStateController;
- mFacetButtonController = facetButtonController;
mNavigationBarController = navigationBarController;
- mHvacController = hvacController;
}
@Override
@@ -120,11 +104,6 @@
com.android.internal.R.bool.config_automotiveHideNavBarForKeyboard);
mBottomNavBarVisible = false;
- // Read configuration.
- mShowBottom = mContext.getResources().getBoolean(R.bool.config_enableBottomNavigationBar);
- mShowLeft = mContext.getResources().getBoolean(R.bool.config_enableLeftNavigationBar);
- mShowRight = mContext.getResources().getBoolean(R.bool.config_enableRightNavigationBar);
-
// Get bar service.
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
@@ -159,7 +138,7 @@
mActivityManagerWrapper = ActivityManagerWrapper.getInstance();
mActivityManagerWrapper.registerTaskStackListener(mFacetButtonTaskStackListener.get());
- mHvacController.get().connectToCarService();
+ mCarNavigationBarController.connectToHvac();
}
private void restartNavBarsIfNecessary() {
@@ -177,8 +156,7 @@
private void restartNavBars() {
// remove and reattach all hvac components such that we don't keep a reference to unused
// ui elements
- mHvacController.get().removeAllComponents();
- mFacetButtonController.get().removeAll();
+ mCarNavigationBarController.removeAllFromHvac();
if (mNavigationBarWindow != null) {
mNavigationBarWindow.removeAllViews();
@@ -201,10 +179,6 @@
if (mKeyguardStateController.get().isShowing()) {
updateNavBarForKeyguardContent();
}
-
- // CarFacetButtonController was reset therefore we need to re-add the status bar elements
- // to the controller.
- // TODO(hseog): Add facet buttons in status bar to controller.
}
private void createNavigationBar(RegisterStatusBarResult result) {
@@ -226,54 +200,30 @@
}
private void buildNavBarWindows() {
- if (mShowBottom) {
- mNavigationBarWindow = mNavigationBarViewFactory.getBottomWindow();
- }
-
- if (mShowLeft) {
- mLeftNavigationBarWindow = mNavigationBarViewFactory.getLeftWindow();
- }
-
- if (mShowRight) {
- mRightNavigationBarWindow = mNavigationBarViewFactory.getRightWindow();
- }
+ mNavigationBarWindow = mCarNavigationBarController.getBottomWindow();
+ mLeftNavigationBarWindow = mCarNavigationBarController.getLeftWindow();
+ mRightNavigationBarWindow = mCarNavigationBarController.getRightWindow();
}
private void buildNavBarContent() {
- if (mShowBottom) {
- mNavigationBarView = mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser);
+ mNavigationBarView = mCarNavigationBarController.getBottomBar(mDeviceIsSetUpForUser);
+ if (mNavigationBarView != null) {
mNavigationBarWindow.addView(mNavigationBarView);
- addTemperatureViewToController(mNavigationBarView);
}
- if (mShowLeft) {
- mLeftNavigationBarView = mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser);
+ mLeftNavigationBarView = mCarNavigationBarController.getLeftBar(mDeviceIsSetUpForUser);
+ if (mLeftNavigationBarView != null) {
mLeftNavigationBarWindow.addView(mLeftNavigationBarView);
- addTemperatureViewToController(mLeftNavigationBarView);
}
- if (mShowRight) {
- mRightNavigationBarView = mNavigationBarViewFactory.getRightBar(mDeviceIsSetUpForUser);
+ mRightNavigationBarView = mCarNavigationBarController.getRightBar(mDeviceIsSetUpForUser);
+ if (mRightNavigationBarView != null) {
mRightNavigationBarWindow.addView(mRightNavigationBarView);
- // Add ability to toggle notification center.
- addTemperatureViewToController(mRightNavigationBarView);
- // Add ability to close notification center on touch.
- }
- }
-
- private void addTemperatureViewToController(View v) {
- if (v instanceof TemperatureView) {
- mHvacController.get().addHvacTextView((TemperatureView) v);
- } else if (v instanceof ViewGroup) {
- ViewGroup viewGroup = (ViewGroup) v;
- for (int i = 0; i < viewGroup.getChildCount(); i++) {
- addTemperatureViewToController(viewGroup.getChildAt(i));
- }
}
}
private void attachNavBarWindows() {
- if (mShowBottom && !mBottomNavBarVisible) {
+ if (mNavigationBarWindow != null && !mBottomNavBarVisible) {
mBottomNavBarVisible = true;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@@ -289,7 +239,7 @@
mWindowManager.addView(mNavigationBarWindow, lp);
}
- if (mShowLeft) {
+ if (mLeftNavigationBarWindow != null) {
int width = mContext.getResources().getDimensionPixelSize(
R.dimen.car_left_navigation_bar_width);
WindowManager.LayoutParams leftlp = new WindowManager.LayoutParams(
@@ -306,7 +256,7 @@
leftlp.gravity = Gravity.LEFT;
mWindowManager.addView(mLeftNavigationBarWindow, leftlp);
}
- if (mShowRight) {
+ if (mRightNavigationBarWindow != null) {
int width = mContext.getResources().getDimensionPixelSize(
R.dimen.car_right_navigation_bar_width);
WindowManager.LayoutParams rightlp = new WindowManager.LayoutParams(
@@ -342,23 +292,8 @@
}
boolean isKeyboardVisible = (vis & InputMethodService.IME_VISIBLE) != 0;
- showBottomNavBarWindow(isKeyboardVisible);
- }
-
- private void showBottomNavBarWindow(boolean isKeyboardVisible) {
- if (!mShowBottom) {
- return;
- }
-
- // If keyboard is visible and bottom nav bar not visible, this is the correct state, so do
- // nothing. Same with if keyboard is not visible and bottom nav bar is visible.
- if (isKeyboardVisible ^ mBottomNavBarVisible) {
- return;
- }
-
- mNavigationBarViewFactory.getBottomWindow().setVisibility(
+ mCarNavigationBarController.setBottomWindowVisibility(
isKeyboardVisible ? View.GONE : View.VISIBLE);
- mBottomNavBarVisible = !isKeyboardVisible;
}
private void updateNavBarForKeyguardContent() {
diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarController.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarController.java
new file mode 100644
index 0000000..6bed69b
--- /dev/null
+++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarController.java
@@ -0,0 +1,310 @@
+/*
+ * 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.systemui.navigationbar.car;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.android.systemui.R;
+import com.android.systemui.statusbar.car.hvac.HvacController;
+import com.android.systemui.statusbar.car.hvac.TemperatureView;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import dagger.Lazy;
+
+/** A single class which controls the navigation bar views. */
+@Singleton
+public class CarNavigationBarController {
+
+ private final Context mContext;
+ private final NavigationBarViewFactory mNavigationBarViewFactory;
+ private final Lazy<HvacController> mHvacControllerLazy;
+
+ private boolean mShowBottom;
+ private boolean mShowLeft;
+ private boolean mShowRight;
+
+ private View.OnTouchListener mTopBarTouchListener;
+ private View.OnTouchListener mBottomBarTouchListener;
+ private View.OnTouchListener mLeftBarTouchListener;
+ private View.OnTouchListener mRightBarTouchListener;
+ private NotificationsShadeController mNotificationsShadeController;
+
+ private CarNavigationBarView mTopView;
+ private CarNavigationBarView mBottomView;
+ private CarNavigationBarView mLeftView;
+ private CarNavigationBarView mRightView;
+
+ @Inject
+ public CarNavigationBarController(Context context,
+ NavigationBarViewFactory navigationBarViewFactory,
+ Lazy<HvacController> hvacControllerLazy) {
+ mContext = context;
+ mNavigationBarViewFactory = navigationBarViewFactory;
+ mHvacControllerLazy = hvacControllerLazy;
+
+ // Read configuration.
+ mShowBottom = mContext.getResources().getBoolean(R.bool.config_enableBottomNavigationBar);
+ mShowLeft = mContext.getResources().getBoolean(R.bool.config_enableLeftNavigationBar);
+ mShowRight = mContext.getResources().getBoolean(R.bool.config_enableRightNavigationBar);
+ }
+
+ /** Connect to hvac service. */
+ public void connectToHvac() {
+ mHvacControllerLazy.get().connectToCarService();
+ }
+
+ /** Clean up hvac. */
+ public void removeAllFromHvac() {
+ mHvacControllerLazy.get().removeAllComponents();
+ }
+
+ /** Gets the bottom window if configured to do so. */
+ @Nullable
+ public ViewGroup getBottomWindow() {
+ return mShowBottom ? mNavigationBarViewFactory.getBottomWindow() : null;
+ }
+
+ /** Gets the left window if configured to do so. */
+ @Nullable
+ public ViewGroup getLeftWindow() {
+ return mShowLeft ? mNavigationBarViewFactory.getLeftWindow() : null;
+ }
+
+ /** Gets the right window if configured to do so. */
+ @Nullable
+ public ViewGroup getRightWindow() {
+ return mShowRight ? mNavigationBarViewFactory.getRightWindow() : null;
+ }
+
+ /** Toggles the bottom nav bar visibility. */
+ public boolean setBottomWindowVisibility(@View.Visibility int visibility) {
+ return setWindowVisibility(getBottomWindow(), visibility);
+ }
+
+ /** Toggles the left nav bar visibility. */
+ public boolean setLeftWindowVisibility(@View.Visibility int visibility) {
+ return setWindowVisibility(getLeftWindow(), visibility);
+ }
+
+ /** Toggles the right nav bar visibility. */
+ public boolean setRightWindowVisibility(@View.Visibility int visibility) {
+ return setWindowVisibility(getRightWindow(), visibility);
+ }
+
+ private boolean setWindowVisibility(ViewGroup window, @View.Visibility int visibility) {
+ if (window == null) {
+ return false;
+ }
+
+ if (window.getVisibility() == visibility) {
+ return false;
+ }
+
+ window.setVisibility(visibility);
+ return true;
+ }
+
+ /** Gets the top navigation bar with the appropriate listeners set. */
+ @NonNull
+ public CarNavigationBarView getTopBar(boolean isSetUp) {
+ mTopView = mNavigationBarViewFactory.getTopBar(isSetUp);
+ mTopView.setStatusBarWindowTouchListener(mTopBarTouchListener);
+ mTopView.setNotificationsPanelController(mNotificationsShadeController);
+ addTemperatureViewToController(mTopView);
+ return mTopView;
+ }
+
+ /** Gets the bottom navigation bar with the appropriate listeners set. */
+ @Nullable
+ public CarNavigationBarView getBottomBar(boolean isSetUp) {
+ if (!mShowBottom) {
+ return null;
+ }
+
+ mBottomView = mNavigationBarViewFactory.getBottomBar(isSetUp);
+ mBottomView.setStatusBarWindowTouchListener(mBottomBarTouchListener);
+ mBottomView.setNotificationsPanelController(mNotificationsShadeController);
+ addTemperatureViewToController(mBottomView);
+ return mBottomView;
+ }
+
+ /** Gets the left navigation bar with the appropriate listeners set. */
+ @Nullable
+ public CarNavigationBarView getLeftBar(boolean isSetUp) {
+ if (!mShowLeft) {
+ return null;
+ }
+
+ mLeftView = mNavigationBarViewFactory.getLeftBar(isSetUp);
+ mLeftView.setStatusBarWindowTouchListener(mLeftBarTouchListener);
+ mLeftView.setNotificationsPanelController(mNotificationsShadeController);
+ addTemperatureViewToController(mLeftView);
+ return mLeftView;
+ }
+
+ /** Gets the right navigation bar with the appropriate listeners set. */
+ @Nullable
+ public CarNavigationBarView getRightBar(boolean isSetUp) {
+ if (!mShowRight) {
+ return null;
+ }
+
+ mRightView = mNavigationBarViewFactory.getRightBar(isSetUp);
+ mRightView.setStatusBarWindowTouchListener(mRightBarTouchListener);
+ mRightView.setNotificationsPanelController(mNotificationsShadeController);
+ addTemperatureViewToController(mRightView);
+ return mRightView;
+ }
+
+ /** Sets a touch listener for the top navigation bar. */
+ public void registerTopBarTouchListener(View.OnTouchListener listener) {
+ mTopBarTouchListener = listener;
+ if (mTopView != null) {
+ mTopView.setStatusBarWindowTouchListener(mTopBarTouchListener);
+ }
+ }
+
+ /** Sets a touch listener for the bottom navigation bar. */
+ public void registerBottomBarTouchListener(View.OnTouchListener listener) {
+ mBottomBarTouchListener = listener;
+ if (mBottomView != null) {
+ mBottomView.setStatusBarWindowTouchListener(mBottomBarTouchListener);
+ }
+ }
+
+ /** Sets a touch listener for the left navigation bar. */
+ public void registerLeftBarTouchListener(View.OnTouchListener listener) {
+ mLeftBarTouchListener = listener;
+ if (mLeftView != null) {
+ mLeftView.setStatusBarWindowTouchListener(mLeftBarTouchListener);
+ }
+ }
+
+ /** Sets a touch listener for the right navigation bar. */
+ public void registerRightBarTouchListener(View.OnTouchListener listener) {
+ mRightBarTouchListener = listener;
+ if (mRightView != null) {
+ mRightView.setStatusBarWindowTouchListener(mRightBarTouchListener);
+ }
+ }
+
+ /** Sets a notification controller which toggles the notification panel. */
+ public void registerNotificationController(
+ NotificationsShadeController notificationsShadeController) {
+ mNotificationsShadeController = notificationsShadeController;
+ if (mTopView != null) {
+ mTopView.setNotificationsPanelController(mNotificationsShadeController);
+ }
+ if (mBottomView != null) {
+ mBottomView.setNotificationsPanelController(mNotificationsShadeController);
+ }
+ if (mLeftView != null) {
+ mLeftView.setNotificationsPanelController(mNotificationsShadeController);
+ }
+ if (mRightView != null) {
+ mRightView.setNotificationsPanelController(mNotificationsShadeController);
+ }
+ }
+
+ /**
+ * Shows all of the keyguard specific buttons on the valid instances of
+ * {@link CarNavigationBarView}.
+ */
+ public void showAllKeyguardButtons(boolean isSetUp) {
+ checkAllBars(isSetUp);
+ if (mTopView != null) {
+ mTopView.showKeyguardButtons();
+ }
+ if (mBottomView != null) {
+ mBottomView.showKeyguardButtons();
+ }
+ if (mLeftView != null) {
+ mLeftView.showKeyguardButtons();
+ }
+ if (mRightView != null) {
+ mRightView.showKeyguardButtons();
+ }
+ }
+
+ /**
+ * Hides all of the keyguard specific buttons on the valid instances of
+ * {@link CarNavigationBarView}.
+ */
+ public void hideAllKeyguardButtons(boolean isSetUp) {
+ checkAllBars(isSetUp);
+ if (mTopView != null) {
+ mTopView.hideKeyguardButtons();
+ }
+ if (mBottomView != null) {
+ mBottomView.hideKeyguardButtons();
+ }
+ if (mLeftView != null) {
+ mLeftView.hideKeyguardButtons();
+ }
+ if (mRightView != null) {
+ mRightView.hideKeyguardButtons();
+ }
+ }
+
+ /** Toggles whether the notifications icon has an unseen indicator or not. */
+ public void toggleAllNotificationsUnseenIndicator(boolean isSetUp, boolean hasUnseen) {
+ checkAllBars(isSetUp);
+ if (mTopView != null) {
+ mTopView.toggleNotificationUnseenIndicator(hasUnseen);
+ }
+ if (mBottomView != null) {
+ mBottomView.toggleNotificationUnseenIndicator(hasUnseen);
+ }
+ if (mLeftView != null) {
+ mLeftView.toggleNotificationUnseenIndicator(hasUnseen);
+ }
+ if (mRightView != null) {
+ mRightView.toggleNotificationUnseenIndicator(hasUnseen);
+ }
+ }
+
+ /** Interface for controlling the notifications shade. */
+ public interface NotificationsShadeController {
+ /** Toggles the visibility of the notifications shade. */
+ void togglePanel();
+ }
+
+ private void addTemperatureViewToController(View v) {
+ if (v instanceof TemperatureView) {
+ mHvacControllerLazy.get().addHvacTextView((TemperatureView) v);
+ } else if (v instanceof ViewGroup) {
+ ViewGroup viewGroup = (ViewGroup) v;
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ addTemperatureViewToController(viewGroup.getChildAt(i));
+ }
+ }
+ }
+
+ private void checkAllBars(boolean isSetUp) {
+ mTopView = getTopBar(isSetUp);
+ mBottomView = getBottomBar(isSetUp);
+ mLeftView = getLeftBar(isSetUp);
+ mRightView = getRightBar(isSetUp);
+ }
+}
diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarView.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarView.java
index afb6954..c245508 100644
--- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarView.java
+++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBarView.java
@@ -24,7 +24,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.statusbar.car.CarStatusBar;
+import com.android.systemui.navigationbar.car.CarNavigationBarController.NotificationsShadeController;
import com.android.systemui.statusbar.phone.StatusBarIconController;
/**
@@ -36,7 +36,7 @@
public class CarNavigationBarView extends LinearLayout {
private View mNavButtons;
private CarNavigationButton mNotificationsButton;
- private CarStatusBar mCarStatusBar;
+ private NotificationsShadeController mNotificationsShadeController;
private Context mContext;
private View mLockScreenButtons;
// used to wire in open/close gestures for notifications
@@ -82,12 +82,18 @@
return super.onInterceptTouchEvent(ev);
}
- public void setStatusBar(CarStatusBar carStatusBar) {
- mCarStatusBar = carStatusBar;
+ /** Sets the notifications panel controller. */
+ public void setNotificationsPanelController(NotificationsShadeController controller) {
+ mNotificationsShadeController = controller;
+ }
+
+ /** Gets the notifications panel controller. */
+ public NotificationsShadeController getNotificationsPanelController() {
+ return mNotificationsShadeController;
}
/**
- * Set a touch listener that will be called from onInterceptTouchEvent and onTouchEvent
+ * Sets a touch listener that will be called from onInterceptTouchEvent and onTouchEvent
*
* @param statusBarWindowTouchListener The listener to call from touch and intercept touch
*/
@@ -95,6 +101,11 @@
mStatusBarWindowTouchListener = statusBarWindowTouchListener;
}
+ /** Gets the touch listener that will be called from onInterceptTouchEvent and onTouchEvent. */
+ public OnTouchListener getStatusBarWindowTouchListener() {
+ return mStatusBarWindowTouchListener;
+ }
+
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mStatusBarWindowTouchListener != null) {
@@ -104,7 +115,9 @@
}
protected void onNotificationsClick(View v) {
- mCarStatusBar.togglePanel();
+ if (mNotificationsShadeController != null) {
+ mNotificationsShadeController.togglePanel();
+ }
}
/**
diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationButton.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationButton.java
index 707d80f..922bfff 100644
--- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationButton.java
+++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationButton.java
@@ -85,6 +85,7 @@
super.onFinishInflate();
setScaleType(ImageView.ScaleType.CENTER);
setAlpha(mUnselectedAlpha);
+ setImageResource(mIconResourceId);
try {
if (mIntent != null) {
final Intent intent = Intent.parseUri(mIntent, Intent.URI_INTENT_SCHEME);
@@ -149,6 +150,11 @@
updateImage();
}
+ /** Gets whether the icon is in an unseen state. */
+ public boolean getUnseen() {
+ return mHasUnseen;
+ }
+
private void updateImage() {
if (mHasUnseen) {
setImageResource(mSelected ? UNSEEN_SELECTED_ICON_RESOURCE_ID
diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/NavigationBarViewFactory.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/NavigationBarViewFactory.java
index 128721e..519b33a2 100644
--- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/NavigationBarViewFactory.java
+++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/NavigationBarViewFactory.java
@@ -108,7 +108,7 @@
private ViewGroup getWindowCached(Type type) {
if (mCachedContainerMap.containsKey(type)) {
- return mCachedViewMap.get(type);
+ return mCachedContainerMap.get(type);
}
ViewGroup window = (ViewGroup) View.inflate(mContext,
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 3424eea..ce763b9 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -32,6 +32,7 @@
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.PowerManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector;
@@ -75,8 +76,8 @@
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.navigationbar.car.CarFacetButtonController;
+import com.android.systemui.navigationbar.car.CarNavigationBarController;
import com.android.systemui.navigationbar.car.CarNavigationBarView;
-import com.android.systemui.navigationbar.car.NavigationBarViewFactory;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.qs.car.CarQSFragment;
@@ -92,8 +93,6 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
-import com.android.systemui.statusbar.car.hvac.HvacController;
-import com.android.systemui.statusbar.car.hvac.TemperatureView;
import com.android.systemui.statusbar.notification.BypassHeadsUpNotifier;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NewNotifPipeline;
@@ -106,8 +105,11 @@
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.AutoHideController;
+import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.CollapsedStatusBarFragment;
import com.android.systemui.statusbar.phone.DozeParameters;
+import com.android.systemui.statusbar.phone.DozeScrimController;
+import com.android.systemui.statusbar.phone.DozeServiceHost;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LightBarController;
@@ -135,12 +137,14 @@
import javax.inject.Inject;
import javax.inject.Named;
+import javax.inject.Singleton;
import dagger.Lazy;
/**
* A status bar tailored for the automotive use case.
*/
+@Singleton
public class CarStatusBar extends StatusBar implements CarBatteryController.BatteryViewHandler {
private static final String TAG = "CarStatusBar";
// used to calculate how fast to open or close the window
@@ -154,6 +158,9 @@
private float mOpeningVelocity = DEFAULT_FLING_VELOCITY;
private float mClosingVelocity = DEFAULT_FLING_VELOCITY;
+ private float mBackgroundAlphaDiff;
+ private float mInitialBackgroundAlpha;
+
private FullscreenUserSwitcher mFullscreenUserSwitcher;
private CarBatteryController mCarBatteryController;
@@ -164,11 +171,10 @@
private CarNavigationBarView mTopNavigationBarView;
private final Object mQueueLock = new Object();
- private final NavigationBarViewFactory mNavigationBarViewFactory;
+ private final CarNavigationBarController mCarNavigationBarController;
private CarFacetButtonController mCarFacetButtonController;
private DeviceProvisionedController mDeviceProvisionedController;
private boolean mDeviceIsSetUpForUser = true;
- private HvacController mHvacController;
private DrivingStateHelper mDrivingStateHelper;
private PowerManagerHelper mPowerManagerHelper;
private FlingAnimationUtils mFlingAnimationUtils;
@@ -290,9 +296,13 @@
DozeParameters dozeParameters,
ScrimController scrimController,
Lazy<LockscreenWallpaper> lockscreenWallpaperLazy,
+ Lazy<BiometricUnlockController> biometricUnlockControllerLazy,
+ DozeServiceHost dozeServiceHost,
+ PowerManager powerManager,
+ DozeScrimController dozeScrimController,
/* Car Settings injected components. */
- NavigationBarViewFactory navigationBarViewFactory) {
+ CarNavigationBarController carNavigationBarController) {
super(
context,
featureFlags,
@@ -352,9 +362,13 @@
notifLog,
dozeParameters,
scrimController,
- lockscreenWallpaperLazy);
+ lockscreenWallpaperLazy,
+ biometricUnlockControllerLazy,
+ dozeServiceHost,
+ powerManager,
+ dozeScrimController);
mScrimController = scrimController;
- mNavigationBarViewFactory = navigationBarViewFactory;
+ mCarNavigationBarController = carNavigationBarController;
}
@Override
@@ -369,9 +383,24 @@
mScreenLifecycle = Dependency.get(ScreenLifecycle.class);
mScreenLifecycle.addObserver(mScreenObserver);
- // Need to initialize HVAC controller before calling super.start - before system bars are
- // created.
- mHvacController = new HvacController(mContext);
+ // Notification bar related setup.
+ mInitialBackgroundAlpha = (float) mContext.getResources().getInteger(
+ R.integer.config_initialNotificationBackgroundAlpha) / 100;
+ if (mInitialBackgroundAlpha < 0 || mInitialBackgroundAlpha > 100) {
+ throw new RuntimeException(
+ "Unable to setup notification bar due to incorrect initial background alpha"
+ + " percentage");
+ }
+ float finalBackgroundAlpha = Math.max(
+ mInitialBackgroundAlpha,
+ (float) mContext.getResources().getInteger(
+ R.integer.config_finalNotificationBackgroundAlpha) / 100);
+ if (finalBackgroundAlpha < 0 || finalBackgroundAlpha > 100) {
+ throw new RuntimeException(
+ "Unable to setup notification bar due to incorrect final background alpha"
+ + " percentage");
+ }
+ mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha;
super.start();
@@ -386,18 +415,16 @@
createBatteryController();
mCarBatteryController.startListening();
- mHvacController.connectToCarService();
-
mDeviceProvisionedController.addCallback(
new DeviceProvisionedController.DeviceProvisionedListener() {
@Override
public void onUserSetupChanged() {
- mHandler.post(() -> restartNavBarsIfNecessary());
+ mHandler.post(() -> resetSystemBarsIfNecessary());
}
@Override
public void onUserSwitched() {
- mHandler.post(() -> restartNavBarsIfNecessary());
+ mHandler.post(() -> resetSystemBarsIfNecessary());
}
});
@@ -411,11 +438,11 @@
mSwitchToGuestTimer = new SwitchToGuestTimer(mContext);
}
- private void restartNavBarsIfNecessary() {
+ private void resetSystemBarsIfNecessary() {
boolean currentUserSetup = mDeviceProvisionedController.isCurrentUserSetup();
if (mDeviceIsSetUpForUser != currentUserSetup) {
mDeviceIsSetUpForUser = currentUserSetup;
- restartNavBars();
+ resetSystemBars();
}
}
@@ -423,10 +450,7 @@
* Remove all content from navbars and rebuild them. Used to allow for different nav bars
* before and after the device is provisioned. . Also for change of density and font size.
*/
- private void restartNavBars() {
- // remove and reattach all hvac components such that we don't keep a reference to unused
- // ui elements
- mHvacController.removeAllComponents();
+ private void resetSystemBars() {
mCarFacetButtonController.removeAll();
buildNavBarContent();
@@ -435,67 +459,27 @@
mCarFacetButtonController.addAllFacetButtons(mStatusBarWindow);
}
- private void addTemperatureViewToController(View v) {
- if (v instanceof TemperatureView) {
- mHvacController.addHvacTextView((TemperatureView) v);
- } else if (v instanceof ViewGroup) {
- ViewGroup viewGroup = (ViewGroup) v;
- for (int i = 0; i < viewGroup.getChildCount(); i++) {
- addTemperatureViewToController(viewGroup.getChildAt(i));
- }
- }
- }
-
/**
* Allows for showing or hiding just the navigation bars. This is indented to be used when
* the full screen user selector is shown.
*/
void setNavBarVisibility(@View.Visibility int visibility) {
- if (mNavigationBarViewFactory.getBottomWindow() != null) {
- mNavigationBarViewFactory.getBottomWindow().setVisibility(visibility);
- }
- if (mNavigationBarViewFactory.getLeftWindow() != null) {
- mNavigationBarViewFactory.getLeftWindow().setVisibility(visibility);
- }
- if (mNavigationBarViewFactory.getRightWindow() != null) {
- mNavigationBarViewFactory.getRightWindow().setVisibility(visibility);
- }
+ mCarNavigationBarController.setBottomWindowVisibility(visibility);
+ mCarNavigationBarController.setLeftWindowVisibility(visibility);
+ mCarNavigationBarController.setRightWindowVisibility(visibility);
}
@Override
public boolean hideKeyguard() {
boolean result = super.hideKeyguard();
- if (mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser).hideKeyguardButtons();
- }
- if (mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser).hideKeyguardButtons();
- }
- if (mNavigationBarViewFactory.getRightBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getRightBar(mDeviceIsSetUpForUser).hideKeyguardButtons();
- }
+ mCarNavigationBarController.hideAllKeyguardButtons(mDeviceIsSetUpForUser);
return result;
}
@Override
public void showKeyguard() {
super.showKeyguard();
- updateNavBarForKeyguardContent();
- }
-
- /**
- * Switch to the keyguard applicable content contained in the nav bars
- */
- private void updateNavBarForKeyguardContent() {
- if (mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser).showKeyguardButtons();
- }
- if (mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser).showKeyguardButtons();
- }
- if (mNavigationBarViewFactory.getRightBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getRightBar(mDeviceIsSetUpForUser).showKeyguardButtons();
- }
+ mCarNavigationBarController.showAllKeyguardButtons(mDeviceIsSetUpForUser);
}
@Override
@@ -599,27 +583,11 @@
mNotificationDataManager = new NotificationDataManager();
mNotificationDataManager.setOnUnseenCountUpdateListener(
() -> {
- if (mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser) != null
- && mNotificationDataManager != null) {
- Boolean hasUnseen =
+ if (mNotificationDataManager != null) {
+ boolean hasUnseen =
mNotificationDataManager.getUnseenNotificationCount() > 0;
- if (mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getBottomBar(
- mDeviceIsSetUpForUser).toggleNotificationUnseenIndicator(
- hasUnseen);
- }
-
- if (mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getLeftBar(
- mDeviceIsSetUpForUser).toggleNotificationUnseenIndicator(
- hasUnseen);
- }
-
- if (mNavigationBarViewFactory.getRightBar(mDeviceIsSetUpForUser) != null) {
- mNavigationBarViewFactory.getRightBar(
- mDeviceIsSetUpForUser).toggleNotificationUnseenIndicator(
- hasUnseen);
- }
+ mCarNavigationBarController.toggleAllNotificationsUnseenIndicator(
+ mDeviceIsSetUpForUser, hasUnseen);
}
});
@@ -873,39 +841,33 @@
@Override
protected void createNavigationBar(@Nullable RegisterStatusBarResult result) {
- buildNavBarWindows();
+ mTopNavigationBarContainer = mStatusBarWindow
+ .findViewById(R.id.car_top_navigation_bar_container);
+
buildNavBarContent();
}
private void buildNavBarContent() {
buildTopBar();
- CarNavigationBarView bottom = mNavigationBarViewFactory.getBottomBar(mDeviceIsSetUpForUser);
- bottom.setStatusBar(this);
- bottom.setStatusBarWindowTouchListener(mNavBarNotificationTouchListener);
+ mCarNavigationBarController.registerBottomBarTouchListener(
+ mNavBarNotificationTouchListener);
- CarNavigationBarView left = mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser);
- left.setStatusBar(this);
- left.setStatusBarWindowTouchListener(mNavBarNotificationTouchListener);
+ mCarNavigationBarController.registerLeftBarTouchListener(
+ mNavBarNotificationTouchListener);
- CarNavigationBarView right = mNavigationBarViewFactory.getLeftBar(mDeviceIsSetUpForUser);
- right.setStatusBar(this);
- right.setStatusBarWindowTouchListener(mNavBarNotificationTouchListener);
- }
+ mCarNavigationBarController.registerRightBarTouchListener(
+ mNavBarNotificationTouchListener);
- private void buildNavBarWindows() {
- mTopNavigationBarContainer = mStatusBarWindow
- .findViewById(R.id.car_top_navigation_bar_container);
+ mCarNavigationBarController.registerNotificationController(() -> togglePanel());
}
private void buildTopBar() {
mTopNavigationBarContainer.removeAllViews();
- mTopNavigationBarView = mNavigationBarViewFactory.getTopBar(mDeviceIsSetUpForUser);
+ mTopNavigationBarView = mCarNavigationBarController.getTopBar(mDeviceIsSetUpForUser);
+ mCarNavigationBarController.registerTopBarTouchListener(
+ mTopNavBarNotificationTouchListener);
mTopNavigationBarContainer.addView(mTopNavigationBarView);
-
- mTopNavigationBarView.setStatusBar(this);
- addTemperatureViewToController(mTopNavigationBarView);
- mTopNavigationBarView.setStatusBarWindowTouchListener(mTopNavBarNotificationTouchListener);
}
@Override
@@ -1073,7 +1035,7 @@
@Override
public void onDensityOrFontScaleChanged() {
super.onDensityOrFontScaleChanged();
- restartNavBars();
+ resetSystemBars();
// Need to update the background on density changed in case the change was due to night
// mode.
mNotificationPanelBackground = getDefaultWallpaper();
@@ -1101,17 +1063,22 @@
mHandleBar.setTranslationY(height - mHandleBar.getHeight() - lp.bottomMargin);
}
if (mNotificationView.getHeight() > 0) {
- // Calculates the alpha value for the background based on how much of the notification
- // shade is visible to the user. When the notification shade is completely open then
- // alpha value will be 1.
- float alpha = (float) height / mNotificationView.getHeight();
Drawable background = mNotificationView.getBackground().mutate();
-
- background.setAlpha((int) (alpha * 255));
+ background.setAlpha((int) (getBackgroundAlpha(height) * 255));
mNotificationView.setBackground(background);
}
}
+ /**
+ * Calculates the alpha value for the background based on how much of the notification
+ * shade is visible to the user. When the notification shade is completely open then
+ * alpha value will be 1.
+ */
+ private float getBackgroundAlpha(int height) {
+ return mInitialBackgroundAlpha +
+ ((float) height / mNotificationView.getHeight() * mBackgroundAlphaDiff);
+ }
+
@Override
public void onConfigChanged(Configuration newConfig) {
super.onConfigChanged(newConfig);
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
index 3014452..05657ff 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
@@ -18,6 +18,7 @@
import static android.content.DialogInterface.BUTTON_NEGATIVE;
import static android.content.DialogInterface.BUTTON_POSITIVE;
+import static android.os.UserManager.DISALLOW_ADD_USER;
import android.app.ActivityManager;
import android.app.AlertDialog;
@@ -31,7 +32,6 @@
import android.content.IntentFilter;
import android.content.pm.UserInfo;
import android.content.res.Resources;
-import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.AsyncTask;
import android.os.UserHandle;
@@ -66,6 +66,7 @@
private CarUserManagerHelper mCarUserManagerHelper;
private UserManager mUserManager;
private Context mContext;
+ private UserIconProvider mUserIconProvider;
private final BroadcastReceiver mUserUpdateReceiver = new BroadcastReceiver() {
@Override
@@ -79,6 +80,7 @@
mContext = context;
mCarUserManagerHelper = new CarUserManagerHelper(mContext);
mUserManager = UserManager.get(mContext);
+ mUserIconProvider = new UserIconProvider();
addItemDecoration(new ItemSpacingDecoration(mContext.getResources().getDimensionPixelSize(
R.dimen.car_user_switcher_vertical_spacing_between_users)));
@@ -145,7 +147,8 @@
userRecords.add(createStartGuestUserRecord());
// Add add user record if the foreground user can add users
- if (mCarUserManagerHelper.canForegroundUserAddUsers()) {
+ UserHandle fgUserHandle = UserHandle.of(ActivityManager.getCurrentUser());
+ if (!mUserManager.hasUserRestriction(DISALLOW_ADD_USER, fgUserHandle)) {
userRecords.add(createAddUserRecord());
}
@@ -250,9 +253,7 @@
@Override
public void onBindViewHolder(UserAdapterViewHolder holder, int position) {
UserRecord userRecord = mUsers.get(position);
- RoundedBitmapDrawable circleIcon = RoundedBitmapDrawableFactory.create(mRes,
- getUserRecordIcon(userRecord));
- circleIcon.setCircular(true);
+ RoundedBitmapDrawable circleIcon = getCircularUserRecordIcon(userRecord);
holder.mUserAvatarImageView.setImageDrawable(circleIcon);
holder.mUserNameTextView.setText(userRecord.mInfo.name);
@@ -285,7 +286,7 @@
}
private void handleAddUserClicked() {
- if (mCarUserManagerHelper.isUserLimitReached()) {
+ if (!mUserManager.canAddMoreUsers()) {
mAddUserView.setEnabled(true);
showMaxUserLimitReachedDialog();
} else {
@@ -334,17 +335,20 @@
}
}
- private Bitmap getUserRecordIcon(UserRecord userRecord) {
+ private RoundedBitmapDrawable getCircularUserRecordIcon(UserRecord userRecord) {
+ Resources resources = mContext.getResources();
+ RoundedBitmapDrawable circleIcon;
if (userRecord.mIsStartGuestSession) {
- return mCarUserManagerHelper.getGuestDefaultIcon();
+ circleIcon = mUserIconProvider.getRoundedGuestDefaultIcon(resources);
+ } else if (userRecord.mIsAddUser) {
+ circleIcon = RoundedBitmapDrawableFactory.create(mRes, UserIcons.convertToBitmap(
+ mContext.getDrawable(R.drawable.car_add_circle_round)));
+ circleIcon.setCircular(true);
+ } else {
+ circleIcon = mUserIconProvider.getRoundedUserIcon(userRecord.mInfo, mContext);
}
- if (userRecord.mIsAddUser) {
- return UserIcons.convertToBitmap(mContext
- .getDrawable(R.drawable.car_add_circle_round));
- }
-
- return mCarUserManagerHelper.getUserIcon(userRecord.mInfo);
+ return circleIcon;
}
@Override
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserIconProvider.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserIconProvider.java
new file mode 100644
index 0000000..9464eab
--- /dev/null
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserIconProvider.java
@@ -0,0 +1,116 @@
+/*
+ * 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.systemui.statusbar.car;
+
+import android.annotation.UserIdInt;
+import android.content.Context;
+import android.content.pm.UserInfo;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import androidx.core.graphics.drawable.RoundedBitmapDrawable;
+import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
+
+import com.android.internal.util.UserIcons;
+import com.android.systemui.R;
+
+/**
+ * Simple class for providing icons for users.
+ */
+public class UserIconProvider {
+ /**
+ * Gets a scaled rounded icon for the given user. If a user does not have an icon saved, this
+ * method will default to a generic icon and update UserManager to use that icon.
+ *
+ * @param userInfo User for which the icon is requested.
+ * @param context Context to use for resources
+ * @return {@link RoundedBitmapDrawable} representing the icon for the user.
+ */
+ public RoundedBitmapDrawable getRoundedUserIcon(UserInfo userInfo, Context context) {
+ UserManager userManager = UserManager.get(context);
+ Resources res = context.getResources();
+ Bitmap icon = userManager.getUserIcon(userInfo.id);
+
+ if (icon == null) {
+ icon = assignDefaultIcon(userManager, res, userInfo);
+ }
+
+ return createScaledRoundIcon(res, icon);
+ }
+
+ /** Returns a scaled, rounded, default icon for the Guest user */
+ public RoundedBitmapDrawable getRoundedGuestDefaultIcon(Resources resources) {
+ return createScaledRoundIcon(resources, getGuestUserDefaultIcon(resources));
+ }
+
+ private RoundedBitmapDrawable createScaledRoundIcon(Resources resources, Bitmap icon) {
+ BitmapDrawable scaledIcon = scaleUserIcon(resources, icon);
+ RoundedBitmapDrawable circleIcon =
+ RoundedBitmapDrawableFactory.create(resources, scaledIcon.getBitmap());
+ circleIcon.setCircular(true);
+ return circleIcon;
+ }
+
+ /**
+ * Returns a {@link Drawable} for the given {@code icon} scaled to the appropriate size.
+ */
+ private static BitmapDrawable scaleUserIcon(Resources res, Bitmap icon) {
+ int desiredSize = res.getDimensionPixelSize(R.dimen.car_primary_icon_size);
+ Bitmap scaledIcon =
+ Bitmap.createScaledBitmap(icon, desiredSize, desiredSize, /*filter=*/ true);
+ return new BitmapDrawable(res, scaledIcon);
+ }
+
+ /**
+ * Assigns a default icon to a user according to the user's id. Handles Guest icon and non-guest
+ * user icons.
+ *
+ * @param userManager {@link UserManager} to set user icon
+ * @param resources {@link Resources} to grab icons from
+ * @param userInfo User whose avatar is set to default icon.
+ * @return Bitmap of the user icon.
+ */
+ private Bitmap assignDefaultIcon(
+ UserManager userManager, Resources resources, UserInfo userInfo) {
+ Bitmap bitmap = userInfo.isGuest()
+ ? getGuestUserDefaultIcon(resources)
+ : getUserDefaultIcon(resources, userInfo.id);
+ userManager.setUserIcon(userInfo.id, bitmap);
+ return bitmap;
+ }
+
+ /**
+ * Gets a bitmap representing the user's default avatar.
+ *
+ * @param resources The resources to pull from
+ * @param id The id of the user to get the icon for. Pass {@link UserHandle#USER_NULL} for
+ * Guest user.
+ * @return Default user icon
+ */
+ private Bitmap getUserDefaultIcon(Resources resources, @UserIdInt int id) {
+ return UserIcons.convertToBitmap(
+ UserIcons.getDefaultUserIcon(resources, id, /* light= */ false));
+ }
+
+ private Bitmap getGuestUserDefaultIcon(Resources resources) {
+ return getUserDefaultIcon(resources, UserHandle.USER_NULL);
+ }
+}
diff --git a/packages/CarSystemUI/tests/Android.mk b/packages/CarSystemUI/tests/Android.mk
new file mode 100644
index 0000000..1366568
--- /dev/null
+++ b/packages/CarSystemUI/tests/Android.mk
@@ -0,0 +1,88 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_USE_AAPT2 := true
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_JACK_FLAGS := --multi-dex native
+LOCAL_DX_FLAGS := --multi-dex
+
+LOCAL_PACKAGE_NAME := CarSystemUITests
+LOCAL_PRIVATE_PLATFORM_APIS := true
+LOCAL_COMPATIBILITY_SUITE := device-tests
+
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ CarSystemUI-tests
+
+LOCAL_MULTILIB := both
+
+LOCAL_JNI_SHARED_LIBRARIES := \
+ libdexmakerjvmtiagent \
+ libmultiplejvmtiagentsinterferenceagent
+
+LOCAL_JAVA_LIBRARIES := \
+ android.test.runner \
+ telephony-common \
+ android.test.base \
+
+LOCAL_AAPT_FLAGS := --extra-packages com.android.systemui
+
+# sign this with platform cert, so this test is allowed to inject key events into
+# UI it doesn't own. This is necessary to allow screenshots to be taken
+LOCAL_CERTIFICATE := platform
+
+# Provide jack a list of classes to exclude from code coverage.
+# This is needed because the CarSystemUITests compile CarSystemUI source directly, rather than using
+# LOCAL_INSTRUMENTATION_FOR := CarSystemUI.
+#
+# We want to exclude the test classes from code coverage measurements, but they share the same
+# package as the rest of SystemUI so they can't be easily filtered by package name.
+#
+# Generate a comma separated list of patterns based on the test source files under src/
+# SystemUI classes are in ../src/ so they won't be excluded.
+# Example:
+# Input files: src/com/android/systemui/Test.java src/com/android/systemui/AnotherTest.java
+# Generated exclude list: com.android.systemui.Test*,com.android.systemui.AnotherTest*
+
+# Filter all src files under src/ to just java files
+local_java_files := $(filter %.java,$(call all-java-files-under, src))
+
+# Transform java file names into full class names.
+# This only works if the class name matches the file name and the directory structure
+# matches the package.
+local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
+local_comma := ,
+local_empty :=
+local_space := $(local_empty) $(local_empty)
+
+# Convert class name list to jacoco exclude list
+# This appends a * to all classes and replace the space separators with commas.
+jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
+
+LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.systemui.*,com.android.keyguard.*
+LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude)
+
+ifeq ($(EXCLUDE_SYSTEMUI_TESTS),)
+ include $(BUILD_PACKAGE)
+endif
+
+# Reset variables
+local_java_files :=
+local_classes :=
+local_comma :=
+local_space :=
+jacoco_exclude :=
diff --git a/packages/CarSystemUI/tests/AndroidManifest.xml b/packages/CarSystemUI/tests/AndroidManifest.xml
new file mode 100644
index 0000000..a74bb56
--- /dev/null
+++ b/packages/CarSystemUI/tests/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:sharedUserId="android.uid.system"
+ package="com.android.systemui.tests">
+
+ <application android:debuggable="true" android:largeHeap="true">
+ <uses-library android:name="android.test.runner" />
+
+ <provider
+ android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
+ tools:replace="android:authorities"
+ android:authorities="${applicationId}.lifecycle-tests"
+ android:exported="false"
+ android:enabled="false"
+ android:multiprocess="true" />
+ </application>
+
+ <instrumentation android:name="android.testing.TestableInstrumentation"
+ android:targetPackage="com.android.systemui.tests"
+ android:label="Tests for CarSystemUI">
+ </instrumentation>
+</manifest>
diff --git a/packages/CarSystemUI/tests/AndroidTest.xml b/packages/CarSystemUI/tests/AndroidTest.xml
new file mode 100644
index 0000000..8685632
--- /dev/null
+++ b/packages/CarSystemUI/tests/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<configuration description="Runs Tests for CarSystemUI.">
+ <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+ <option name="test-file-name" value="CarSystemUITests.apk" />
+ </target_preparer>
+
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="framework-base-presubmit" />
+ <option name="test-tag" value="CarSystemUITests" />
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.systemui.tests" />
+ <option name="runner" value="android.testing.TestableInstrumentation" />
+ <option name="hidden-api-checks" value="false"/>
+ </test>
+</configuration>
diff --git a/packages/CarSystemUI/tests/res/values/config.xml b/packages/CarSystemUI/tests/res/values/config.xml
new file mode 100644
index 0000000..0d08ac2
--- /dev/null
+++ b/packages/CarSystemUI/tests/res/values/config.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<resources>
+ <!-- Configure which system ui bars should be displayed.
+ These can be overwritten within the tests. -->
+ <bool name="config_enableLeftNavigationBar">false</bool>
+ <bool name="config_enableRightNavigationBar">false</bool>
+ <bool name="config_enableBottomNavigationBar">false</bool>
+</resources>
diff --git a/packages/CarSystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java b/packages/CarSystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
new file mode 100644
index 0000000..fe59cbf
--- /dev/null
+++ b/packages/CarSystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
@@ -0,0 +1,214 @@
+/*
+ * 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;
+
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import android.testing.AndroidTestingRunner;
+import android.text.TextUtils;
+import android.util.Log;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.internal.runner.ClassPathScanner;
+import androidx.test.internal.runner.ClassPathScanner.ChainedClassNameFilter;
+import androidx.test.internal.runner.ClassPathScanner.ExternalClassNameFilter;
+
+import com.android.systemui.SysuiBaseFragmentTest;
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * This is named AAAPlusPlusVerifySysuiRequiredTestPropertiesTest for two reasons.
+ * a) Its so awesome it deserves an AAA++
+ * b) It should run first to draw attention to itself.
+ *
+ * For trues though: this test verifies that all the sysui tests extend the right classes.
+ * This matters because including tests with different context implementations in the same
+ * test suite causes errors, such as the incorrect settings provider being cached.
+ * For an example, see {@link com.android.systemui.DependencyTest}.
+ */
+@RunWith(AndroidTestingRunner.class)
+@SmallTest
+public class AAAPlusPlusVerifySysuiRequiredTestPropertiesTest extends SysuiTestCase {
+
+ private static final String TAG = "AAA++VerifyTest";
+
+ private static final Class[] BASE_CLS_WHITELIST = {
+ SysuiTestCase.class,
+ SysuiBaseFragmentTest.class,
+ };
+
+ private static final Class[] SUPPORTED_SIZES = {
+ SmallTest.class,
+ MediumTest.class,
+ LargeTest.class,
+ android.test.suitebuilder.annotation.SmallTest.class,
+ android.test.suitebuilder.annotation.MediumTest.class,
+ android.test.suitebuilder.annotation.LargeTest.class,
+ };
+
+ @Test
+ public void testAllClassInheritance() throws Throwable {
+ ArrayList<String> fails = new ArrayList<>();
+ for (String className : getClassNamesFromClassPath()) {
+ Class<?> cls = Class.forName(className, false, this.getClass().getClassLoader());
+ if (!isTestClass(cls)) continue;
+
+ boolean hasParent = false;
+ for (Class<?> parent : BASE_CLS_WHITELIST) {
+ if (parent.isAssignableFrom(cls)) {
+ hasParent = true;
+ break;
+ }
+ }
+ boolean hasSize = hasSize(cls);
+ if (!hasSize) {
+ fails.add(cls.getName() + " does not have size annotation, such as @SmallTest");
+ }
+ if (!hasParent) {
+ fails.add(cls.getName() + " does not extend any of " + getClsStr());
+ }
+ }
+
+ assertThat("All sysui test classes must have size and extend one of " + getClsStr(),
+ fails, is(empty()));
+ }
+
+ private boolean hasSize(Class<?> cls) {
+ for (int i = 0; i < SUPPORTED_SIZES.length; i++) {
+ if (cls.getDeclaredAnnotation(SUPPORTED_SIZES[i]) != null) return true;
+ }
+ return false;
+ }
+
+ private Collection<String> getClassNamesFromClassPath() {
+ ClassPathScanner scanner = new ClassPathScanner(mContext.getPackageCodePath());
+
+ ChainedClassNameFilter filter = new ChainedClassNameFilter();
+
+ filter.add(new ExternalClassNameFilter());
+ filter.add(s -> s.startsWith("com.android.systemui")
+ || s.startsWith("com.android.keyguard"));
+
+ try {
+ return scanner.getClassPathEntries(filter);
+ } catch (IOException e) {
+ Log.e(TAG, "Failed to scan classes", e);
+ }
+ return Collections.emptyList();
+ }
+
+ private String getClsStr() {
+ return TextUtils.join(",", Arrays.asList(BASE_CLS_WHITELIST)
+ .stream().map(cls -> cls.getSimpleName()).toArray());
+ }
+
+ /**
+ * Determines if given class is a valid test class.
+ *
+ * @return <code>true</code> if loadedClass is a test
+ */
+ private boolean isTestClass(Class<?> loadedClass) {
+ try {
+ if (Modifier.isAbstract(loadedClass.getModifiers())) {
+ logDebug(String.format("Skipping abstract class %s: not a test",
+ loadedClass.getName()));
+ return false;
+ }
+ // TODO: try to find upstream junit calls to replace these checks
+ if (junit.framework.Test.class.isAssignableFrom(loadedClass)) {
+ // ensure that if a TestCase, it has at least one test method otherwise
+ // TestSuite will throw error
+ if (junit.framework.TestCase.class.isAssignableFrom(loadedClass)) {
+ return hasJUnit3TestMethod(loadedClass);
+ }
+ return true;
+ }
+ // TODO: look for a 'suite' method?
+ if (loadedClass.isAnnotationPresent(RunWith.class)) {
+ return true;
+ }
+ for (Method testMethod : loadedClass.getMethods()) {
+ if (testMethod.isAnnotationPresent(Test.class)) {
+ return true;
+ }
+ }
+ logDebug(String.format("Skipping class %s: not a test", loadedClass.getName()));
+ return false;
+ } catch (Exception e) {
+ // Defensively catch exceptions - Will throw runtime exception if it cannot load
+ // methods.
+ // For earlier versions of Android (Pre-ICS), Dalvik might try to initialize a class
+ // during getMethods(), fail to do so, hide the error and throw a NoSuchMethodException.
+ // Since the java.lang.Class.getMethods does not declare such an exception, resort to a
+ // generic catch all.
+ // For ICS+, Dalvik will throw a NoClassDefFoundException.
+ Log.w(TAG, String.format("%s in isTestClass for %s", e.toString(),
+ loadedClass.getName()));
+ return false;
+ } catch (Error e) {
+ // defensively catch Errors too
+ Log.w(TAG, String.format("%s in isTestClass for %s", e.toString(),
+ loadedClass.getName()));
+ return false;
+ }
+ }
+
+ private boolean hasJUnit3TestMethod(Class<?> loadedClass) {
+ for (Method testMethod : loadedClass.getMethods()) {
+ if (isPublicTestMethod(testMethod)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // copied from junit.framework.TestSuite
+ private boolean isPublicTestMethod(Method m) {
+ return isTestMethod(m) && Modifier.isPublic(m.getModifiers());
+ }
+
+ // copied from junit.framework.TestSuite
+ private boolean isTestMethod(Method m) {
+ return m.getParameterTypes().length == 0 && m.getName().startsWith("test")
+ && m.getReturnType().equals(Void.TYPE);
+ }
+
+ /**
+ * Utility method for logging debug messages. Only actually logs a message if TAG is marked
+ * as loggable to limit log spam during normal use.
+ */
+ private void logDebug(String msg) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, msg);
+ }
+ }
+}
diff --git a/packages/CarSystemUI/tests/src/com/android/systemui/navigationbar/car/CarNavigationBarControllerTest.java b/packages/CarSystemUI/tests/src/com/android/systemui/navigationbar/car/CarNavigationBarControllerTest.java
new file mode 100644
index 0000000..901d200
--- /dev/null
+++ b/packages/CarSystemUI/tests/src/com/android/systemui/navigationbar/car/CarNavigationBarControllerTest.java
@@ -0,0 +1,408 @@
+/*
+ * 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.systemui.navigationbar.car;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+import android.testing.TestableResources;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.systemui.R;
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.plugins.DarkIconDispatcher;
+import com.android.systemui.statusbar.car.hvac.HvacController;
+import com.android.systemui.statusbar.phone.StatusBarIconController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import dagger.Lazy;
+
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+@SmallTest
+public class CarNavigationBarControllerTest extends SysuiTestCase {
+
+ private CarNavigationBarController mCarNavigationBar;
+ private NavigationBarViewFactory mNavigationBarViewFactory;
+ private Lazy<HvacController> mHvacControllerLazy;
+ private TestableResources mTestableResources;
+
+ @Mock
+ private HvacController mHvacController;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mNavigationBarViewFactory = new NavigationBarViewFactory(mContext);
+ mHvacControllerLazy = () -> mHvacController;
+ mTestableResources = mContext.getOrCreateTestableResources();
+
+ // Needed to inflate top navigation bar.
+ mDependency.injectMockDependency(DarkIconDispatcher.class);
+ mDependency.injectMockDependency(StatusBarIconController.class);
+ }
+
+ @Test
+ public void testConnectToHvac_callsConnect() {
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ mCarNavigationBar.connectToHvac();
+
+ verify(mHvacController).connectToCarService();
+ }
+
+ @Test
+ public void testRemoveAllFromHvac_callsRemoveAll() {
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ mCarNavigationBar.removeAllFromHvac();
+
+ verify(mHvacController).removeAllComponents();
+ }
+
+ @Test
+ public void testGetBottomWindow_bottomDisabled_returnsNull() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, false);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getBottomWindow();
+
+ assertThat(window).isNull();
+ }
+
+ @Test
+ public void testGetBottomWindow_bottomEnabled_returnsWindow() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getBottomWindow();
+
+ assertThat(window).isNotNull();
+ }
+
+ @Test
+ public void testGetBottomWindow_bottomEnabled_calledTwice_returnsSameWindow() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window1 = mCarNavigationBar.getBottomWindow();
+ ViewGroup window2 = mCarNavigationBar.getBottomWindow();
+
+ assertThat(window1).isEqualTo(window2);
+ }
+
+ @Test
+ public void testGetLeftWindow_leftDisabled_returnsNull() {
+ mTestableResources.addOverride(R.bool.config_enableLeftNavigationBar, false);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ ViewGroup window = mCarNavigationBar.getLeftWindow();
+ assertThat(window).isNull();
+ }
+
+ @Test
+ public void testGetLeftWindow_leftEnabled_returnsWindow() {
+ mTestableResources.addOverride(R.bool.config_enableLeftNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getLeftWindow();
+
+ assertThat(window).isNotNull();
+ }
+
+ @Test
+ public void testGetLeftWindow_leftEnabled_calledTwice_returnsSameWindow() {
+ mTestableResources.addOverride(R.bool.config_enableLeftNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window1 = mCarNavigationBar.getLeftWindow();
+ ViewGroup window2 = mCarNavigationBar.getLeftWindow();
+
+ assertThat(window1).isEqualTo(window2);
+ }
+
+ @Test
+ public void testGetRightWindow_rightDisabled_returnsNull() {
+ mTestableResources.addOverride(R.bool.config_enableRightNavigationBar, false);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getRightWindow();
+
+ assertThat(window).isNull();
+ }
+
+ @Test
+ public void testGetRightWindow_rightEnabled_returnsWindow() {
+ mTestableResources.addOverride(R.bool.config_enableRightNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getRightWindow();
+
+ assertThat(window).isNotNull();
+ }
+
+ @Test
+ public void testGetRightWindow_rightEnabled_calledTwice_returnsSameWindow() {
+ mTestableResources.addOverride(R.bool.config_enableRightNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window1 = mCarNavigationBar.getRightWindow();
+ ViewGroup window2 = mCarNavigationBar.getRightWindow();
+
+ assertThat(window1).isEqualTo(window2);
+ }
+
+ @Test
+ public void testSetBottomWindowVisibility_setTrue_isVisible() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getBottomWindow();
+ mCarNavigationBar.setBottomWindowVisibility(View.VISIBLE);
+
+ assertThat(window.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
+ @Test
+ public void testSetBottomWindowVisibility_setFalse_isGone() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getBottomWindow();
+ mCarNavigationBar.setBottomWindowVisibility(View.GONE);
+
+ assertThat(window.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
+ public void testSetLeftWindowVisibility_setTrue_isVisible() {
+ mTestableResources.addOverride(R.bool.config_enableLeftNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getLeftWindow();
+ mCarNavigationBar.setLeftWindowVisibility(View.VISIBLE);
+
+ assertThat(window.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
+ @Test
+ public void testSetLeftWindowVisibility_setFalse_isGone() {
+ mTestableResources.addOverride(R.bool.config_enableLeftNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getLeftWindow();
+ mCarNavigationBar.setLeftWindowVisibility(View.GONE);
+
+ assertThat(window.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
+ public void testSetRightWindowVisibility_setTrue_isVisible() {
+ mTestableResources.addOverride(R.bool.config_enableRightNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getRightWindow();
+ mCarNavigationBar.setRightWindowVisibility(View.VISIBLE);
+
+ assertThat(window.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
+ @Test
+ public void testSetRightWindowVisibility_setFalse_isGone() {
+ mTestableResources.addOverride(R.bool.config_enableRightNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ ViewGroup window = mCarNavigationBar.getRightWindow();
+ mCarNavigationBar.setRightWindowVisibility(View.GONE);
+
+ assertThat(window.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
+ public void testRegisterBottomBarTouchListener_createViewFirst_registrationSuccessful() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ View.OnTouchListener controller = bottomBar.getStatusBarWindowTouchListener();
+ assertThat(controller).isNull();
+ mCarNavigationBar.registerBottomBarTouchListener(mock(View.OnTouchListener.class));
+ controller = bottomBar.getStatusBarWindowTouchListener();
+
+ assertThat(controller).isNotNull();
+ }
+
+ @Test
+ public void testRegisterBottomBarTouchListener_registerFirst_registrationSuccessful() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ mCarNavigationBar.registerBottomBarTouchListener(mock(View.OnTouchListener.class));
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ View.OnTouchListener controller = bottomBar.getStatusBarWindowTouchListener();
+
+ assertThat(controller).isNotNull();
+ }
+
+ @Test
+ public void testRegisterNotificationController_createViewFirst_registrationSuccessful() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ CarNavigationBarController.NotificationsShadeController controller =
+ bottomBar.getNotificationsPanelController();
+ assertThat(controller).isNull();
+ mCarNavigationBar.registerNotificationController(
+ mock(CarNavigationBarController.NotificationsShadeController.class));
+ controller = bottomBar.getNotificationsPanelController();
+
+ assertThat(controller).isNotNull();
+ }
+
+ @Test
+ public void testRegisterNotificationController_registerFirst_registrationSuccessful() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+
+ mCarNavigationBar.registerNotificationController(
+ mock(CarNavigationBarController.NotificationsShadeController.class));
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ CarNavigationBarController.NotificationsShadeController controller =
+ bottomBar.getNotificationsPanelController();
+
+ assertThat(controller).isNotNull();
+ }
+
+ @Test
+ public void testShowAllKeyguardButtons_bottomEnabled_bottomKeyguardButtonsVisible() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ View bottomKeyguardButtons = bottomBar.findViewById(R.id.lock_screen_nav_buttons);
+
+ mCarNavigationBar.showAllKeyguardButtons(/* isSetUp= */ true);
+
+ assertThat(bottomKeyguardButtons.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
+ @Test
+ public void testShowAllKeyguardButtons_bottomEnabled_bottomNavButtonsGone() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ View bottomButtons = bottomBar.findViewById(R.id.nav_buttons);
+
+ mCarNavigationBar.showAllKeyguardButtons(/* isSetUp= */ true);
+
+ assertThat(bottomButtons.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
+ public void testHideAllKeyguardButtons_bottomEnabled_bottomKeyguardButtonsGone() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ View bottomKeyguardButtons = bottomBar.findViewById(R.id.lock_screen_nav_buttons);
+
+ mCarNavigationBar.showAllKeyguardButtons(/* isSetUp= */ true);
+ assertThat(bottomKeyguardButtons.getVisibility()).isEqualTo(View.VISIBLE);
+ mCarNavigationBar.hideAllKeyguardButtons(/* isSetUp= */ true);
+
+ assertThat(bottomKeyguardButtons.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
+ public void testHideAllKeyguardButtons_bottomEnabled_bottomNavButtonsVisible() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ View bottomButtons = bottomBar.findViewById(R.id.nav_buttons);
+
+ mCarNavigationBar.showAllKeyguardButtons(/* isSetUp= */ true);
+ assertThat(bottomButtons.getVisibility()).isEqualTo(View.GONE);
+ mCarNavigationBar.hideAllKeyguardButtons(/* isSetUp= */ true);
+
+ assertThat(bottomButtons.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
+ @Test
+ public void testToggleAllNotificationsUnseenIndicator_bottomEnabled_hasUnseen_setCorrectly() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ CarNavigationButton notifications = bottomBar.findViewById(R.id.notifications);
+
+ boolean hasUnseen = true;
+ mCarNavigationBar.toggleAllNotificationsUnseenIndicator(/* isSetUp= */ true,
+ hasUnseen);
+
+ assertThat(notifications.getUnseen()).isTrue();
+ }
+
+ @Test
+ public void testToggleAllNotificationsUnseenIndicator_bottomEnabled_noUnseen_setCorrectly() {
+ mTestableResources.addOverride(R.bool.config_enableBottomNavigationBar, true);
+ mCarNavigationBar = new CarNavigationBarController(mContext, mNavigationBarViewFactory,
+ mHvacControllerLazy);
+ CarNavigationBarView bottomBar = mCarNavigationBar.getBottomBar(/* isSetUp= */ true);
+ CarNavigationButton notifications = bottomBar.findViewById(R.id.notifications);
+
+ boolean hasUnseen = false;
+ mCarNavigationBar.toggleAllNotificationsUnseenIndicator(/* isSetUp= */ true,
+ hasUnseen);
+
+ assertThat(notifications.getUnseen()).isFalse();
+ }
+}
diff --git a/packages/CtsShim/Android.bp b/packages/CtsShim/Android.bp
new file mode 100644
index 0000000..7728464
--- /dev/null
+++ b/packages/CtsShim/Android.bp
@@ -0,0 +1,74 @@
+//
+// Copyright (C) 2016 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.
+//
+
+//##########################################################
+// Variant: Privileged app
+
+android_app_import {
+ name: "CtsShimPrivPrebuilt",
+
+ // this needs to be a privileged application
+ privileged: true,
+
+ // Make sure the build system doesn't try to resign the APK
+ dex_preopt: {
+ enabled: false,
+ },
+
+ arch: {
+ arm: {
+ apk: "apk/arm/CtsShimPriv.apk",
+ },
+ arm64: {
+ apk: "apk/arm/CtsShimPriv.apk",
+ },
+ x86: {
+ apk: "apk/x86/CtsShimPriv.apk",
+ },
+ x86_64: {
+ apk: "apk/x86/CtsShimPriv.apk",
+ },
+ },
+ presigned: true,
+}
+
+//##########################################################
+// Variant: System app
+
+android_app_import {
+ name: "CtsShimPrebuilt",
+
+ // Make sure the build system doesn't try to resign the APK
+ dex_preopt: {
+ enabled: false,
+ },
+
+ arch: {
+ arm: {
+ apk: "apk/arm/CtsShim.apk",
+ },
+ arm64: {
+ apk: "apk/arm/CtsShim.apk",
+ },
+ x86: {
+ apk: "apk/x86/CtsShim.apk",
+ },
+ x86_64: {
+ apk: "apk/x86/CtsShim.apk",
+ },
+ },
+ presigned: true,
+}
diff --git a/packages/CtsShim/Android.mk b/packages/CtsShim/Android.mk
deleted file mode 100644
index 12972f1..0000000
--- a/packages/CtsShim/Android.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-###########################################################
-# Variant: Privileged app
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := CtsShimPrivPrebuilt
-LOCAL_MODULE_TAGS := optional
-# this needs to be a privileged application
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_MODULE_CLASS := APPS
-LOCAL_BUILT_MODULE_STEM := package.apk
-# Make sure the build system doesn't try to resign the APK
-LOCAL_CERTIFICATE := PRESIGNED
-LOCAL_DEX_PREOPT := false
-LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64
-
-LOCAL_SRC_FILES_arm := apk/arm/CtsShimPriv.apk
-LOCAL_SRC_FILES_arm64 := apk/arm/CtsShimPriv.apk
-LOCAL_SRC_FILES_x86 := apk/x86/CtsShimPriv.apk
-LOCAL_SRC_FILES_x86_64 := apk/x86/CtsShimPriv.apk
-
-include $(BUILD_PREBUILT)
-
-
-###########################################################
-# Variant: System app
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := CtsShimPrebuilt
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := APPS
-LOCAL_BUILT_MODULE_STEM := package.apk
-# Make sure the build system doesn't try to resign the APK
-LOCAL_CERTIFICATE := PRESIGNED
-LOCAL_DEX_PREOPT := false
-LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64
-
-LOCAL_SRC_FILES_arm := apk/arm/CtsShim.apk
-LOCAL_SRC_FILES_arm64 := apk/arm/CtsShim.apk
-LOCAL_SRC_FILES_x86 := apk/x86/CtsShim.apk
-LOCAL_SRC_FILES_x86_64 := apk/x86/CtsShim.apk
-
-include $(BUILD_PREBUILT)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/packages/CtsShim/build/Android.bp b/packages/CtsShim/build/Android.bp
new file mode 100644
index 0000000..ede1fab
--- /dev/null
+++ b/packages/CtsShim/build/Android.bp
@@ -0,0 +1,117 @@
+// 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.
+
+// Build rules to build shim apks.
+
+//##########################################################
+// Variant: Privileged app upgrade
+
+android_app {
+ name: "CtsShimPrivUpgrade",
+ // this needs to be a privileged application
+ privileged: true,
+
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+
+ manifest: "shim_priv_upgrade/AndroidManifest.xml",
+
+ compile_multilib: "both",
+ jni_libs: ["libshim_jni"],
+}
+
+genrule {
+ name: "generate_priv_manifest",
+ srcs: [
+ "shim_priv/AndroidManifest.xml",
+ ":CtsShimPrivUpgrade"
+ ],
+ out: ["AndroidManifest.xml"],
+ cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimPrivUpgrade) | cut -d' ' -f1`/ $(location shim_priv/AndroidManifest.xml) > $(out)",
+}
+
+//##########################################################
+// Variant: Privileged app
+
+android_app {
+ name: "CtsShimPriv",
+ // this needs to be a privileged application
+ privileged: true,
+
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+
+ manifest: ":generate_priv_manifest",
+
+ compile_multilib: "both",
+ jni_libs: ["libshim_jni"],
+ // Explicitly uncompress native libs rather than letting the build system doing it and destroy the
+ // v2/v3 signature.
+ use_embedded_native_libs: true,
+}
+
+//##########################################################
+// Variant: Privileged app upgrade w/ the wrong SHA
+
+android_app {
+ name: "CtsShimPrivUpgradeWrongSHA",
+ // this needs to be a privileged application
+ privileged: true,
+
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+ // anything to make this package's SHA different from CtsShimPrivUpgrade
+ aaptflags: [
+ "--version-name",
+ "WrongSHA",
+ ],
+
+ manifest: "shim_priv_upgrade/AndroidManifest.xml",
+
+ compile_multilib: "both",
+ jni_libs: ["libshim_jni"],
+
+}
+
+//##########################################################
+// Variant: System app
+
+android_app {
+ name: "CtsShim",
+
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+
+ manifest: "shim/AndroidManifest.xml",
+}
diff --git a/packages/CtsShim/build/Android.mk b/packages/CtsShim/build/Android.mk
deleted file mode 100644
index 0ef4654..0000000
--- a/packages/CtsShim/build/Android.mk
+++ /dev/null
@@ -1,119 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH := $(my-dir)
-
-###########################################################
-# Variant: Privileged app upgrade
-
-include $(CLEAR_VARS)
-# this needs to be a privileged application
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PACKAGE_NAME := CtsShimPrivUpgrade
-
-LOCAL_MANIFEST_FILE := shim_priv_upgrade/AndroidManifest.xml
-
-LOCAL_MULTILIB := both
-LOCAL_JNI_SHARED_LIBRARIES := libshim_jni
-
-include $(BUILD_PACKAGE)
-my_shim_priv_upgrade_apk := $(LOCAL_BUILT_MODULE)
-
-###########################################################
-# Variant: Privileged app
-
-include $(CLEAR_VARS)
-# this needs to be a privileged application
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PACKAGE_NAME := CtsShimPriv
-
-# Generate the upgrade key by taking the hash of the built CtsShimPrivUpgrade apk
-gen := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,true)/AndroidManifest.xml
-$(gen): PRIVATE_CUSTOM_TOOL = sed -e "s/__HASH__/`sha512sum $(PRIVATE_INPUT_APK) | cut -d' ' -f1`/" $< >$@
-$(gen): PRIVATE_INPUT_APK := $(my_shim_priv_upgrade_apk)
-$(gen): $(LOCAL_PATH)/shim_priv/AndroidManifest.xml $(my_shim_priv_upgrade_apk)
- $(transform-generated-source)
-
-my_shim_priv_upgrade_apk :=
-
-LOCAL_FULL_MANIFEST_FILE := $(gen)
-
-LOCAL_MULTILIB := both
-LOCAL_JNI_SHARED_LIBRARIES := libshim_jni
-# Explicitly uncompress native libs rather than letting the build system doing it and destroy the
-# v2/v3 signature.
-LOCAL_USE_EMBEDDED_NATIVE_LIBS := true
-
-LOCAL_USE_AAPT2 := true
-
-include $(BUILD_PACKAGE)
-
-###########################################################
-# Variant: Privileged app upgrade w/ the wrong SHA
-
-include $(CLEAR_VARS)
-# this needs to be a privileged application
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-# anything to make this package's SHA different from CtsShimPrivUpgrade
-LOCAL_AAPT_FLAGS := --version-name WrongSHA
-
-LOCAL_PACKAGE_NAME := CtsShimPrivUpgradeWrongSHA
-
-LOCAL_MANIFEST_FILE := shim_priv_upgrade/AndroidManifest.xml
-
-LOCAL_MULTILIB := both
-LOCAL_JNI_SHARED_LIBRARIES := libshim_jni
-
-include $(BUILD_PACKAGE)
-
-
-###########################################################
-# Variant: System app
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PACKAGE_NAME := CtsShim
-
-LOCAL_MANIFEST_FILE := shim/AndroidManifest.xml
-
-LOCAL_USE_AAPT2 := true
-
-include $(BUILD_PACKAGE)
-
-###########################################################
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index cf286bd..738c425 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -99,11 +99,13 @@
// init input stream before calling startInstallation(), which takes 90 seconds.
initInputStream();
- Thread thread = new Thread(() -> {
- mInstallationSession =
- mDynSystem.startInstallation(mSystemSize, mUserdataSize);
- });
-
+ Thread thread =
+ new Thread(
+ () -> {
+ mDynSystem.startInstallation("userdata", mUserdataSize, false);
+ mInstallationSession =
+ mDynSystem.startInstallation("system", mSystemSize, true);
+ });
thread.start();
diff --git a/packages/PrintSpooler/res/values-mr/strings.xml b/packages/PrintSpooler/res/values-mr/strings.xml
index 10dec8e..44456b4 100644
--- a/packages/PrintSpooler/res/values-mr/strings.xml
+++ b/packages/PrintSpooler/res/values-mr/strings.xml
@@ -87,7 +87,7 @@
<string name="restart" msgid="2472034227037808749">"रीस्टार्ट करा"</string>
<string name="no_connection_to_printer" msgid="2159246915977282728">"प्रिंटरवर कोणतेही कनेक्शन नाही"</string>
<string name="reason_unknown" msgid="5507940196503246139">"अज्ञात"</string>
- <string name="print_service_security_warning_title" msgid="2160752291246775320">"<xliff:g id="SERVICE">%1$s</xliff:g> वापरायची?"</string>
+ <string name="print_service_security_warning_title" msgid="2160752291246775320">"<xliff:g id="SERVICE">%1$s</xliff:g> वापरायचे?"</string>
<string name="print_service_security_warning_summary" msgid="1427434625361692006">"तुमचा दस्तऐवज प्रिंटरपर्यंत पोहचण्यापूर्वी एक किंवा अधिक सर्व्हरद्वारे जाऊ शकतो."</string>
<string-array name="color_mode_labels">
<item msgid="7602948745415174937">"कृष्ण धवल"</item>
diff --git a/packages/PrintSpooler/res/values-my/strings.xml b/packages/PrintSpooler/res/values-my/strings.xml
index fdcdd7c..a6b07e1 100644
--- a/packages/PrintSpooler/res/values-my/strings.xml
+++ b/packages/PrintSpooler/res/values-my/strings.xml
@@ -87,7 +87,7 @@
<string name="restart" msgid="2472034227037808749">"ပြန်စရန်"</string>
<string name="no_connection_to_printer" msgid="2159246915977282728">"စာထုတ်စက်နဲ့ ဆက်သွယ်ထားမှု မရှိပါ"</string>
<string name="reason_unknown" msgid="5507940196503246139">"မသိ"</string>
- <string name="print_service_security_warning_title" msgid="2160752291246775320">"<xliff:g id="SERVICE">%1$s</xliff:g>ကိုသုံးမလား။"</string>
+ <string name="print_service_security_warning_title" msgid="2160752291246775320">"<xliff:g id="SERVICE">%1$s</xliff:g> ကိုသုံးမလား။"</string>
<string name="print_service_security_warning_summary" msgid="1427434625361692006">"သင်၏ စာရွက်စာတမ်းများသည် ပရင်တာထံသို့ သွားစဉ် ဆာဗာ တစ်ခု သို့မဟုတ် ပိုများပြီး ဖြတ်ကျော်နိုင်ရသည်။"</string>
<string-array name="color_mode_labels">
<item msgid="7602948745415174937">"အဖြူ အမည်း"</item>
diff --git a/packages/SettingsLib/res/values-af/strings.xml b/packages/SettingsLib/res/values-af/strings.xml
index 245ca14..f25b5eb 100644
--- a/packages/SettingsLib/res/values-af/strings.xml
+++ b/packages/SettingsLib/res/values-af/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Beskikbaar via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tik om aan te meld"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Gekoppel, geen internet nie"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Daar kan nie by private DNS-bediener ingegaan word nie"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Beperkte verbinding"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Geen internet nie"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Aanmelding word vereis"</string>
diff --git a/packages/SettingsLib/res/values-am/strings.xml b/packages/SettingsLib/res/values-am/strings.xml
index bfd3196..6332c848 100644
--- a/packages/SettingsLib/res/values-am/strings.xml
+++ b/packages/SettingsLib/res/values-am/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"በ%1$s በኩል የሚገኝ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ለመመዝገብ መታ ያድርጉ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"ተገናኝቷል፣ ምንም በይነመረብ የለም"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"የግል ዲኤንኤስ አገልጋይ ሊደረስበት አይችልም"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"የተገደበ ግንኙነት"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ምንም በይነመረብ የለም"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ወደ መለያ መግባት ያስፈልጋል"</string>
diff --git a/packages/SettingsLib/res/values-ar/strings.xml b/packages/SettingsLib/res/values-ar/strings.xml
index 8b67b0b..8c72527 100644
--- a/packages/SettingsLib/res/values-ar/strings.xml
+++ b/packages/SettingsLib/res/values-ar/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"متوفرة عبر %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"انقر للاشتراك."</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"متصلة ولكن بلا إنترنت"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"لا يمكن الوصول إلى خادم أسماء نظام نطاقات خاص"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"اتصال محدود"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"لا يتوفر اتصال إنترنت."</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"يلزم تسجيل الدخول"</string>
diff --git a/packages/SettingsLib/res/values-as/strings.xml b/packages/SettingsLib/res/values-as/strings.xml
index f3ca337..a7ea1e0 100644
--- a/packages/SettingsLib/res/values-as/strings.xml
+++ b/packages/SettingsLib/res/values-as/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$sৰ মাধ্যমেৰে উপলব্ধ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ছাইন আপ কৰিবলৈ টিপক"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"সংযোজিত, ইণ্টাৰনেট নাই"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"ইণ্টাৰনেট সংযোগ সীমিত"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ইণ্টাৰনেট সংযোগ নাই"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ছাইন ইন কৰা দৰকাৰী"</string>
diff --git a/packages/SettingsLib/res/values-az/strings.xml b/packages/SettingsLib/res/values-az/strings.xml
index d35dfe8..cb7db78 100644
--- a/packages/SettingsLib/res/values-az/strings.xml
+++ b/packages/SettingsLib/res/values-az/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s vasitəsilə əlçatandır"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Qeydiyyatdan keçmək üçün klikləyin"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Qoşuludur, internet yoxdur"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Özəl DNS serverinə giriş mümkün deyil"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Məhdud bağlantı"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"İnternet yoxdur"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Giriş tələb olunur"</string>
diff --git a/packages/SettingsLib/res/values-b+sr+Latn/strings.xml b/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
index 448de4b..75feb32 100644
--- a/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
+++ b/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Dostupna je preko pristupne tačke %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Dodirnite da biste se registrovali"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Veza je uspostavljena, nema interneta"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Pristup privatnom DNS serveru nije uspeo"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ograničena veza"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nema interneta"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Treba da se prijavite"</string>
diff --git a/packages/SettingsLib/res/values-be/strings.xml b/packages/SettingsLib/res/values-be/strings.xml
index d68c0f3..677aa24 100644
--- a/packages/SettingsLib/res/values-be/strings.xml
+++ b/packages/SettingsLib/res/values-be/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Даступна праз %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Націсніце, каб зарэгістравацца"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Падключана, без доступу да інтэрнэту"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Не ўдалося атрымаць доступ да прыватнага DNS-сервера"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Абмежаваныя магчымасці падключэння"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Не падключана да інтэрнэту"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Трэба выканаць уваход"</string>
diff --git a/packages/SettingsLib/res/values-bg/strings.xml b/packages/SettingsLib/res/values-bg/strings.xml
index cb99f64..1620422 100644
--- a/packages/SettingsLib/res/values-bg/strings.xml
+++ b/packages/SettingsLib/res/values-bg/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Мрежата е достъпна през „%1$s“"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Докоснете, за да се регистрирате"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Установена е връзка – няма достъп до интернет"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Не може да се осъществи достъп до частния DNS сървър"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ограничена връзка"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Няма връзка с интернет"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Изисква се вход в профила"</string>
diff --git a/packages/SettingsLib/res/values-bn/strings.xml b/packages/SettingsLib/res/values-bn/strings.xml
index f2f4f52..b1e37a6 100644
--- a/packages/SettingsLib/res/values-bn/strings.xml
+++ b/packages/SettingsLib/res/values-bn/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s এর মাধ্যমে উপলব্ধ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"সাইন-আপ করতে ট্যাপ করুন"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"কানেক্ট, ইন্টারনেট নেই"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"ব্যক্তিগত ডিএনএস সার্ভার অ্যাক্সেস করা যাবে না"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"সীমিত কানেকশন"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ইন্টারনেট কানেকশন নেই"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"সাইন-ইন করা দরকার"</string>
diff --git a/packages/SettingsLib/res/values-bs/strings.xml b/packages/SettingsLib/res/values-bs/strings.xml
index 45b8dd9..911a831 100644
--- a/packages/SettingsLib/res/values-bs/strings.xml
+++ b/packages/SettingsLib/res/values-bs/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Dostupan preko %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Dodirnite za prijavu"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Povezano, nema interneta"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Nije moguće pristupiti privatnom DNS serveru"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ograničena veza"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nema internetske veze"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Potrebna je prijava"</string>
diff --git a/packages/SettingsLib/res/values-ca/strings.xml b/packages/SettingsLib/res/values-ca/strings.xml
index b624df0..58c2b67 100644
--- a/packages/SettingsLib/res/values-ca/strings.xml
+++ b/packages/SettingsLib/res/values-ca/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponible mitjançant %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toca per registrar-te"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connectada, sense Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"No es pot accedir al servidor DNS privat"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Connexió limitada"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Sense connexió a Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Cal iniciar la sessió"</string>
@@ -237,7 +238,7 @@
<string name="bluetooth_select_a2dp_codec_channel_mode_dialog_title" msgid="7234956835280563341">"Activa el còdec d\'àudio per Bluetooth\nSelecció: mode de canal"</string>
<string name="bluetooth_select_a2dp_codec_ldac_playback_quality" msgid="3619694372407843405">"Còdec LDAC d\'àudio per Bluetooth: qualitat de reproducció"</string>
<string name="bluetooth_select_a2dp_codec_ldac_playback_quality_dialog_title" msgid="6893955536658137179">"Activa l\'LDAC d\'àudio per Bluetooth\nSelecció de còdec: qualitat de reproducció"</string>
- <string name="bluetooth_select_a2dp_codec_streaming_label" msgid="5347862512596240506">"S\'està reproduint en temps real: <xliff:g id="STREAMING_PARAMETER">%1$s</xliff:g>"</string>
+ <string name="bluetooth_select_a2dp_codec_streaming_label" msgid="5347862512596240506">"Reproducció en continu: <xliff:g id="STREAMING_PARAMETER">%1$s</xliff:g>"</string>
<string name="select_private_dns_configuration_title" msgid="3700456559305263922">"DNS privat"</string>
<string name="select_private_dns_configuration_dialog_title" msgid="9221994415765826811">"Selecciona el mode de DNS privat"</string>
<string name="private_dns_mode_off" msgid="8236575187318721684">"Desactivat"</string>
diff --git a/packages/SettingsLib/res/values-cs/strings.xml b/packages/SettingsLib/res/values-cs/strings.xml
index 042e12a..3c3d5b8 100644
--- a/packages/SettingsLib/res/values-cs/strings.xml
+++ b/packages/SettingsLib/res/values-cs/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Dostupné prostřednictvím %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Klepnutím se zaregistrujete"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Připojeno, není k dispozici internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Nelze získat přístup k soukromému serveru DNS"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Omezené připojení"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nejste připojeni k internetu"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Je vyžadováno přihlášení"</string>
diff --git a/packages/SettingsLib/res/values-da/strings.xml b/packages/SettingsLib/res/values-da/strings.xml
index 4723293f..bf5d6cf 100644
--- a/packages/SettingsLib/res/values-da/strings.xml
+++ b/packages/SettingsLib/res/values-da/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Tilgængelig via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tryk for at registrere dig"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Tilsluttet – intet internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Der er ikke adgang til den private DNS-server"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Begrænset forbindelse"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Intet internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Login er påkrævet"</string>
diff --git a/packages/SettingsLib/res/values-de/strings.xml b/packages/SettingsLib/res/values-de/strings.xml
index 4f5a965..a6dbd5a 100644
--- a/packages/SettingsLib/res/values-de/strings.xml
+++ b/packages/SettingsLib/res/values-de/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Verfügbar über %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Zum Anmelden tippen"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Verbunden, kein Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Auf den privaten DNS-Server kann nicht zugegriffen werden"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Eingeschränkte Verbindung"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Kein Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Anmeldung erforderlich"</string>
diff --git a/packages/SettingsLib/res/values-el/strings.xml b/packages/SettingsLib/res/values-el/strings.xml
index 753dea8..fdba74a 100644
--- a/packages/SettingsLib/res/values-el/strings.xml
+++ b/packages/SettingsLib/res/values-el/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Διαθέσιμο μέσω %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Πατήστε για εγγραφή"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Συνδέθηκε, χωρίς σύνδεση στο διαδίκτυο"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Δεν είναι δυνατή η πρόσβαση στον ιδιωτικό διακομιστή DNS."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Περιορισμένη σύνδεση"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Δεν υπάρχει σύνδεση στο διαδίκτυο"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Απαιτείται σύνδεση"</string>
diff --git a/packages/SettingsLib/res/values-en-rAU/strings.xml b/packages/SettingsLib/res/values-en-rAU/strings.xml
index dd3d278..581adf8 100644
--- a/packages/SettingsLib/res/values-en-rAU/strings.xml
+++ b/packages/SettingsLib/res/values-en-rAU/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Available via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tap to sign up"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connected, no Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Private DNS server cannot be accessed"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Limited connection"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"No Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Sign-in required"</string>
diff --git a/packages/SettingsLib/res/values-en-rCA/strings.xml b/packages/SettingsLib/res/values-en-rCA/strings.xml
index dd3d278..581adf8 100644
--- a/packages/SettingsLib/res/values-en-rCA/strings.xml
+++ b/packages/SettingsLib/res/values-en-rCA/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Available via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tap to sign up"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connected, no Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Private DNS server cannot be accessed"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Limited connection"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"No Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Sign-in required"</string>
diff --git a/packages/SettingsLib/res/values-en-rGB/strings.xml b/packages/SettingsLib/res/values-en-rGB/strings.xml
index dd3d278..581adf8 100644
--- a/packages/SettingsLib/res/values-en-rGB/strings.xml
+++ b/packages/SettingsLib/res/values-en-rGB/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Available via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tap to sign up"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connected, no Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Private DNS server cannot be accessed"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Limited connection"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"No Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Sign-in required"</string>
diff --git a/packages/SettingsLib/res/values-en-rIN/strings.xml b/packages/SettingsLib/res/values-en-rIN/strings.xml
index dd3d278..581adf8 100644
--- a/packages/SettingsLib/res/values-en-rIN/strings.xml
+++ b/packages/SettingsLib/res/values-en-rIN/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Available via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tap to sign up"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connected, no Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Private DNS server cannot be accessed"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Limited connection"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"No Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Sign-in required"</string>
diff --git a/packages/SettingsLib/res/values-en-rXC/strings.xml b/packages/SettingsLib/res/values-en-rXC/strings.xml
index d9f61d8..e75d7bc 100644
--- a/packages/SettingsLib/res/values-en-rXC/strings.xml
+++ b/packages/SettingsLib/res/values-en-rXC/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Available via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tap to sign up"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connected, no internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Private DNS server cannot be accessed"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Limited connection"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"No internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Sign in required"</string>
diff --git a/packages/SettingsLib/res/values-es-rUS/strings.xml b/packages/SettingsLib/res/values-es-rUS/strings.xml
index 30cb0a1..97cce55 100644
--- a/packages/SettingsLib/res/values-es-rUS/strings.xml
+++ b/packages/SettingsLib/res/values-es-rUS/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponible a través de %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Presiona para registrarte"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Conectado pero sin conexión a Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"No se puede acceder al servidor DNS privado"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Conexión limitada"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Sin Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Acceso obligatorio"</string>
diff --git a/packages/SettingsLib/res/values-es/strings.xml b/packages/SettingsLib/res/values-es/strings.xml
index 32905df..7ba1a94 100644
--- a/packages/SettingsLib/res/values-es/strings.xml
+++ b/packages/SettingsLib/res/values-es/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponible a través de %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toca para registrarte"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Conexión sin Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"No se ha podido acceder al servidor DNS privado"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Conexión limitada"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Sin Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Debes iniciar sesión"</string>
diff --git a/packages/SettingsLib/res/values-et/strings.xml b/packages/SettingsLib/res/values-et/strings.xml
index 79b8a84..0e98752 100644
--- a/packages/SettingsLib/res/values-et/strings.xml
+++ b/packages/SettingsLib/res/values-et/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Saadaval üksuse %1$s kaudu"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Puudutage registreerumiseks"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Ühendatud, Interneti-ühendus puudub"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Privaatsele DNS-serverile ei pääse juurde"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Piiratud ühendus"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Interneti-ühendus puudub"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Nõutav on sisselogimine"</string>
diff --git a/packages/SettingsLib/res/values-eu/strings.xml b/packages/SettingsLib/res/values-eu/strings.xml
index 38ae9c2..872e9a5 100644
--- a/packages/SettingsLib/res/values-eu/strings.xml
+++ b/packages/SettingsLib/res/values-eu/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s bidez erabilgarri"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Sakatu erregistratzeko"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Konektatuta; ezin da atzitu Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Ezin da atzitu DNS zerbitzari pribatua"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Konexio mugatua"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Ez dago Interneteko konexiorik"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Saioa hasi behar da"</string>
diff --git a/packages/SettingsLib/res/values-fa/strings.xml b/packages/SettingsLib/res/values-fa/strings.xml
index a883d6cd..6e281fe 100644
--- a/packages/SettingsLib/res/values-fa/strings.xml
+++ b/packages/SettingsLib/res/values-fa/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"در دسترس از طریق %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"برای ثبتنام ضربه بزنید"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"متصل، بدون اینترنت"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"سرور DNS خصوصی قابل دسترسی نیست"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"اتصال محدود"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"عدم دسترسی به اینترنت"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ورود به سیستم لازم است"</string>
diff --git a/packages/SettingsLib/res/values-fi/strings.xml b/packages/SettingsLib/res/values-fi/strings.xml
index 929e101..8c3630a 100644
--- a/packages/SettingsLib/res/values-fi/strings.xml
+++ b/packages/SettingsLib/res/values-fi/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Käytettävissä seuraavan kautta: %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Rekisteröidy napauttamalla"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Yhdistetty, ei internetyhteyttä"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Ei pääsyä yksityiselle DNS-palvelimelle"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Rajallinen yhteys"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Ei internetyhteyttä"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Sisäänkirjautuminen vaaditaan"</string>
diff --git a/packages/SettingsLib/res/values-fr-rCA/strings.xml b/packages/SettingsLib/res/values-fr-rCA/strings.xml
index d3bfc96..6c5834a 100644
--- a/packages/SettingsLib/res/values-fr-rCA/strings.xml
+++ b/packages/SettingsLib/res/values-fr-rCA/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Accessible par %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toucher pour vous connecter"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connecté, aucun accès à Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Impossible d\'accéder au serveur DNS privé"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Connexion limitée"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Aucune connexion Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Connexion requise"</string>
diff --git a/packages/SettingsLib/res/values-fr/strings.xml b/packages/SettingsLib/res/values-fr/strings.xml
index b5706ce..508556e 100644
--- a/packages/SettingsLib/res/values-fr/strings.xml
+++ b/packages/SettingsLib/res/values-fr/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponible via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Appuyez ici pour vous connecter"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connecté, aucun accès à Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Impossible d\'accéder au serveur DNS privé"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Connexion limitée"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Aucun accès à Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Connexion requise"</string>
diff --git a/packages/SettingsLib/res/values-gl/strings.xml b/packages/SettingsLib/res/values-gl/strings.xml
index 2aa1604..1a3ae3d6 100644
--- a/packages/SettingsLib/res/values-gl/strings.xml
+++ b/packages/SettingsLib/res/values-gl/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Dispoñible a través de %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toca para rexistrarte"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Conexión sen Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Non se puido acceder ao servidor DNS privado"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Pouca conexión"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Non hai conexión a Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"É obrigatorio iniciar sesión"</string>
diff --git a/packages/SettingsLib/res/values-gu/strings.xml b/packages/SettingsLib/res/values-gu/strings.xml
index c2cc4c5..b3f5185 100644
--- a/packages/SettingsLib/res/values-gu/strings.xml
+++ b/packages/SettingsLib/res/values-gu/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s દ્વારા ઉપલબ્ધ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"સાઇન અપ કરવા માટે ટૅપ કરો"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"કનેક્ટ કર્યું, કોઈ ઇન્ટરનેટ નથી"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"ખાનગી DNS સર્વર ઍક્સેસ કરી શકાતા નથી"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"મર્યાદિત કનેક્શન"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ઇન્ટરનેટ ઍક્સેસ નથી"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"સાઇન ઇન આવશ્યક"</string>
diff --git a/packages/SettingsLib/res/values-hi/strings.xml b/packages/SettingsLib/res/values-hi/strings.xml
index 66c7a16..454773c 100644
--- a/packages/SettingsLib/res/values-hi/strings.xml
+++ b/packages/SettingsLib/res/values-hi/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s के द्वारा उपलब्ध"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"साइन अप करने के लिए टैप करें"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"कनेक्ट हो गया है, लेकिन इंटरनेट नहीं है"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"निजी डीएनएस सर्वर को ऐक्सेस नहीं किया जा सकता"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"सीमित कनेक्शन"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"इंटरनेट कनेक्शन नहीं है"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"साइन इन करना ज़रूरी है"</string>
diff --git a/packages/SettingsLib/res/values-hr/strings.xml b/packages/SettingsLib/res/values-hr/strings.xml
index 0fc16f8..0ec154b 100644
--- a/packages/SettingsLib/res/values-hr/strings.xml
+++ b/packages/SettingsLib/res/values-hr/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Dostupno putem %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Dodirnite da biste se registrirali"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Povezano, bez interneta"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Nije moguće pristupiti privatnom DNS poslužitelju"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ograničena veza"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nema interneta"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Obavezna prijava"</string>
diff --git a/packages/SettingsLib/res/values-hu/strings.xml b/packages/SettingsLib/res/values-hu/strings.xml
index 1388dbb..4a0af7d 100644
--- a/packages/SettingsLib/res/values-hu/strings.xml
+++ b/packages/SettingsLib/res/values-hu/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Elérhető a következőn keresztül: %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Koppintson a regisztrációhoz"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Csatlakozva, nincs internet-hozzáférés"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"A privát DNS-kiszolgálóhoz nem lehet hozzáférni"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Korlátozott kapcsolat"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nincs internetkapcsolat"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Bejelentkezést igényel"</string>
diff --git a/packages/SettingsLib/res/values-hy/strings.xml b/packages/SettingsLib/res/values-hy/strings.xml
index 2145adb..cc0ecb81 100644
--- a/packages/SettingsLib/res/values-hy/strings.xml
+++ b/packages/SettingsLib/res/values-hy/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Հասանելի է %1$s-ի միջոցով"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Հպեք՝ գրանցվելու համար"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Միացված է, սակայն ինտերնետ կապ չկա"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Մասնավոր DNS սերվերն անհասանելի է"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Սահմանափակ կապ"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Ինտերնետ կապ չկա"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Անհրաժեշտ է մուտք գործել"</string>
diff --git a/packages/SettingsLib/res/values-in/strings.xml b/packages/SettingsLib/res/values-in/strings.xml
index 7ebe6b7..0733c1f 100644
--- a/packages/SettingsLib/res/values-in/strings.xml
+++ b/packages/SettingsLib/res/values-in/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Tersedia melalui %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Ketuk untuk mendaftar"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Tersambung, tidak ada internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Server DNS pribadi tidak dapat diakses"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Koneksi terbatas"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Tidak ada internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Perlu login"</string>
diff --git a/packages/SettingsLib/res/values-is/strings.xml b/packages/SettingsLib/res/values-is/strings.xml
index eede117..28ed8fc 100644
--- a/packages/SettingsLib/res/values-is/strings.xml
+++ b/packages/SettingsLib/res/values-is/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Í boði í gegnum %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Ýttu til að skrá þig"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Tengt, enginn netaðgangur"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Ekki næst í DNS-einkaþjón"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Takmörkuð tenging"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Engin nettenging"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Innskráningar krafist"</string>
diff --git a/packages/SettingsLib/res/values-it/strings.xml b/packages/SettingsLib/res/values-it/strings.xml
index 2c64ec2..b0569b0 100644
--- a/packages/SettingsLib/res/values-it/strings.xml
+++ b/packages/SettingsLib/res/values-it/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponibile tramite %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tocca per registrarti"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Connesso, senza Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Non è possibile accedere al server DNS privato"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Connessione limitata"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nessuna connessione a Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Accesso richiesto"</string>
diff --git a/packages/SettingsLib/res/values-iw/strings.xml b/packages/SettingsLib/res/values-iw/strings.xml
index 30d6a4a..f7d4fcd 100644
--- a/packages/SettingsLib/res/values-iw/strings.xml
+++ b/packages/SettingsLib/res/values-iw/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"זמינה דרך %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"יש להקיש כדי להירשם"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"מחובר. אין אינטרנט"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"חיבור מוגבל"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"אין אינטרנט"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"נדרשת כניסה"</string>
diff --git a/packages/SettingsLib/res/values-ja/strings.xml b/packages/SettingsLib/res/values-ja/strings.xml
index 6cb5514..4d5c86c 100644
--- a/packages/SettingsLib/res/values-ja/strings.xml
+++ b/packages/SettingsLib/res/values-ja/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s経由で使用可能"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"タップして登録してください"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"接続済み、インターネット接続なし"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"プライベート DNS サーバーにアクセスできません"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"接続が制限されています"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"インターネット未接続"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ログインが必要"</string>
diff --git a/packages/SettingsLib/res/values-ka/strings.xml b/packages/SettingsLib/res/values-ka/strings.xml
index 4c78a38..20342bc 100644
--- a/packages/SettingsLib/res/values-ka/strings.xml
+++ b/packages/SettingsLib/res/values-ka/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"ხელმისაწვდომია %1$s-ით"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"შეეხეთ რეგისტრაციისთვის"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"დაკავშირებულია, ინტერნეტის გარეშე"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"პირად DNS სერვერზე წვდომა შეუძლებელია"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"შეზღუდული კავშირი"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ინტერნეტ-კავშირი არ არის"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"აუცილებელია სისტემაში შესვლა"</string>
diff --git a/packages/SettingsLib/res/values-kk/strings.xml b/packages/SettingsLib/res/values-kk/strings.xml
index ce08657..7b6d29e 100644
--- a/packages/SettingsLib/res/values-kk/strings.xml
+++ b/packages/SettingsLib/res/values-kk/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s арқылы қолжетімді"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Тіркелу үшін түртіңіз."</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Қосылған, интернет жоқ"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Жеке DNS серверіне кіру мүмкін емес."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Шектеулі байланыс"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Интернетпен байланыс жоқ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Есептік жазбаға кіру керек"</string>
diff --git a/packages/SettingsLib/res/values-km/strings.xml b/packages/SettingsLib/res/values-km/strings.xml
index 43c9282..115be8e 100644
--- a/packages/SettingsLib/res/values-km/strings.xml
+++ b/packages/SettingsLib/res/values-km/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"មានតាមរយៈ %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ចុចដើម្បីចុះឈ្មោះ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"បានភ្ជាប់ ប៉ុន្តែគ្មានអ៊ីនធឺណិតទេ"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"មិនអាចចូលប្រើម៉ាស៊ីនមេ DNS ឯកជនបានទេ"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"ការតភ្ជាប់មានកម្រិត"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"គ្មានអ៊ីនធឺណិតទេ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"តម្រូវឱ្យចូលគណនី"</string>
diff --git a/packages/SettingsLib/res/values-kn/strings.xml b/packages/SettingsLib/res/values-kn/strings.xml
index 253104b..ac8bfb1 100644
--- a/packages/SettingsLib/res/values-kn/strings.xml
+++ b/packages/SettingsLib/res/values-kn/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s ಮೂಲಕ ಲಭ್ಯವಿದೆ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ಸೈನ್ ಅಪ್ ಮಾಡಲು ಟ್ಯಾಪ್ ಮಾಡಿ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"ಸಂಪರ್ಕಪಡಿಸಲಾಗಿದೆ, ಇಂಟರ್ನೆಟ್ ಇಲ್ಲ"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"ಸೀಮಿತ ಸಂಪರ್ಕ"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ಇಂಟರ್ನೆಟ್ ಇಲ್ಲ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ಸೈನ್ ಇನ್ ಮಾಡುವ ಅಗತ್ಯವಿದೆ"</string>
diff --git a/packages/SettingsLib/res/values-ko/strings.xml b/packages/SettingsLib/res/values-ko/strings.xml
index ac44c0d..4e54310 100644
--- a/packages/SettingsLib/res/values-ko/strings.xml
+++ b/packages/SettingsLib/res/values-ko/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s을(를) 통해 사용 가능"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"탭하여 가입"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"연결됨, 인터넷 사용 불가"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"비공개 DNS 서버에 액세스할 수 없습니다."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"제한된 연결"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"인터넷 연결 없음"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"로그인 필요"</string>
diff --git a/packages/SettingsLib/res/values-ky/strings.xml b/packages/SettingsLib/res/values-ky/strings.xml
index dd1ff30..e891b5a 100644
--- a/packages/SettingsLib/res/values-ky/strings.xml
+++ b/packages/SettingsLib/res/values-ky/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s аркылуу жеткиликтүү"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Катталуу үчүн таптап коюңуз"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Туташып турат, Интернет жок"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Жеке DNS сервери жеткиликсиз"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Байланыш чектелген"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Интернет жок"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Аккаунтка кирүү талап кылынат"</string>
diff --git a/packages/SettingsLib/res/values-lo/strings.xml b/packages/SettingsLib/res/values-lo/strings.xml
index 28e8111..406a42b 100644
--- a/packages/SettingsLib/res/values-lo/strings.xml
+++ b/packages/SettingsLib/res/values-lo/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"ມີໃຫ້ຜ່ານ %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ແຕະເພື່ອສະໝັກ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"ເຊື່ອມຕໍ່ແລ້ວ, ບໍ່ມີອິນເຕີເນັດ"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"ບໍ່ສາມາດເຂົ້າເຖິງເຊີບເວີ DNS ສ່ວນຕົວໄດ້"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"ການເຊື່ອມຕໍ່ຈຳກັດ"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ບໍ່ມີອິນເຕີເນັດ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ຈຳເປັນຕ້ອງເຂົ້າສູ່ລະບົບ"</string>
diff --git a/packages/SettingsLib/res/values-lt/strings.xml b/packages/SettingsLib/res/values-lt/strings.xml
index 93fcaa7..b305fd90 100644
--- a/packages/SettingsLib/res/values-lt/strings.xml
+++ b/packages/SettingsLib/res/values-lt/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Pasiekiama naudojant „%1$s“"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Palieskite, kad prisiregistruotumėte"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Prisijungta, nėra interneto"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Privataus DNS serverio negalima pasiekti"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ribotas ryšys"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nėra interneto ryšio"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Reikia prisijungti"</string>
diff --git a/packages/SettingsLib/res/values-lv/strings.xml b/packages/SettingsLib/res/values-lv/strings.xml
index c12d097..c9e2c11 100644
--- a/packages/SettingsLib/res/values-lv/strings.xml
+++ b/packages/SettingsLib/res/values-lv/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Pieejams, izmantojot %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Pieskarieties, lai reģistrētos"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Savienojums izveidots, nav piekļuves internetam"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Nevar piekļūt privātam DNS serverim."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ierobežots savienojums"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nav piekļuves internetam"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Nepieciešama pierakstīšanās"</string>
diff --git a/packages/SettingsLib/res/values-mk/strings.xml b/packages/SettingsLib/res/values-mk/strings.xml
index 9a76a0a..e06d414 100644
--- a/packages/SettingsLib/res/values-mk/strings.xml
+++ b/packages/SettingsLib/res/values-mk/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Достапно преку %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Допрете за да се регистрирате"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Поврзана, нема интернет"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Не може да се пристапи до приватниот DNS-сервер"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ограничена врска"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Нема интернет"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Потребно е најавување"</string>
diff --git a/packages/SettingsLib/res/values-ml/strings.xml b/packages/SettingsLib/res/values-ml/strings.xml
index bb76295..36e632a 100644
--- a/packages/SettingsLib/res/values-ml/strings.xml
+++ b/packages/SettingsLib/res/values-ml/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s വഴി ലഭ്യം"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"സൈൻ അപ്പ് ചെയ്യാൻ ടാപ്പ് ചെയ്യുക"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"കണക്റ്റ് ചെയ്തു, ഇന്റർനെറ്റ് ഇല്ല"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"സ്വകാര്യ DNS സെർവർ ആക്സസ് ചെയ്യാനാവില്ല"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"പരിമിത കണക്ഷൻ"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ഇന്റർനെറ്റ് ഇല്ല"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"സൈൻ ഇൻ ചെയ്യേണ്ടത് ആവശ്യമാണ്"</string>
diff --git a/packages/SettingsLib/res/values-mn/strings.xml b/packages/SettingsLib/res/values-mn/strings.xml
index 65a8ca6..1a5a0af 100644
--- a/packages/SettingsLib/res/values-mn/strings.xml
+++ b/packages/SettingsLib/res/values-mn/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s-р боломжтой"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Бүртгүүлэхийн тулд товшино уу"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Холбогдсон хэдий ч интернет алга"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Хувийн DNS серверт хандах боломжгүй байна"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Хязгаарлагдмал холболт"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Интернэт алга"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Нэвтрэх шаардлагатай"</string>
diff --git a/packages/SettingsLib/res/values-mr/strings.xml b/packages/SettingsLib/res/values-mr/strings.xml
index 3d75ad6..7510107 100644
--- a/packages/SettingsLib/res/values-mr/strings.xml
+++ b/packages/SettingsLib/res/values-mr/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s द्वारे उपलब्ध"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"साइन अप करण्यासाठी टॅप करा"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"कनेक्ट केले, इंटरनेट नाही"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"मर्यादित कनेक्शन"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"इंटरनेट नाही"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"साइन इन करणे आवश्यक आहे"</string>
diff --git a/packages/SettingsLib/res/values-ms/strings.xml b/packages/SettingsLib/res/values-ms/strings.xml
index 0b2a4b0..82bd697 100644
--- a/packages/SettingsLib/res/values-ms/strings.xml
+++ b/packages/SettingsLib/res/values-ms/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Tersedia melalui %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Ketik untuk daftar"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Disambungkan, tiada Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Pelayan DNS peribadi tidak boleh diakses"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Sambungan terhad"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Tiada Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Log masuk diperlukan"</string>
diff --git a/packages/SettingsLib/res/values-my/strings.xml b/packages/SettingsLib/res/values-my/strings.xml
index 6fde69a..9636f06 100644
--- a/packages/SettingsLib/res/values-my/strings.xml
+++ b/packages/SettingsLib/res/values-my/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s မှတစ်ဆင့်ရနိုင်သည်"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"အကောင့်ဖွင့်ရန် တို့ပါ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"ချိတ်ဆက်ထားသည်၊ အင်တာနက်မရှိ"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"သီးသန့် ဒီအန်အက်စ် (DNS) ဆာဗာကို သုံး၍မရပါ။"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"ချိတ်ဆက်မှု ကန့်သတ်ထားသည်"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"အင်တာနက် မရှိပါ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"လက်မှတ်ထိုးဝင်ရန် လိုအပ်သည်"</string>
diff --git a/packages/SettingsLib/res/values-nb/strings.xml b/packages/SettingsLib/res/values-nb/strings.xml
index 66ad20e..99af7c8 100644
--- a/packages/SettingsLib/res/values-nb/strings.xml
+++ b/packages/SettingsLib/res/values-nb/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Tilgjengelig via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Trykk for å registrere deg"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Tilkoblet – ingen Internett-tilgang"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Den private DNS-tjeneren kan ikke nås"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Begrenset tilkobling"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Ingen internettilkobling"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Pålogging kreves"</string>
diff --git a/packages/SettingsLib/res/values-ne/strings.xml b/packages/SettingsLib/res/values-ne/strings.xml
index 860e9bf..cdf2c7d 100644
--- a/packages/SettingsLib/res/values-ne/strings.xml
+++ b/packages/SettingsLib/res/values-ne/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s मार्फत उपलब्ध"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"साइन अप गर्न ट्याप गर्नुहोस्"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"जडान गरियो तर इन्टरनेट छैन"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"निजी DNS सर्भरमाथि पहुँच प्राप्त गर्न सकिँदैन"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"सीमित जडान"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"इन्टरनेटमाथिको पहुँच छैन"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"साइन इन गर्न आवश्यक छ"</string>
diff --git a/packages/SettingsLib/res/values-nl/strings.xml b/packages/SettingsLib/res/values-nl/strings.xml
index 2fff3283..709e98d 100644
--- a/packages/SettingsLib/res/values-nl/strings.xml
+++ b/packages/SettingsLib/res/values-nl/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Beschikbaar via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tik om aan te melden"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Verbonden, geen internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Geen toegang tot privé-DNS-server"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Beperkte verbinding"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Geen internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Inloggen vereist"</string>
diff --git a/packages/SettingsLib/res/values-or/strings.xml b/packages/SettingsLib/res/values-or/strings.xml
index ff2a534..abe0198 100644
--- a/packages/SettingsLib/res/values-or/strings.xml
+++ b/packages/SettingsLib/res/values-or/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s ମାଧ୍ୟମରେ ଉପଲବ୍ଧ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ସାଇନ୍ ଅପ୍ ପାଇଁ ଟାପ୍ କରନ୍ତୁ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"ସଂଯୁକ୍ତ, ଇଣ୍ଟର୍ନେଟ୍ ନାହିଁ"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"ସୀମିତ ସଂଯୋଗ"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"କୌଣସି ଇଣ୍ଟରନେଟ୍ ନାହିଁ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ସାଇନ୍-ଇନ୍ ଆବଶ୍ୟକ"</string>
diff --git a/packages/SettingsLib/res/values-pa/strings.xml b/packages/SettingsLib/res/values-pa/strings.xml
index 0cf95753..b372185 100644
--- a/packages/SettingsLib/res/values-pa/strings.xml
+++ b/packages/SettingsLib/res/values-pa/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s ਰਾਹੀਂ ਉਪਲਬਧ"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ਸਾਈਨ-ਅੱਪ ਕਰਨ ਲਈ ਟੈਪ ਕਰੋ"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"ਕਨੈਕਟ ਕੀਤਾ, ਕੋਈ ਇੰਟਰਨੈੱਟ ਨਹੀਂ"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"ਨਿੱਜੀ ਡੋਮੇਨ ਨਾਮ ਪ੍ਰਣਾਲੀ (DNS) ਸਰਵਰ \'ਤੇ ਪਹੁੰਚ ਨਹੀਂ ਕੀਤੀ ਜਾ ਸਕੀ"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"ਸੀਮਤ ਕਨੈਕਸ਼ਨ"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ਇੰਟਰਨੈੱਟ ਨਹੀਂ"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ਸਾਈਨ-ਇਨ ਲੋੜੀਂਦਾ ਹੈ"</string>
diff --git a/packages/SettingsLib/res/values-pl/strings.xml b/packages/SettingsLib/res/values-pl/strings.xml
index caed8c3..e7a8f22 100644
--- a/packages/SettingsLib/res/values-pl/strings.xml
+++ b/packages/SettingsLib/res/values-pl/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Dostępne przez %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Kliknij, by się zarejestrować"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Połączono, brak internetu"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ograniczone połączenie"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Brak internetu"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Musisz się zalogować"</string>
diff --git a/packages/SettingsLib/res/values-pt-rBR/strings.xml b/packages/SettingsLib/res/values-pt-rBR/strings.xml
index 04a24f1a..6e75fba 100644
--- a/packages/SettingsLib/res/values-pt-rBR/strings.xml
+++ b/packages/SettingsLib/res/values-pt-rBR/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponível via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toque para se inscrever"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Conectada, sem Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Não é possível acessar o servidor DNS privado"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Conexão limitada"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Sem Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"É necessário fazer login"</string>
diff --git a/packages/SettingsLib/res/values-pt-rPT/strings.xml b/packages/SettingsLib/res/values-pt-rPT/strings.xml
index a206d1a..4ee0a17 100644
--- a/packages/SettingsLib/res/values-pt-rPT/strings.xml
+++ b/packages/SettingsLib/res/values-pt-rPT/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponível através de %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toque para se inscrever"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Ligado, sem Internet."</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Não é possível aceder ao servidor DNS."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ligação limitada"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Sem Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"É necessário iniciar sessão"</string>
diff --git a/packages/SettingsLib/res/values-pt/strings.xml b/packages/SettingsLib/res/values-pt/strings.xml
index 04a24f1a..6e75fba 100644
--- a/packages/SettingsLib/res/values-pt/strings.xml
+++ b/packages/SettingsLib/res/values-pt/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponível via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Toque para se inscrever"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Conectada, sem Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Não é possível acessar o servidor DNS privado"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Conexão limitada"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Sem Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"É necessário fazer login"</string>
diff --git a/packages/SettingsLib/res/values-ro/strings.xml b/packages/SettingsLib/res/values-ro/strings.xml
index 76a56e5..c5725d3 100644
--- a/packages/SettingsLib/res/values-ro/strings.xml
+++ b/packages/SettingsLib/res/values-ro/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Disponibilă prin %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Atingeți pentru a vă înscrie"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Conectată, fără internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Serverul DNS privat nu poate fi accesat"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Conexiune limitată"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Fără conexiune la internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Trebuie să vă conectați"</string>
diff --git a/packages/SettingsLib/res/values-ru/strings.xml b/packages/SettingsLib/res/values-ru/strings.xml
index 6e1d29a..6e98601 100644
--- a/packages/SettingsLib/res/values-ru/strings.xml
+++ b/packages/SettingsLib/res/values-ru/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Доступно через %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Нажмите, чтобы зарегистрироваться"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Подключено, без доступа к Интернету"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Доступа к частному DNS-серверу нет."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Подключение к сети ограничено."</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Нет подключения к Интернету"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Требуется выполнить вход."</string>
diff --git a/packages/SettingsLib/res/values-si/strings.xml b/packages/SettingsLib/res/values-si/strings.xml
index 186c23a..0f67a65 100644
--- a/packages/SettingsLib/res/values-si/strings.xml
+++ b/packages/SettingsLib/res/values-si/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s හරහා ලබා ගැනීමට හැකිය"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"ලියාපදිංචි වීමට තට්ටු කරන්න"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"සම්බන්ධයි, අන්තර්ජාලය නැත"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"පුද්ගලික DNS සේවාදායකයට ප්රවේශ වීමට නොහැකිය"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"සීමිත සම්බන්ධතාව"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"අන්තර්ජාලය නැත"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"පිරීම අවශ්යයි"</string>
diff --git a/packages/SettingsLib/res/values-sk/strings.xml b/packages/SettingsLib/res/values-sk/strings.xml
index 9559975..e4b4848 100644
--- a/packages/SettingsLib/res/values-sk/strings.xml
+++ b/packages/SettingsLib/res/values-sk/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"K dispozícii prostredníctvom %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Prihláste sa klepnutím"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Pripojené, žiadny internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"K súkromnému serveru DNS sa nepodarilo získať prístup"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Obmedzené pripojenie"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Žiadny internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Vyžaduje sa prihlásenie"</string>
diff --git a/packages/SettingsLib/res/values-sl/strings.xml b/packages/SettingsLib/res/values-sl/strings.xml
index 62e4ad1..3e181c2 100644
--- a/packages/SettingsLib/res/values-sl/strings.xml
+++ b/packages/SettingsLib/res/values-sl/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Na voljo prek: %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Dotaknite se, če se želite registrirati"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Vzpostavljena povezava, brez interneta"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Do zasebnega strežnika DNS ni mogoče dostopati"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Omejena povezava"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Brez internetne povezave"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Zahtevana je prijava"</string>
diff --git a/packages/SettingsLib/res/values-sq/strings.xml b/packages/SettingsLib/res/values-sq/strings.xml
index 0498f31..5380302 100644
--- a/packages/SettingsLib/res/values-sq/strings.xml
+++ b/packages/SettingsLib/res/values-sq/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"E mundshme përmes %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Trokit për t\'u regjistruar"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"U lidh, por nuk ka internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Serveri privat DNS nuk mund të qaset"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Lidhje e kufizuar"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Nuk ka internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Kërkohet identifikimi"</string>
diff --git a/packages/SettingsLib/res/values-sr/strings.xml b/packages/SettingsLib/res/values-sr/strings.xml
index 3157dee..d68c9e8 100644
--- a/packages/SettingsLib/res/values-sr/strings.xml
+++ b/packages/SettingsLib/res/values-sr/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Доступна је преко приступне тачке %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Додирните да бисте се регистровали"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Веза је успостављена, нема интернета"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Приступ приватном DNS серверу није успео"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Ограничена веза"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Нема интернета"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Треба да се пријавите"</string>
diff --git a/packages/SettingsLib/res/values-sv/strings.xml b/packages/SettingsLib/res/values-sv/strings.xml
index 31517b8..45841f0 100644
--- a/packages/SettingsLib/res/values-sv/strings.xml
+++ b/packages/SettingsLib/res/values-sv/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Tillgängligt via %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Tryck för att logga in"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Ansluten, inget internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Det går inte att komma åt den privata DNS-servern."</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Begränsad anslutning"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Inget internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Inloggning krävs"</string>
diff --git a/packages/SettingsLib/res/values-sw/strings.xml b/packages/SettingsLib/res/values-sw/strings.xml
index d73084f..a8e73d7 100644
--- a/packages/SettingsLib/res/values-sw/strings.xml
+++ b/packages/SettingsLib/res/values-sw/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Inapatikana kupitia %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Gusa ili ujisajili"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Imeunganishwa, hakuna intaneti"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Seva ya faragha ya DNS haiwezi kufikiwa"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Muunganisho hafifu"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Hakuna intaneti"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Unahitaji kuingia katika akaunti"</string>
diff --git a/packages/SettingsLib/res/values-ta/strings.xml b/packages/SettingsLib/res/values-ta/strings.xml
index de70d08..83fe954 100644
--- a/packages/SettingsLib/res/values-ta/strings.xml
+++ b/packages/SettingsLib/res/values-ta/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s வழியாகக் கிடைக்கிறது"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"பதிவு செய்யத் தட்டவும்"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"இணைக்கப்பட்டுள்ளது, ஆனால் இண்டர்நெட் இல்லை"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"தனிப்பட்ட DNS சேவையகத்தை அணுக இயலாது"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"வரம்பிற்கு உட்பட்ட இணைப்பு"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"இணைய இணைப்பு இல்லை"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"உள்நுழைய வேண்டும்"</string>
diff --git a/packages/SettingsLib/res/values-te/strings.xml b/packages/SettingsLib/res/values-te/strings.xml
index 03ae94f..ad0f673 100644
--- a/packages/SettingsLib/res/values-te/strings.xml
+++ b/packages/SettingsLib/res/values-te/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s ద్వారా అందుబాటులో ఉంది"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"సైన్ అప్ చేయడానికి నొక్కండి"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"కనెక్ట్ చేయబడింది, ఇంటర్నెట్ లేదు"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"ప్రైవేట్ DNS సర్వర్ను యాక్సెస్ చేయడం సాధ్యపడదు"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"పరిమిత కనెక్షన్"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ఇంటర్నెట్ లేదు"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"సైన్ ఇన్ చేయాలి"</string>
diff --git a/packages/SettingsLib/res/values-th/strings.xml b/packages/SettingsLib/res/values-th/strings.xml
index 1cfe45e..c9e232d 100644
--- a/packages/SettingsLib/res/values-th/strings.xml
+++ b/packages/SettingsLib/res/values-th/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"พร้อมใช้งานผ่านทาง %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"แตะเพื่อลงชื่อสมัครใช้"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"เชื่อมต่อแล้ว ไม่พบอินเทอร์เน็ต"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"เข้าถึงเซิร์ฟเวอร์ DNS ไม่ได้"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"การเชื่อมต่อที่จำกัด"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"ไม่มีอินเทอร์เน็ต"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"ต้องลงชื่อเข้าใช้"</string>
diff --git a/packages/SettingsLib/res/values-tl/strings.xml b/packages/SettingsLib/res/values-tl/strings.xml
index 8b3118b..74307f8 100644
--- a/packages/SettingsLib/res/values-tl/strings.xml
+++ b/packages/SettingsLib/res/values-tl/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Available sa pamamagitan ng %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"I-tap para mag-sign up"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Nakakonekta, walang internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Hindi ma-access ang pribadong DNS server"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Limitadong koneksyon"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Walang internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Kinakailangang mag-sign in"</string>
diff --git a/packages/SettingsLib/res/values-tr/strings.xml b/packages/SettingsLib/res/values-tr/strings.xml
index 5891c79..b95d941 100644
--- a/packages/SettingsLib/res/values-tr/strings.xml
+++ b/packages/SettingsLib/res/values-tr/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s üzerinden kullanılabilir"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Kaydolmak için dokunun"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Bağlı, internet yok"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Gizli DNS sunucusuna erişilemiyor"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Sınırlı bağlantı"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"İnternet yok"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Oturum açılması gerekiyor"</string>
diff --git a/packages/SettingsLib/res/values-uk/strings.xml b/packages/SettingsLib/res/values-uk/strings.xml
index 0bca307..61a0c3e 100644
--- a/packages/SettingsLib/res/values-uk/strings.xml
+++ b/packages/SettingsLib/res/values-uk/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Доступ через %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Торкніться, щоб увійти"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Під’єднано, але немає доступу до Інтернету"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Немає доступу до приватного DNS-сервера"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Обмежене з’єднання"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Немає Інтернету"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Потрібно ввійти в обліковий запис"</string>
diff --git a/packages/SettingsLib/res/values-ur/strings.xml b/packages/SettingsLib/res/values-ur/strings.xml
index 1e27b48..f21e891 100644
--- a/packages/SettingsLib/res/values-ur/strings.xml
+++ b/packages/SettingsLib/res/values-ur/strings.xml
@@ -43,6 +43,8 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"دستیاب بذریعہ %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"سائن اپ کے لیے تھپتھپائیں"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"منسلک، انٹرنیٹ نہیں ہے"</string>
+ <!-- no translation found for private_dns_broken (7356676011023412490) -->
+ <skip />
<string name="wifi_limited_connection" msgid="7717855024753201527">"محدود کنکشن"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"انٹرنیٹ نہیں ہے"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"سائن ان درکار ہے"</string>
diff --git a/packages/SettingsLib/res/values-uz/strings.xml b/packages/SettingsLib/res/values-uz/strings.xml
index 487100c..a0a79e3 100644
--- a/packages/SettingsLib/res/values-uz/strings.xml
+++ b/packages/SettingsLib/res/values-uz/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"%1$s orqali ishlaydi"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Yozilish uchun bosing"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Ulangan, lekin internet aloqasi yo‘q"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Xususiy DNS server ishlamayapti"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Cheklangan aloqa"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Internet yo‘q"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Hisob bilan kirish zarur"</string>
diff --git a/packages/SettingsLib/res/values-vi/strings.xml b/packages/SettingsLib/res/values-vi/strings.xml
index c247617..3723b83 100644
--- a/packages/SettingsLib/res/values-vi/strings.xml
+++ b/packages/SettingsLib/res/values-vi/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Có sẵn qua %1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Nhấn để đăng ký"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Đã kết nối, không có Internet"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Không thể truy cập máy chủ DNS riêng tư"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Kết nối giới hạn"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Không có Internet"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Yêu cầu đăng nhập"</string>
diff --git a/packages/SettingsLib/res/values-zh-rCN/strings.xml b/packages/SettingsLib/res/values-zh-rCN/strings.xml
index dddc107..f1200ee 100644
--- a/packages/SettingsLib/res/values-zh-rCN/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rCN/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"可通过%1$s连接"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"点按即可注册"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"已连接,但无法访问互联网"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"无法访问私人 DNS 服务器"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"网络连接受限"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"无法访问互联网"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"必须登录"</string>
diff --git a/packages/SettingsLib/res/values-zh-rHK/strings.xml b/packages/SettingsLib/res/values-zh-rHK/strings.xml
index 8560e22..57ab472 100644
--- a/packages/SettingsLib/res/values-zh-rHK/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rHK/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"可透過 %1$s 連線"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"輕按即可登入"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"已連線,但沒有互聯網"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"無法存取私人 DNS 伺服器"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"連線受限"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"沒有互聯網連線"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"必須登入"</string>
diff --git a/packages/SettingsLib/res/values-zh-rTW/strings.xml b/packages/SettingsLib/res/values-zh-rTW/strings.xml
index 404aa19..630619b 100644
--- a/packages/SettingsLib/res/values-zh-rTW/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rTW/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"可透過 %1$s 使用"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"輕觸即可註冊"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"已連線,沒有網際網路"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"無法存取私人 DNS 伺服器"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"連線能力受限"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"沒有網際網路連線"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"必須登入"</string>
diff --git a/packages/SettingsLib/res/values-zu/strings.xml b/packages/SettingsLib/res/values-zu/strings.xml
index 542332f..ede336e 100644
--- a/packages/SettingsLib/res/values-zu/strings.xml
+++ b/packages/SettingsLib/res/values-zu/strings.xml
@@ -43,6 +43,7 @@
<string name="available_via_passpoint" msgid="1617440946846329613">"Iyatholakala nge-%1$s"</string>
<string name="tap_to_sign_up" msgid="6449724763052579434">"Thepha ukuze ubhalisele"</string>
<string name="wifi_connected_no_internet" msgid="8202906332837777829">"Kuxhunyiwe, ayikho i-inthanethi"</string>
+ <string name="private_dns_broken" msgid="7356676011023412490">"Iseva eyimfihlo ye-DNS ayikwazi ukufinyelelwa"</string>
<string name="wifi_limited_connection" msgid="7717855024753201527">"Iqoqo elikhawulelwe"</string>
<string name="wifi_status_no_internet" msgid="5784710974669608361">"Ayikho i-inthanethi"</string>
<string name="wifi_status_sign_in_required" msgid="123517180404752756">"Ukungena ngemvume kuyadingeka"</string>
diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml
index 1f923af..66e8923 100644
--- a/packages/SettingsLib/res/values/strings.xml
+++ b/packages/SettingsLib/res/values/strings.xml
@@ -127,6 +127,9 @@
<!-- Summary for Connected wifi network without internet -->
<string name="wifi_connected_no_internet">Connected, no internet</string>
+ <!-- Summary for connected network without internet due to private dns validation failed [CHAR LIMIT=NONE] -->
+ <string name="private_dns_broken">Private DNS server cannot be accessed</string>
+
<!-- Summary for connected wifi network with partial internet connectivity [CHAR LIMIT=50] -->
<string name="wifi_limited_connection">Limited connection</string>
@@ -168,6 +171,9 @@
<!-- Speed label for very fast network speed -->
<string name="speed_label_very_fast">Very Fast</string>
+ <!-- Passpoint summary for an expired passpoint [CHAR LIMIT=40] -->
+ <string name="wifi_passpoint_expired">Expired</string>
+
<!-- Summary text separator for preferences including a short description (eg. "Fast / Connected"). -->
<string name="preference_summary_default_combination"><xliff:g id="state" example="ON">%1$s</xliff:g> / <xliff:g id="description" example="High accuracy mode">%2$s</xliff:g></string>
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 81d1ea5..ab274b5 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -50,6 +50,7 @@
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
@@ -142,6 +143,16 @@
int VERY_FAST = 30;
}
+ @IntDef({PasspointConfigurationVersion.INVALID,
+ PasspointConfigurationVersion.NO_OSU_PROVISIONED,
+ PasspointConfigurationVersion.OSU_PROVISIONED})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface PasspointConfigurationVersion {
+ int INVALID = 0;
+ int NO_OSU_PROVISIONED = 1; // R1.
+ int OSU_PROVISIONED = 2; // R2 or R3.
+ }
+
/** The underlying set of scan results comprising this AccessPoint. */
@GuardedBy("mLock")
private final ArraySet<ScanResult> mScanResults = new ArraySet<>();
@@ -176,6 +187,9 @@
static final String KEY_CARRIER_AP_EAP_TYPE = "key_carrier_ap_eap_type";
static final String KEY_CARRIER_NAME = "key_carrier_name";
static final String KEY_EAPTYPE = "eap_psktype";
+ static final String KEY_SUBSCRIPTION_EXPIRATION_TIME_IN_MILLIS =
+ "key_subscription_expiration_time_in_millis";
+ static final String KEY_PASSPOINT_CONFIGURATION_VERSION = "key_passpoint_configuration_version";
static final AtomicInteger sLastId = new AtomicInteger(0);
/*
@@ -250,6 +264,9 @@
private String mFqdn;
private String mProviderFriendlyName;
private boolean mIsRoaming = false;
+ private long mSubscriptionExpirationTimeInMillis;
+ @PasspointConfigurationVersion private int mPasspointConfigurationVersion =
+ PasspointConfigurationVersion.INVALID;
private boolean mIsCarrierAp = false;
@@ -322,6 +339,13 @@
if (savedState.containsKey(KEY_CARRIER_NAME)) {
mCarrierName = savedState.getString(KEY_CARRIER_NAME);
}
+ if (savedState.containsKey(KEY_SUBSCRIPTION_EXPIRATION_TIME_IN_MILLIS)) {
+ mSubscriptionExpirationTimeInMillis =
+ savedState.getLong(KEY_SUBSCRIPTION_EXPIRATION_TIME_IN_MILLIS);
+ }
+ if (savedState.containsKey(KEY_PASSPOINT_CONFIGURATION_VERSION)) {
+ mPasspointConfigurationVersion = savedState.getInt(KEY_PASSPOINT_CONFIGURATION_VERSION);
+ }
update(mConfig, mInfo, mNetworkInfo);
// Calculate required fields
@@ -347,6 +371,12 @@
mContext = context;
mFqdn = config.getHomeSp().getFqdn();
mProviderFriendlyName = config.getHomeSp().getFriendlyName();
+ mSubscriptionExpirationTimeInMillis = config.getSubscriptionExpirationTimeInMillis();
+ if (config.isOsuProvisioned()) {
+ mPasspointConfigurationVersion = PasspointConfigurationVersion.OSU_PROVISIONED;
+ } else {
+ mPasspointConfigurationVersion = PasspointConfigurationVersion.NO_OSU_PROVISIONED;
+ }
updateKey();
}
@@ -990,6 +1020,10 @@
return mContext.getString(R.string.saved_network, appInfo.loadLabel(pm));
}
}
+
+ if (isPasspointConfigurationR1() && isExpired()) {
+ return mContext.getString(R.string.wifi_passpoint_expired);
+ }
return "";
}
@@ -1020,6 +1054,10 @@
* Returns the summary for the AccessPoint.
*/
public String getSettingsSummary(boolean convertSavedAsDisconnected) {
+ if (isPasspointConfigurationR1() && isExpired()) {
+ return mContext.getString(R.string.wifi_passpoint_expired);
+ }
+
// Update to new summary
StringBuilder summary = new StringBuilder();
@@ -1166,6 +1204,30 @@
}
/**
+ * Return true if this AccessPoint is expired.
+ */
+ public boolean isExpired() {
+ if (mSubscriptionExpirationTimeInMillis <= 0) {
+ // Expiration time not specified.
+ return false;
+ } else {
+ return System.currentTimeMillis() >= mSubscriptionExpirationTimeInMillis;
+ }
+ }
+
+ public boolean isPasspointConfigurationR1() {
+ return mPasspointConfigurationVersion == PasspointConfigurationVersion.NO_OSU_PROVISIONED;
+ }
+
+ /**
+ * Return true if {@link PasspointConfiguration#isOsuProvisioned} is true, this may refer to R2
+ * or R3.
+ */
+ public boolean isPasspointConfigurationOsuProvisioned() {
+ return mPasspointConfigurationVersion == PasspointConfigurationVersion.OSU_PROVISIONED;
+ }
+
+ /**
* Starts the OSU Provisioning flow.
*/
public void startOsuProvisioning(@Nullable WifiManager.ActionListener connectListener) {
@@ -1263,6 +1325,9 @@
savedState.putBoolean(KEY_IS_CARRIER_AP, mIsCarrierAp);
savedState.putInt(KEY_CARRIER_AP_EAP_TYPE, mCarrierApEapType);
savedState.putString(KEY_CARRIER_NAME, mCarrierName);
+ savedState.putLong(KEY_SUBSCRIPTION_EXPIRATION_TIME_IN_MILLIS,
+ mSubscriptionExpirationTimeInMillis);
+ savedState.putInt(KEY_PASSPOINT_CONFIGURATION_VERSION, mPasspointConfigurationVersion);
}
public void setListener(AccessPointListener listener) {
@@ -1568,7 +1633,13 @@
NetworkCapabilities.NET_CAPABILITY_PARTIAL_CONNECTIVITY)) {
return context.getString(R.string.wifi_limited_connection);
} else if (!nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)) {
- return context.getString(R.string.wifi_connected_no_internet);
+ final String mode = Settings.Global.getString(context.getContentResolver(),
+ Settings.Global.PRIVATE_DNS_MODE);
+ if (nc.isPrivateDnsBroken()) {
+ return context.getString(R.string.private_dns_broken);
+ } else {
+ return context.getString(R.string.wifi_connected_no_internet);
+ }
}
}
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
index 5352936..b11585a 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
@@ -31,6 +31,7 @@
import android.net.wifi.WifiSsid;
import android.os.Handler;
import android.os.Looper;
+import android.provider.Settings;
import com.android.settingslib.R;
@@ -163,7 +164,13 @@
statusLabel = mContext.getString(R.string.wifi_limited_connection);
return;
} else if (!networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED)) {
- statusLabel = mContext.getString(R.string.wifi_status_no_internet);
+ final String mode = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.PRIVATE_DNS_MODE);
+ if (networkCapabilities.isPrivateDnsBroken()) {
+ statusLabel = mContext.getString(R.string.private_dns_broken);
+ } else {
+ statusLabel = mContext.getString(R.string.wifi_status_no_internet);
+ }
return;
}
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
index 4e6c005..658a0b5 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
@@ -93,6 +93,7 @@
if (bssid != null) {
visibility.append(" ").append(bssid);
}
+ visibility.append(" technology = ").append(info.getWifiTechnology());
visibility.append(" rssi=").append(info.getRssi());
visibility.append(" ");
visibility.append(" score=").append(info.score);
diff --git a/packages/SettingsProvider/OWNERS b/packages/SettingsProvider/OWNERS
new file mode 100644
index 0000000..2054129
--- /dev/null
+++ b/packages/SettingsProvider/OWNERS
@@ -0,0 +1,3 @@
+hackbod@google.com
+svetoslavganov@google.com
+moltmann@google.com
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 17c621e..44de09b 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -1497,21 +1497,7 @@
}
if (upgradeVersion == 94) {
- // Add wireless charging started sound setting
- if (mUserHandle == UserHandle.USER_SYSTEM) {
- db.beginTransaction();
- SQLiteStatement stmt = null;
- try {
- stmt = db.compileStatement("INSERT OR REPLACE INTO global(name,value)"
- + " VALUES(?,?);");
- loadStringSetting(stmt, Settings.Global.CHARGING_STARTED_SOUND,
- R.string.def_wireless_charging_started_sound);
- db.setTransactionSuccessful();
- } finally {
- db.endTransaction();
- if (stmt != null) stmt.close();
- }
- }
+ // charging sound moved to SettingsProvider version 184
upgradeVersion = 95;
}
@@ -2562,8 +2548,6 @@
R.string.def_car_dock_sound);
loadStringSetting(stmt, Settings.Global.CAR_UNDOCK_SOUND,
R.string.def_car_undock_sound);
- loadStringSetting(stmt, Settings.Global.CHARGING_STARTED_SOUND,
- R.string.def_wireless_charging_started_sound);
loadIntegerSetting(stmt, Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
R.integer.def_dock_audio_media_enabled);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 6bd26bf..d28c1aa 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -548,6 +548,9 @@
dumpSetting(s, p,
Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
GlobalSettingsProto.Development.FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS);
+ dumpSetting(s, p,
+ Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM,
+ GlobalSettingsProto.Development.ENABLE_SIZECOMPAT_FREEFORM);
p.end(developmentToken);
final long deviceToken = p.start(GlobalSettingsProto.DEVICE);
@@ -1347,6 +1350,9 @@
dumpSetting(s, p,
Settings.Global.CHARGING_STARTED_SOUND,
GlobalSettingsProto.Sounds.CHARGING_STARTED);
+ dumpSetting(s, p,
+ Settings.Global.WIRELESS_CHARGING_STARTED_SOUND,
+ GlobalSettingsProto.Sounds.WIRELESS_CHARGING_STARTED);
p.end(soundsToken);
final long soundTriggerToken = p.start(GlobalSettingsProto.SOUND_TRIGGER);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 0639864..fdc987f 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -1080,6 +1080,9 @@
Slog.v(LOG_TAG, "getAllConfigFlags() for " + prefix);
}
+ DeviceConfig.enforceReadPermission(getContext(),
+ prefix != null ? prefix.split("/")[0] : null);
+
synchronized (mLock) {
// Get the settings.
SettingsState settingsState = mSettingsRegistry.getSettingsLocked(
@@ -3206,7 +3209,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 183;
+ private static final int SETTINGS_VERSION = 184;
private final int mUserId;
@@ -3845,23 +3848,7 @@
}
if (currentVersion == 155) {
- // Version 156: Set the default value for CHARGING_STARTED_SOUND.
- final SettingsState globalSettings = getGlobalSettingsLocked();
- final String oldValue = globalSettings.getSettingLocked(
- Global.CHARGING_STARTED_SOUND).getValue();
- final String oldDefault = getContext().getResources().getString(
- R.string.def_wireless_charging_started_sound);
- if (TextUtils.equals(null, oldValue)
- || TextUtils.equals(oldValue, oldDefault)) {
- final String defaultValue = getContext().getResources().getString(
- R.string.def_charging_started_sound);
- if (!TextUtils.isEmpty(defaultValue)) {
- globalSettings.insertSettingLocked(
- Settings.Global.CHARGING_STARTED_SOUND, defaultValue,
- null, true, SettingsState.SYSTEM_PACKAGE_NAME);
- }
-
- }
+ // Version 156: migrated to version 184
currentVersion = 156;
}
@@ -4416,6 +4403,48 @@
currentVersion = 183;
}
+ if (currentVersion == 183) {
+ // Version 184: Set default values for WIRELESS_CHARGING_STARTED_SOUND
+ // and CHARGING_STARTED_SOUND
+ final SettingsState globalSettings = getGlobalSettingsLocked();
+
+ final String oldValueWireless = globalSettings.getSettingLocked(
+ Global.WIRELESS_CHARGING_STARTED_SOUND).getValue();
+ final String oldValueWired = globalSettings.getSettingLocked(
+ Global.CHARGING_STARTED_SOUND).getValue();
+
+ final String defaultValueWireless = getContext().getResources().getString(
+ R.string.def_wireless_charging_started_sound);
+ final String defaultValueWired = getContext().getResources().getString(
+ R.string.def_charging_started_sound);
+
+ // wireless charging sound
+ if (oldValueWireless == null
+ || TextUtils.equals(oldValueWireless, defaultValueWired)) {
+ if (!TextUtils.isEmpty(defaultValueWireless)) {
+ globalSettings.insertSettingLocked(
+ Global.WIRELESS_CHARGING_STARTED_SOUND, defaultValueWireless,
+ null /* tag */, true /* makeDefault */,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ } else if (!TextUtils.isEmpty(defaultValueWired)) {
+ // if the wireless sound is empty, use the wired charging sound
+ globalSettings.insertSettingLocked(
+ Global.WIRELESS_CHARGING_STARTED_SOUND, defaultValueWired,
+ null /* tag */, true /* makeDefault */,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ }
+
+ // wired charging sound
+ if (oldValueWired == null && !TextUtils.isEmpty(defaultValueWired)) {
+ globalSettings.insertSettingLocked(
+ Global.CHARGING_STARTED_SOUND, defaultValueWired,
+ null /* tag */, true /* makeDefault */,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ currentVersion = 184;
+ }
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index 62827bc..9255c87 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -222,6 +222,7 @@
Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
Settings.Global.DEVELOPMENT_FORCE_RTL,
+ Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
Settings.Global.DEVICE_DEMO_MODE,
Settings.Global.DEVICE_IDLE_CONSTANTS,
@@ -559,6 +560,7 @@
Settings.Global.WIFI_WATCHDOG_ON,
Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON,
Settings.Global.CHARGING_STARTED_SOUND,
+ Settings.Global.WIRELESS_CHARGING_STARTED_SOUND,
Settings.Global.WINDOW_ANIMATION_SCALE,
Settings.Global.WTF_IS_FATAL,
Settings.Global.ZEN_MODE,
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index e11c063..54e291f 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -247,23 +247,6 @@
android:exported="false" />
<receiver
- android:name=".BugreportReceiver"
- android:permission="android.permission.DUMP">
- <intent-filter>
- <action android:name="com.android.internal.intent.action.BUGREPORT_STARTED" />
- <action android:name="com.android.internal.intent.action.BUGREPORT_FINISHED" />
- </intent-filter>
- </receiver>
-
- <receiver
- android:name=".RemoteBugreportReceiver"
- android:permission="android.permission.DUMP">
- <intent-filter>
- <action android:name="com.android.internal.intent.action.REMOTE_BUGREPORT_FINISHED" />
- </intent-filter>
- </receiver>
-
- <receiver
android:name=".BugreportRequestedReceiver"
android:permission="android.permission.TRIGGER_SHELL_BUGREPORT">
<intent-filter>
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 665bde3..1b35770 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -56,16 +56,11 @@
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
-import android.os.IBinder.DeathRecipient;
-import android.os.IDumpstate;
-import android.os.IDumpstateListener;
-import android.os.IDumpstateToken;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
-import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -80,7 +75,6 @@
import android.view.ContextThemeWrapper;
import android.view.IWindowManager;
import android.view.View;
-import android.view.View.OnFocusChangeListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
@@ -122,31 +116,9 @@
import java.util.zip.ZipOutputStream;
/**
- * Service used to keep progress of bugreport processes ({@code dumpstate} and
- * {@code BugreportManager}).
+ * Service used to trigger system bugreports.
* <p>
- * There can be 2 workflows. One workflow via ({@code dumpstate}) is:
- * <ol>
- * <li>When {@code dumpstate} starts, it sends a {@code BUGREPORT_STARTED} with a sequential id,
- * its pid, and the estimated total effort.
- * <li>{@link BugreportReceiver} receives the intent and delegates it to this service.
- * <li>Upon start, this service:
- * <ol>
- * <li>Issues a system notification so user can watch the progress (which is 0% initially).
- * <li>Polls the {@link SystemProperties} for updates on the {@code dumpstate} progress.
- * <li>If the progress changed, it updates the system notification.
- * </ol>
- * <li>As {@code dumpstate} progresses, it updates the system property.
- * <li>When {@code dumpstate} finishes, it sends a {@code BUGREPORT_FINISHED} intent.
- * <li>{@link BugreportReceiver} receives the intent and delegates it to this service, which in
- * turn:
- * <ol>
- * <li>Updates the system notification so user can share the bugreport.
- * <li>Stops monitoring that {@code dumpstate} process.
- * <li>Stops itself if it doesn't have any process left to monitor.
- * </ol>
- * </ol>
- * The second workflow using Bugreport API({@code BugreportManager}) is:
+ * The workflow uses Bugreport API({@code BugreportManager}) and is as follows:
* <ol>
* <li>System apps like Settings or SysUI broadcasts {@code BUGREPORT_REQUESTED}.
* <li>{@link BugreportRequestedReceiver} receives the intent and delegates it to this service.
@@ -164,18 +136,14 @@
private static final String AUTHORITY = "com.android.shell";
- // External intents sent by dumpstate.
- static final String INTENT_BUGREPORT_STARTED =
- "com.android.internal.intent.action.BUGREPORT_STARTED";
- static final String INTENT_BUGREPORT_FINISHED =
- "com.android.internal.intent.action.BUGREPORT_FINISHED";
- static final String INTENT_REMOTE_BUGREPORT_FINISHED =
- "com.android.internal.intent.action.REMOTE_BUGREPORT_FINISHED";
-
// External intent used to trigger bugreport API.
static final String INTENT_BUGREPORT_REQUESTED =
"com.android.internal.intent.action.BUGREPORT_REQUESTED";
+ // Intent sent to notify external apps that bugreport finished
+ static final String INTENT_BUGREPORT_FINISHED =
+ "com.android.internal.intent.action.BUGREPORT_FINISHED";
+
// Internal intents used on notification actions.
static final String INTENT_BUGREPORT_CANCEL = "android.intent.action.BUGREPORT_CANCEL";
static final String INTENT_BUGREPORT_SHARE = "android.intent.action.BUGREPORT_SHARE";
@@ -188,7 +156,6 @@
static final String EXTRA_BUGREPORT_TYPE = "android.intent.extra.BUGREPORT_TYPE";
static final String EXTRA_SCREENSHOT = "android.intent.extra.SCREENSHOT";
static final String EXTRA_ID = "android.intent.extra.ID";
- static final String EXTRA_PID = "android.intent.extra.PID";
static final String EXTRA_MAX = "android.intent.extra.MAX";
static final String EXTRA_NAME = "android.intent.extra.NAME";
static final String EXTRA_TITLE = "android.intent.extra.TITLE";
@@ -218,15 +185,9 @@
*/
static final int SCREENSHOT_DELAY_SECONDS = 3;
- // TODO: will be gone once fully migrated to Binder
- /** System properties used to communicate with dumpstate progress. */
- private static final String DUMPSTATE_PREFIX = "dumpstate.";
- private static final String NAME_SUFFIX = ".name";
+ /** System property where dumpstate stores last triggered bugreport id */
private static final String PROPERTY_LAST_ID = "dumpstate.last_id";
- /** System property (and value) used to stop dumpstate. */
- // TODO: should call ActiveManager API instead
- private static final String CTL_STOP = "ctl.stop";
private static final String BUGREPORT_SERVICE = "bugreport";
/**
@@ -273,8 +234,6 @@
private File mScreenshotsDir;
- private boolean mUsingBugreportApi;
-
private BugreportManager mBugreportManager;
/**
@@ -452,9 +411,9 @@
cleanupOldFiles(MIN_KEEP_COUNT, MIN_KEEP_AGE);
final Intent intent = new Intent(INTENT_BUGREPORT_FINISHED);
intent.putExtra(EXTRA_BUGREPORT, bugreportFilePath);
- addScreenshotToIntent(intent, mInfo);
+ intent.putExtra(EXTRA_SCREENSHOT, getScreenshotForIntent(mInfo));
mContext.sendBroadcast(intent, android.Manifest.permission.DUMP);
- onBugreportFinished(mInfo.id);
+ onBugreportFinished(mInfo);
}
}
}
@@ -475,14 +434,17 @@
android.Manifest.permission.DUMP);
}
- private static void addScreenshotToIntent(Intent intent, BugreportInfo info) {
- final File screenshotFile = info.screenshotFiles.isEmpty()
- ? null : info.screenshotFiles.get(0);
- if (screenshotFile != null && screenshotFile.length() > 0) {
+ /**
+ * Checks if screenshot array is non-empty and returns the first screenshot's path. The first
+ * screenshot is the default screenshot for the bugreport types that take it.
+ */
+ private static String getScreenshotForIntent(BugreportInfo info) {
+ if (!info.screenshotFiles.isEmpty()) {
+ final File screenshotFile = info.screenshotFiles.get(0);
final String screenshotFilePath = screenshotFile.getAbsolutePath();
- intent.putExtra(EXTRA_SCREENSHOT, screenshotFilePath);
+ return screenshotFilePath;
}
- return;
+ return null;
}
private static String generateFileHash(String fileName) {
@@ -558,40 +520,24 @@
Log.v(TAG, "handleMessage(): " + dumpIntent((Intent) parcel));
final Intent intent;
if (parcel instanceof Intent) {
- // The real intent was passed to BugreportReceiver, which delegated to the service.
+ // The real intent was passed to BugreportRequestedReceiver,
+ // which delegated to the service.
intent = (Intent) parcel;
} else {
intent = (Intent) msg.obj;
}
final String action = intent.getAction();
- final int pid = intent.getIntExtra(EXTRA_PID, 0);
final int id = intent.getIntExtra(EXTRA_ID, 0);
final int max = intent.getIntExtra(EXTRA_MAX, -1);
final String name = intent.getStringExtra(EXTRA_NAME);
if (DEBUG)
- Log.v(TAG, "action: " + action + ", name: " + name + ", id: " + id + ", pid: "
- + pid + ", max: " + max);
+ Log.v(TAG, "action: " + action + ", name: " + name + ", id: " + id
+ + ", max: " + max);
switch (action) {
case INTENT_BUGREPORT_REQUESTED:
startBugreportAPI(intent);
break;
- case INTENT_BUGREPORT_STARTED:
- if (!mUsingBugreportApi && !startProgress(name, id, pid, max)) {
- stopSelfWhenDone();
- return;
- }
- break;
- case INTENT_BUGREPORT_FINISHED:
- if (!mUsingBugreportApi) {
- if (id == 0) {
- // Shouldn't happen, unless BUGREPORT_FINISHED is received
- // from a legacy, out-of-sync dumpstate process.
- Log.w(TAG, "Missing " + EXTRA_ID + " on intent " + intent);
- }
- onBugreportFinished(id, intent);
- }
- break;
case INTENT_BUGREPORT_INFO_LAUNCH:
launchBugreportInfoDialog(id);
break;
@@ -633,52 +579,12 @@
private BugreportInfo getInfo(int id) {
final BugreportInfo bugreportInfo = mBugreportInfos.get(id);
if (bugreportInfo == null) {
- Log.w(TAG, "Not monitoring process with ID " + id);
+ Log.w(TAG, "Not monitoring bugreports with ID " + id);
return null;
}
return bugreportInfo;
}
- /**
- * Creates the {@link BugreportInfo} for a process and issue a system notification to
- * indicate its progress.
- *
- * @return whether it succeeded or not.
- */
- private boolean startProgress(String name, int id, int pid, int max) {
- if (name == null) {
- Log.w(TAG, "Missing " + EXTRA_NAME + " on start intent");
- }
- if (id == -1) {
- Log.e(TAG, "Missing " + EXTRA_ID + " on start intent");
- return false;
- }
- if (pid == -1) {
- Log.e(TAG, "Missing " + EXTRA_PID + " on start intent");
- return false;
- }
- if (max <= 0) {
- Log.e(TAG, "Invalid value for extra " + EXTRA_MAX + ": " + max);
- return false;
- }
-
- final BugreportInfo info = new BugreportInfo(mContext, id, pid, name, max);
- if (mBugreportInfos.indexOfKey(id) >= 0) {
- // BUGREPORT_STARTED intent was already received; ignore it.
- Log.w(TAG, "ID " + id + " already watched");
- return true;
- }
- final DumpstateListener listener = new DumpstateListener(info);
- mBugreportInfos.put(info.id, info);
- if (listener.connect()) {
- updateProgress(info);
- return true;
- } else {
- Log.w(TAG, "not updating progress because it could not connect to dumpstate");
- return false;
- }
- }
-
private String getBugreportBaseName(@BugreportParams.BugreportMode int type) {
String buildId = SystemProperties.get("ro.build.id", "UNKNOWN_BUILD");
String deviceName = SystemProperties.get("ro.product.name", "UNKNOWN_DEVICE");
@@ -694,7 +600,6 @@
}
private void startBugreportAPI(Intent intent) {
- mUsingBugreportApi = true;
String shareTitle = intent.getStringExtra(EXTRA_TITLE);
String shareDescription = intent.getStringExtra(EXTRA_DESCRIPTION);
int bugreportType = intent.getIntExtra(EXTRA_BUGREPORT_TYPE,
@@ -702,10 +607,8 @@
String baseName = getBugreportBaseName(bugreportType);
String name = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
- // pid not used in this workflow, so setting default = 0
- BugreportInfo info = new BugreportInfo(mContext, 0 /* pid */, baseName, name,
- 100 /* max progress*/, shareTitle, shareDescription, bugreportType,
- mUsingBugreportApi);
+ BugreportInfo info = new BugreportInfo(mContext, baseName, name,
+ 100 /* max progress*/, shareTitle, shareDescription, bugreportType);
ParcelFileDescriptor bugreportFd = info.createBugreportFd();
if (bugreportFd == null) {
@@ -885,11 +788,7 @@
final BugreportInfo info = getInfo(id);
if (info != null && !info.finished) {
Log.i(TAG, "Cancelling bugreport service (ID=" + id + ") on user's request");
- if (mUsingBugreportApi) {
- mBugreportManager.cancelBugreport();
- } else {
- setSystemProperty(CTL_STOP, BUGREPORT_SERVICE);
- }
+ mBugreportManager.cancelBugreport();
deleteScreenshots(info);
}
synchronized (mLock) {
@@ -1087,94 +986,15 @@
}
/**
- * Handles the BUGREPORT_FINISHED intent sent by {@code dumpstate}.
- */
- private void onBugreportFinished(int id, Intent intent) {
- final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
- if (bugreportFile == null) {
- // Should never happen, dumpstate always set the file.
- Log.wtf(TAG, "Missing " + EXTRA_BUGREPORT + " on intent " + intent);
- return;
- }
- final int max = intent.getIntExtra(EXTRA_MAX, -1);
- final File screenshotFile = getFileExtra(intent, EXTRA_SCREENSHOT);
- final String shareTitle = intent.getStringExtra(EXTRA_TITLE);
- final String shareDescription = intent.getStringExtra(EXTRA_DESCRIPTION);
- onBugreportFinished(id, bugreportFile, screenshotFile, shareTitle, shareDescription, max);
- }
-
- /**
- * Handles the onfinish() call by BugreportCallbackImpl using the id
- */
- private void onBugreportFinished(int id) {
- BugreportInfo info = getInfo(id);
- final File bugreportFile = info.bugreportFile;
- final int max = -1; // this is to log metrics for dumpstate duration.
- File screenshotFile = info.screenshotFiles.isEmpty()
- ? null : info.screenshotFiles.get(0);
- // If the screenshot file did not get populated implies this type of bugreport does not
- // need the screenshot file; setting the file to null so that empty file doesnt get shared
- if (screenshotFile != null && screenshotFile.length() == 0) {
- if (screenshotFile.delete()) {
- Log.d(TAG, "screenshot file deleted successfully.");
- }
- info.screenshotFiles.remove(0);
- // TODO(b/136066578): Will soon stop using the below variable as it is a no-op in
- // API flow and the screenshotFile value is read from info.screenshotFiles
- screenshotFile = null;
- }
- // TODO: Since we are passing id to the function, it should be able to find the info linked
- // to the id and therefore use the value of shareTitle and shareDescription.
- onBugreportFinished(id, bugreportFile, screenshotFile, info.shareTitle,
- info.shareDescription, max);
- }
-
-
- /**
* Wraps up bugreport generation and triggers a notification to share the bugreport.
*/
- private void onBugreportFinished(int id, File bugreportFile, @Nullable File screenshotFile,
- String shareTitle, String shareDescription, int max) {
- mInfoDialog.onBugreportFinished();
- BugreportInfo info = getInfo(id);
- if (info == null) {
- // Happens when BUGREPORT_FINISHED was received without a BUGREPORT_STARTED first.
- Log.v(TAG, "Creating info for untracked ID " + id);
- info = new BugreportInfo(mContext, id);
- DumpstateListener dumpstateListener = new DumpstateListener(info);
- mBugreportInfos.put(id, info);
- }
- if (!mUsingBugreportApi) {
- // Rename in API flow happens before sending the broadcast for remote bugreport (to
- // handle renaming before sending broadcasts)
- info.renameScreenshots(mScreenshotsDir);
- // API workflow already has the bugreport file. This was required in legacy flow, when
- // FINISHED broadcast would send the final bugreport files.
- // TODO(b/136066578): Change function definition to not include bugreport/screenshot
- // file in params
- info.bugreportFile = bugreportFile;
- if (screenshotFile != null) {
- info.addScreenshot(screenshotFile);
- }
- }
-
- if (max != -1) {
- MetricsLogger.histogram(this, "dumpstate_duration", max);
- info.max = max;
- }
-
- if (!TextUtils.isEmpty(shareTitle)) {
- info.title = shareTitle;
- if (!TextUtils.isEmpty(shareDescription)) {
- info.shareDescription= shareDescription;
- }
- Log.d(TAG, "Bugreport title is " + info.title + ","
- + " shareDescription is " + info.shareDescription);
- }
+ private void onBugreportFinished(BugreportInfo info) {
+ Log.d(TAG, "Bugreport finished with title: " + info.title
+ + " and shareDescription: " + info.shareDescription);
info.finished = true;
// Stop running on foreground, otherwise share notification cannot be dismissed.
- stopForegroundWhenDone(id);
+ stopForegroundWhenDone(info.id);
triggerLocalNotification(mContext, info);
}
@@ -1214,7 +1034,11 @@
/**
* Build {@link Intent} that can be used to share the given bugreport.
*/
- private static Intent buildSendIntent(Context context, BugreportInfo info) {
+ private static Intent buildSendIntent(Context context, BugreportInfo info,
+ File screenshotsDir) {
+ // Rename files (if required) before sharing
+ info.renameBugreportFile();
+ info.renameScreenshots(screenshotsDir);
// Files are kept on private storage, so turn into Uris that we can
// grant temporary permissions for.
final Uri bugreportUri;
@@ -1300,7 +1124,7 @@
addDetailsToZipFile(info);
- final Intent sendIntent = buildSendIntent(mContext, info);
+ final Intent sendIntent = buildSendIntent(mContext, info, mScreenshotsDir);
if (sendIntent == null) {
Log.w(TAG, "Stopping progres on ID " + id + " because share intent could not be built");
synchronized (mLock) {
@@ -1628,12 +1452,11 @@
}
String action = intent.getAction();
if (action == null) {
- // Happens when BugreportReceiver calls startService...
+ // Happens when startService is called...
action = "no action";
}
final StringBuilder buffer = new StringBuilder(action).append(" extras: ");
addExtra(buffer, intent, EXTRA_ID);
- addExtra(buffer, intent, EXTRA_PID);
addExtra(buffer, intent, EXTRA_MAX);
addExtra(buffer, intent, EXTRA_NAME);
addExtra(buffer, intent, EXTRA_DESCRIPTION);
@@ -1678,15 +1501,6 @@
}
/**
- * Updates the system property used by {@code dumpstate} to rename the final bugreport files.
- */
- private boolean setBugreportNameProperty(int pid, String name) {
- Log.d(TAG, "Updating bugreport name to " + name);
- final String key = DUMPSTATE_PREFIX + pid + NAME_SUFFIX;
- return setSystemProperty(key, name);
- }
-
- /**
* Updates the user-provided details of a bugreport.
*/
private void updateBugreportInfo(int id, String name, String title, String description) {
@@ -1770,30 +1584,6 @@
private AlertDialog mDialog;
private Button mOkButton;
private int mId;
- private int mPid;
-
- /**
- * Last "committed" value of the bugreport name.
- * <p>
- * Once initially set, it's only updated when user clicks the OK button.
- */
- private String mSavedName;
-
- /**
- * Last value of the bugreport name as entered by the user.
- * <p>
- * Every time it's changed the equivalent system property is changed as well, but if the
- * user clicks CANCEL, the old value (stored on {@code mSavedName} is restored.
- * <p>
- * This logic handles the corner-case scenario where {@code dumpstate} finishes after the
- * user changed the name but didn't clicked OK yet (for example, because the user is typing
- * the description). The only drawback is that if the user changes the name while
- * {@code dumpstate} is running but clicks CANCEL after it finishes, then the final name
- * will be the one that has been canceled. But when {@code dumpstate} finishes the {code
- * name} UI is disabled and the old name restored anyways, so the user will be "alerted" of
- * such drawback.
- */
- private String mTempName;
/**
* Sets its internal state and displays the dialog.
@@ -1813,18 +1603,6 @@
mInfoName = (EditText) view.findViewById(R.id.name);
mInfoTitle = (EditText) view.findViewById(R.id.title);
mInfoDescription = (EditText) view.findViewById(R.id.description);
-
- mInfoName.setOnFocusChangeListener(new OnFocusChangeListener() {
-
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if (hasFocus) {
- return;
- }
- sanitizeName(info);
- }
- });
-
mDialog = new AlertDialog.Builder(themedContext)
.setView(view)
.setTitle(dialogTitle)
@@ -1839,15 +1617,6 @@
{
MetricsLogger.action(context,
MetricsEvent.ACTION_BUGREPORT_DETAILS_CANCELED);
- if (!mTempName.equals(mSavedName)) {
- // Must restore bugreport's name since it was changed
- // before user clicked OK.
- if (mUsingBugreportApi) {
- info.name = mSavedName;
- } else {
- setBugreportNameProperty(mPid, mSavedName);
- }
- }
}
})
.create();
@@ -1866,9 +1635,7 @@
}
// Then set fields.
- mSavedName = mTempName = info.name;
mId = info.id;
- mPid = info.pid;
if (!TextUtils.isEmpty(info.name)) {
mInfoName.setText(info.name);
}
@@ -1895,7 +1662,7 @@
@Override
public void onClick(View view) {
MetricsLogger.action(context, MetricsEvent.ACTION_BUGREPORT_DETAILS_SAVED);
- sanitizeName(info);
+ sanitizeName(info.name);
final String name = mInfoName.getText().toString();
final String title = mInfoTitle.getText().toString();
final String description = mInfoDescription.getText().toString();
@@ -1911,9 +1678,9 @@
* Sanitizes the user-provided value for the {@code name} field, automatically replacing
* invalid characters if necessary.
*/
- private void sanitizeName(BugreportInfo info) {
+ private void sanitizeName(String savedName) {
String name = mInfoName.getText().toString();
- if (name.equals(mTempName)) {
+ if (name.equals(savedName)) {
if (DEBUG) Log.v(TAG, "name didn't change, no need to sanitize: " + name);
return;
}
@@ -1933,28 +1700,6 @@
name = safeName.toString();
mInfoName.setText(name);
}
- mTempName = name;
- if (mUsingBugreportApi) {
- info.name = name;
- } else {
- // Must update system property for the cases where dumpstate finishes
- // while the user is still entering other fields (like title or
- // description)
- setBugreportNameProperty(mPid, name);
- }
- }
-
- /**
- * Notifies the dialog that the bugreport has finished so it disables the {@code name}
- * field.
- * <p>Once the bugreport is finished dumpstate has already generated the final files, so
- * changing the name would have no effect.
- */
- void onBugreportFinished() {
- if (mInfoName != null) {
- mInfoName.setEnabled(false);
- mInfoName.setText(mSavedName);
- }
}
void cancel() {
@@ -1976,18 +1721,10 @@
int id;
/**
- * {@code pid} of the {@code dumpstate} process generating the bugreport.
- * pid is unused in the API flow
- * TODO(b/136066578): Remove pid
- */
- final int pid;
-
- /**
* Prefix name of the bugreport, this is uneditable.
* The baseName consists of the string "bugreport" + deviceName + buildID
* This will end with the string "wifi"/"telephony" for wifi/telephony bugreports.
* Bugreport zip file name = "<baseName>-<name>.zip"
- * Bugreport png file name = "<baseName>-<name>.png"
*/
String baseName;
@@ -1998,6 +1735,12 @@
String name;
/**
+ * Initial value of the field name. This is required to rename the files later on, as they
+ * are created using initial value of name.
+ */
+ String initialName;
+
+ /**
* User-provided, one-line summary of the bug; when set, will be used as the subject
* of the {@link Intent#ACTION_SEND_MULTIPLE} intent.
*/
@@ -2063,12 +1806,6 @@
boolean finished;
/**
- * Whether this bugreport is using API workflow.
- * TODO(b/136066578): Remove when legacy bugreport methods are removed
- */
- boolean usingApi;
-
- /**
* Whether the details entries have been added to the bugreport yet.
*/
boolean addingDetailsToZip;
@@ -2092,42 +1829,18 @@
int type;
/**
- * Constructor for tracked bugreports - typically called upon receiving BUGREPORT_STARTED.
- */
- BugreportInfo(Context context, int id, int pid, String name, int max) {
- // bugreports triggered by STARTED broadcast do not use callback functions,
- // onFinished() callback method is the only function where type is used.
- // Set type to -1 as it is unused in this workflow.
- // This constructor will soon be removed.
- this(context, pid, "" /* dumpstate handles basename */, name, max, null, null, -1,
- false);
- this.id = id;
- }
-
- /**
* Constructor for tracked bugreports - typically called upon receiving BUGREPORT_REQUESTED.
*/
- BugreportInfo(Context context, int pid, String baseName, String name, int max,
+ BugreportInfo(Context context, String baseName, String name, int max,
@Nullable String shareTitle, @Nullable String shareDescription,
- @BugreportParams.BugreportMode int type, boolean usingApi) {
+ @BugreportParams.BugreportMode int type) {
this.context = context;
- this.pid = pid;
- this.name = name;
+ this.name = this.initialName = name;
this.max = this.realMax = max;
this.shareTitle = shareTitle == null ? "" : shareTitle;
this.shareDescription = shareDescription == null ? "" : shareDescription;
this.type = type;
this.baseName = baseName;
- this.usingApi = usingApi;
- }
-
- /**
- * Constructor for untracked bugreports - typically called upon receiving BUGREPORT_FINISHED
- * without a previous call to BUGREPORT_STARTED.
- */
- BugreportInfo(Context context, int id) {
- this(context, id, id, null, 0);
- this.finished = true;
}
ParcelFileDescriptor createBugreportFd() {
@@ -2136,17 +1849,24 @@
}
ParcelFileDescriptor createScreenshotFd() {
- File screenshotFile = new File(BUGREPORT_DIR, getFileName(this, ".png"));
+ File screenshotFile = new File(BUGREPORT_DIR, getScreenshotName("default"));
addScreenshot(screenshotFile);
return createReadWriteFile(screenshotFile);
}
/**
- * Gets the name for next screenshot file.
+ * Gets the name for next user triggered screenshot file.
*/
String getPathNextScreenshot() {
screenshotCounter ++;
- return "screenshot-" + pid + "-" + screenshotCounter + ".png";
+ return getScreenshotName(Integer.toString(screenshotCounter));
+ }
+
+ /**
+ * Gets the name for screenshot file based on the suffix that is passed.
+ */
+ String getScreenshotName(String suffix) {
+ return "screenshot-" + initialName + "-" + suffix + ".png";
}
/**
@@ -2157,7 +1877,8 @@
}
/**
- * Rename all screenshots files so that they contain the user-generated name instead of pid.
+ * Rename all screenshots files so that they contain the new {@code name} instead of the
+ * {@code initialName} if user has changed it.
*/
void renameScreenshots(File screenshotDir) {
if (TextUtils.isEmpty(name)) {
@@ -2166,22 +1887,21 @@
final List<File> renamedFiles = new ArrayList<>(screenshotFiles.size());
for (File oldFile : screenshotFiles) {
final String oldName = oldFile.getName();
- final String newName;
- if (usingApi) {
- newName = getFileName(this, ".png");
- } else {
- newName = oldName.replaceFirst(Integer.toString(pid), name);
- }
+ final String newName = oldName.replaceFirst(initialName, name);
final File newFile;
if (!newName.equals(oldName)) {
final File renamedFile = new File(screenshotDir, newName);
Log.d(TAG, "Renaming screenshot file " + oldFile + " to " + renamedFile);
newFile = oldFile.renameTo(renamedFile) ? renamedFile : oldFile;
} else {
- Log.w(TAG, "Name didn't change: " + oldName); // Shouldn't happen.
+ Log.w(TAG, "Name didn't change: " + oldName);
newFile = oldFile;
}
- renamedFiles.add(newFile);
+ if (newFile.length() > 0) {
+ renamedFiles.add(newFile);
+ } else if (newFile.delete()) {
+ Log.d(TAG, "screenshot file: " + newFile + "deleted successfully.");
+ }
}
screenshotFiles = renamedFiles;
}
@@ -2215,11 +1935,10 @@
final StringBuilder builder = new StringBuilder()
.append("\tid: ").append(id)
- .append(", pid: ").append(pid)
.append(", baseName: ").append(baseName)
.append(", name: ").append(name)
+ .append(", initialName: ").append(initialName)
.append(", finished: ").append(finished)
- .append(", usingApi: ").append(usingApi)
.append("\n\ttitle: ").append(title)
.append("\n\tdescription: ");
if (description == null) {
@@ -2250,9 +1969,9 @@
protected BugreportInfo(Parcel in) {
context = null;
id = in.readInt();
- pid = in.readInt();
baseName = in.readString();
name = in.readString();
+ initialName = in.readString();
title = in.readString();
description = in.readString();
max = in.readInt();
@@ -2269,7 +1988,6 @@
}
finished = in.readInt() == 1;
- usingApi = in.readInt() == 1;
screenshotCounter = in.readInt();
shareDescription = in.readString();
shareTitle = in.readString();
@@ -2278,9 +1996,9 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
- dest.writeInt(pid);
dest.writeString(baseName);
dest.writeString(name);
+ dest.writeString(initialName);
dest.writeString(title);
dest.writeString(description);
dest.writeInt(max);
@@ -2297,7 +2015,6 @@
}
dest.writeInt(finished ? 1 : 0);
- dest.writeInt(usingApi ? 1 : 0);
dest.writeInt(screenshotCounter);
dest.writeString(shareDescription);
dest.writeString(shareTitle);
@@ -2333,80 +2050,6 @@
}
- private final class DumpstateListener extends IDumpstateListener.Stub
- implements DeathRecipient {
-
- private final BugreportInfo info;
- private IDumpstateToken token;
-
- DumpstateListener(BugreportInfo info) {
- this.info = info;
- }
-
- /**
- * Connects to the {@code dumpstate} binder to receive updates.
- */
- boolean connect() {
- if (token != null) {
- Log.d(TAG, "connect(): " + info.id + " already connected");
- return true;
- }
- final IBinder service = ServiceManager.getService("dumpstate");
- if (service == null) {
- Log.d(TAG, "dumpstate service not bound yet");
- return true;
- }
- final IDumpstate dumpstate = IDumpstate.Stub.asInterface(service);
- try {
- token = dumpstate.setListener("Shell", this, /* perSectionDetails= */ false);
- if (token != null) {
- token.asBinder().linkToDeath(this, 0);
- }
- } catch (Exception e) {
- Log.e(TAG, "Could not set dumpstate listener: " + e);
- }
- return token != null;
- }
-
- @Override
- public void binderDied() {
- if (!info.finished) {
- // TODO: linkToDeath() might be called BEFORE Shell received the
- // BUGREPORT_FINISHED broadcast, in which case the statements below
- // spam logcat (but are harmless).
- // The right, long-term solution is to provide an onFinished() callback
- // on IDumpstateListener and call it instead of using a broadcast.
- Log.w(TAG, "Dumpstate process died:\n" + info);
- synchronized (mLock) {
- stopProgressLocked(info.id);
- }
- }
- token.asBinder().unlinkToDeath(this, 0);
- }
-
- @Override
- public void onProgress(int progress) throws RemoteException {
- synchronized (mLock) {
- checkProgressUpdatedLocked(info, progress);
- }
- }
-
- @Override
- public void onError(int errorCode) throws RemoteException {
- // TODO(b/111441001): implement
- }
-
- @Override
- public void onFinished() throws RemoteException {
- // TODO(b/111441001): implement
- }
-
- public void dump(String prefix, PrintWriter pw) {
- pw.print(prefix); pw.print("token: "); pw.println(token);
- }
-
- }
-
@GuardedBy("mLock")
private void checkProgressUpdatedLocked(BugreportInfo info, int progress) {
if (progress > CAPPED_PROGRESS) {
@@ -2418,11 +2061,11 @@
private void updateProgressInfo(BugreportInfo info, int progress, int max) {
if (DEBUG) {
if (progress != info.progress) {
- Log.v(TAG, "Updating progress for PID " + info.pid + "(id: " + info.id
+ Log.v(TAG, "Updating progress for name " + info.name + "(id: " + info.id
+ ") from " + info.progress + " to " + progress);
}
if (max != info.max) {
- Log.v(TAG, "Updating max progress for PID " + info.pid + "(id: " + info.id
+ Log.v(TAG, "Updating max progress for name " + info.name + "(id: " + info.id
+ ") from " + info.max + " to " + max);
}
}
diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java
deleted file mode 100644
index 15ce90f..0000000
--- a/packages/Shell/src/com/android/shell/BugreportReceiver.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2013 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.shell;
-
-import static com.android.shell.BugreportProgressService.EXTRA_BUGREPORT;
-import static com.android.shell.BugreportProgressService.EXTRA_ORIGINAL_INTENT;
-import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_FINISHED;
-import static com.android.shell.BugreportProgressService.getFileExtra;
-import static com.android.shell.BugreportProgressService.dumpIntent;
-
-import java.io.File;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.FileUtils;
-import android.text.format.DateUtils;
-import android.util.Log;
-
-/**
- * Receiver that handles finished bugreports, usually by attaching them to an
- * {@link Intent#ACTION_SEND_MULTIPLE}.
- */
-public class BugreportReceiver extends BroadcastReceiver {
- private static final String TAG = "BugreportReceiver";
-
- /**
- * Always keep the newest 8 bugreport files.
- */
- private static final int MIN_KEEP_COUNT = 8;
-
- /**
- * Always keep bugreports taken in the last week.
- */
- private static final long MIN_KEEP_AGE = DateUtils.WEEK_IN_MILLIS;
-
- @Override
- public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "onReceive(): " + dumpIntent(intent));
- // Clean up older bugreports in background
- cleanupOldFiles(this, intent, INTENT_BUGREPORT_FINISHED, MIN_KEEP_COUNT, MIN_KEEP_AGE);
-
- // Delegate intent handling to service.
- Intent serviceIntent = new Intent(context, BugreportProgressService.class);
- serviceIntent.putExtra(EXTRA_ORIGINAL_INTENT, intent);
- context.startService(serviceIntent);
- }
-
- static void cleanupOldFiles(BroadcastReceiver br, Intent intent, String expectedAction,
- final int minCount, final long minAge) {
- if (!expectedAction.equals(intent.getAction())) {
- return;
- }
- final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
- if (bugreportFile == null || !bugreportFile.exists()) {
- Log.e(TAG, "Not deleting old files because file " + bugreportFile + " doesn't exist");
- return;
- }
- final PendingResult result = br.goAsync();
- new AsyncTask<Void, Void, Void>() {
- @Override
- protected Void doInBackground(Void... params) {
- try {
- FileUtils.deleteOlderFiles(bugreportFile.getParentFile(), minCount, minAge);
- } catch (RuntimeException e) {
- Log.e(TAG, "RuntimeException deleting old files", e);
- }
- result.finish();
- return null;
- }
- }.execute();
- }
-}
diff --git a/packages/Shell/src/com/android/shell/RemoteBugreportReceiver.java b/packages/Shell/src/com/android/shell/RemoteBugreportReceiver.java
deleted file mode 100644
index 634c3b4..0000000
--- a/packages/Shell/src/com/android/shell/RemoteBugreportReceiver.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2015 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.shell;
-
-import static com.android.shell.BugreportProgressService.EXTRA_BUGREPORT;
-import static com.android.shell.BugreportProgressService.INTENT_REMOTE_BUGREPORT_FINISHED;
-import static com.android.shell.BugreportProgressService.getFileExtra;
-import static com.android.shell.BugreportProgressService.getUri;
-import static com.android.shell.BugreportReceiver.cleanupOldFiles;
-
-import java.io.File;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.UserHandle;
-import android.text.format.DateUtils;
-
-/**
- * Receiver that handles finished remote bugreports, by re-sending
- * the intent with appended bugreport zip file URI.
- *
- * <p> Remote bugreport never contains a screenshot.
- */
-public class RemoteBugreportReceiver extends BroadcastReceiver {
-
- private static final String BUGREPORT_MIMETYPE = "application/vnd.android.bugreport";
-
- /** Always keep just the last remote bugreport's files around. */
- private static final int REMOTE_BUGREPORT_FILES_AMOUNT = 3;
-
- /** Always keep remote bugreport files created in the last day. */
- private static final long MIN_KEEP_AGE = DateUtils.DAY_IN_MILLIS;
-
- @Override
- public void onReceive(Context context, Intent intent) {
- cleanupOldFiles(this, intent, INTENT_REMOTE_BUGREPORT_FINISHED,
- REMOTE_BUGREPORT_FILES_AMOUNT, MIN_KEEP_AGE);
-
- final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
- final Uri bugreportUri = getUri(context, bugreportFile);
- final String bugreportHash = intent.getStringExtra(
- DevicePolicyManager.EXTRA_REMOTE_BUGREPORT_HASH);
-
- final Intent newIntent = new Intent(DevicePolicyManager.ACTION_REMOTE_BUGREPORT_DISPATCH);
- newIntent.setDataAndType(bugreportUri, BUGREPORT_MIMETYPE);
- newIntent.putExtra(DevicePolicyManager.EXTRA_REMOTE_BUGREPORT_HASH, bugreportHash);
- context.sendBroadcastAsUser(newIntent, UserHandle.SYSTEM,
- android.Manifest.permission.DUMP);
- }
-}
diff --git a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
index 3a71632..bb298e9 100644
--- a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
+++ b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
@@ -29,10 +29,8 @@
import static com.android.shell.BugreportProgressService.EXTRA_ID;
import static com.android.shell.BugreportProgressService.EXTRA_MAX;
import static com.android.shell.BugreportProgressService.EXTRA_NAME;
-import static com.android.shell.BugreportProgressService.EXTRA_PID;
import static com.android.shell.BugreportProgressService.EXTRA_SCREENSHOT;
import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_FINISHED;
-import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_STARTED;
import static com.android.shell.BugreportProgressService.SCREENSHOT_DELAY_SECONDS;
import static org.junit.Assert.assertEquals;
@@ -145,6 +143,10 @@
private static final String TITLE2 = "Master of the Universe";
private static final String DESCRIPTION = "One's description...";
private static final String DESCRIPTION2 = "...is another's treasure.";
+ // TODO(b/143130523): Fix (update) tests and add to presubmit
+ private static final String EXTRA_PID = "android.intent.extra.PID";
+ private static final String INTENT_BUGREPORT_STARTED =
+ "com.android.internal.intent.action.BUGREPORT_STARTED";
private static final String NO_DESCRIPTION = null;
private static final String NO_NAME = null;
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java
new file mode 100644
index 0000000..6650c15
--- /dev/null
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java
@@ -0,0 +1,81 @@
+/*
+ * 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.systemui.plugins;
+
+import android.annotation.Nullable;
+import android.app.PendingIntent;
+import android.graphics.drawable.Drawable;
+import android.service.notification.StatusBarNotification;
+
+import com.android.systemui.plugins.annotations.DependsOn;
+import com.android.systemui.plugins.annotations.ProvidesInterface;
+
+/** Custom logic that can extract a PeopleHub "person" from a notification. */
+@ProvidesInterface(
+ action = NotificationPersonExtractorPlugin.ACTION,
+ version = NotificationPersonExtractorPlugin.VERSION)
+@DependsOn(target = NotificationPersonExtractorPlugin.PersonData.class)
+public interface NotificationPersonExtractorPlugin extends Plugin {
+
+ String ACTION = "com.android.systemui.action.PEOPLE_HUB_PERSON_EXTRACTOR";
+ int VERSION = 1;
+
+ /**
+ * Attempts to extract a person from a notification. Returns {@code null} if one is not found.
+ */
+ @Nullable
+ PersonData extractPerson(StatusBarNotification sbn);
+
+ /**
+ * Attempts to extract a person id from a notification. Returns {@code null} if one is not
+ * found.
+ *
+ * This method can be overridden in order to provide a faster implementation.
+ */
+ @Nullable
+ default String extractPersonKey(StatusBarNotification sbn) {
+ return extractPerson(sbn).key;
+ }
+
+ /**
+ * Determines whether or not a notification should be treated as having a person. Used for
+ * appropriate positioning in the notification shade.
+ */
+ default boolean isPersonNotification(StatusBarNotification sbn) {
+ return extractPersonKey(sbn) != null;
+ }
+
+ /** A person to be surfaced in PeopleHub. */
+ @ProvidesInterface(version = PersonData.VERSION)
+ final class PersonData {
+
+ public static final int VERSION = 0;
+
+ public final String key;
+ public final CharSequence name;
+ public final Drawable avatar;
+ public final PendingIntent clickIntent;
+
+ public PersonData(String key, CharSequence name, Drawable avatar,
+ PendingIntent clickIntent) {
+ this.key = key;
+ this.name = name;
+ this.avatar = avatar;
+ this.clickIntent = clickIntent;
+ }
+ }
+}
diff --git a/packages/SystemUI/res/layout/home_controls.xml b/packages/SystemUI/res/layout/home_controls.xml
index bb971c2..b9a6a48 100644
--- a/packages/SystemUI/res/layout/home_controls.xml
+++ b/packages/SystemUI/res/layout/home_controls.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_controls_layout"
android:layout_width="match_parent"
@@ -8,6 +8,5 @@
android:visibility="gone"
android:padding="8dp"
android:layout_margin="5dp"
- android:background="?android:attr/colorBackgroundFloating"
- android:orientation="vertical">
-</LinearLayout>
+ android:background="?android:attr/colorBackgroundFloating">
+</FrameLayout>
diff --git a/packages/SystemUI/res/layout/people_strip.xml b/packages/SystemUI/res/layout/people_strip.xml
index b314db8..f0ac08b 100644
--- a/packages/SystemUI/res/layout/people_strip.xml
+++ b/packages/SystemUI/res/layout/people_strip.xml
@@ -33,10 +33,9 @@
<LinearLayout
android:id="@+id/people_list"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:paddingTop="8dp"
- android:paddingBottom="8dp"
+ android:layout_height="match_parent"
+ android:paddingTop="12dp"
+ android:paddingBottom="12dp"
android:gravity="center"
android:orientation="horizontal">
@@ -49,7 +48,7 @@
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
- android:gravity="center"
+ android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="invisible">
@@ -87,7 +86,7 @@
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
- android:gravity="center"
+ android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="invisible">
@@ -125,7 +124,7 @@
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
- android:gravity="center"
+ android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="invisible">
@@ -163,7 +162,7 @@
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
- android:gravity="center"
+ android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="invisible">
@@ -201,7 +200,7 @@
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
- android:gravity="center"
+ android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="invisible">
diff --git a/packages/SystemUI/res/layout/qqs_media_panel.xml b/packages/SystemUI/res/layout/qqs_media_panel.xml
new file mode 100644
index 0000000..1189371
--- /dev/null
+++ b/packages/SystemUI/res/layout/qqs_media_panel.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<!-- Layout for QQS media controls -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/qqs_media_controls"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:padding="10dp"
+ >
+ <!-- Top line: icon + artist name -->
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"
+ android:gravity="center"
+ >
+ <com.android.internal.widget.CachingIconView
+ android:id="@+id/icon"
+ android:layout_width="15dp"
+ android:layout_height="15dp"
+ android:layout_marginEnd="5dp"
+ />
+ <TextView
+ android:id="@+id/header_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
+ android:singleLine="true"
+ />
+ </LinearLayout>
+
+ <!-- Second line: song name -->
+ <TextView
+ android:id="@+id/header_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:fontFamily="@*android:string/config_bodyFontFamily"
+ android:gravity="center"/>
+
+ <!-- Bottom section: controls -->
+ <LinearLayout
+ android:id="@+id/media_actions"
+ android:orientation="horizontal"
+ android:layoutDirection="ltr"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ >
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action0"
+ />
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action1"
+ />
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action2"
+ />
+ </LinearLayout>
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout/qs_media_panel.xml b/packages/SystemUI/res/layout/qs_media_panel.xml
new file mode 100644
index 0000000..dd42276
--- /dev/null
+++ b/packages/SystemUI/res/layout/qs_media_panel.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<!-- Layout for media controls inside QSPanel carousel -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/qs_media_controls"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center_horizontal|fill_vertical"
+ android:padding="10dp"
+ >
+
+ <!-- placeholder for notification header -->
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/header"
+ android:padding="3dp"
+ android:layout_marginEnd="-12dp"
+ />
+
+ <!-- Top line: artist name -->
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ >
+ <TextView
+ android:id="@+id/header_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
+ android:singleLine="true"
+ />
+ </LinearLayout>
+
+ <!-- Second line: song name -->
+ <TextView
+ android:id="@+id/header_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:fontFamily="@*android:string/config_bodyFontFamily"
+ android:gravity="center"/>
+
+ <!-- Bottom section: controls -->
+ <LinearLayout
+ android:id="@+id/media_actions"
+ android:orientation="horizontal"
+ android:layoutDirection="ltr"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ >
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action0"
+ />
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action1"
+ />
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action2"
+ />
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action3"
+ />
+ <ImageButton
+ style="@android:style/Widget.Material.Button.Borderless.Small"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:padding="8dp"
+ android:layout_marginEnd="2dp"
+ android:gravity="center"
+ android:visibility="gone"
+ android:id="@+id/action4"
+ />
+ </LinearLayout>
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
index ed18dc7..e99b917 100644
--- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
@@ -43,7 +43,7 @@
<com.android.systemui.qs.QuickQSPanel
android:id="@+id/quick_qs_panel"
android:layout_width="match_parent"
- android:layout_height="48dp"
+ android:layout_height="wrap_content"
android:layout_below="@id/quick_qs_status_icons"
android:layout_marginStart="@dimen/qs_header_tile_margin_horizontal"
android:layout_marginEnd="@dimen/qs_header_tile_margin_horizontal"
diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml
index e86fb70..66a8ade 100644
--- a/packages/SystemUI/res/values-af/strings.xml
+++ b/packages/SystemUI/res/values-af/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Swerwing"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml
index fed9b05..3f02c95 100644
--- a/packages/SystemUI/res/values-am/strings.xml
+++ b/packages/SystemUI/res/values-am/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5ጂ"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5ጂ+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"በማዛወር ላይ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"ኤጅ"</string>
diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml
index b04df54..8c765ac 100644
--- a/packages/SystemUI/res/values-ar/strings.xml
+++ b/packages/SystemUI/res/values-ar/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"شبكة الجيل الرابع أو أحدث"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"شبكة 5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"شبكة 5G والأحدث"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"التجوال"</string>
<string name="data_connection_edge" msgid="871835227939216682">"شبكة EDGE"</string>
diff --git a/packages/SystemUI/res/values-as/strings.xml b/packages/SystemUI/res/values-as/strings.xml
index 7efb03c..87be3eb 100644
--- a/packages/SystemUI/res/values-as/strings.xml
+++ b/packages/SystemUI/res/values-as/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="APPLICATION">%1$s</xliff:g>ক <xliff:g id="USB_DEVICE">%2$s</xliff:g> এক্সেছ কৰিবলৈ অনুমতি দিবনে?\nএই এপ্টোক ৰেকর্ড কৰাৰ অনুমতি দিয়া হোৱা নাই কিন্তু ই এই ইউএছবি ডিভাইচটোৰ জৰিয়তে অডিঅ\' ৰেকর্ড কৰিব পাৰে।"</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g>ক <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>ত প্ৰৱেশ কৰিবলৈ অনুমতি দিবনে?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g>ক ব্যৱহাৰ কৰিবলৈ <xliff:g id="APPLICATION">%1$s</xliff:g>ক খোলেনে?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ব্যৱহাৰ কৰিবলৈ <xliff:g id="APPLICATION">%1$s</xliff:g>ক খুলিবনে?\nএই এপ্টোক ৰেকর্ড কৰাৰ অনুমতি দিয়া হোৱা নাই কিন্তু ই এই ইউএছবি ডিভাইচটোৰ জৰিয়তে অডিঅ\' ৰেকর্ড কৰিব পাৰে।"</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g>ক ব্যৱহাৰ কৰিবলৈ <xliff:g id="APPLICATION">%1$s</xliff:g>ক খোলেনে?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ইনষ্টল হৈ থকা কোনো এপে ইউএছবি সহায়ক সামগ্ৰীটো চলাব নোৱাৰে। এই সহায়ক সামগ্ৰীৰ বিষয়ে <xliff:g id="URL">%1$s</xliff:g>ৰ জৰিয়তে অধিক জানক৷"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"ইউএছবিৰ সহায়ক সামগ্ৰী"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"এলটিই"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"এলটিই+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ৰ\'মিং"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-az/strings.xml b/packages/SystemUI/res/values-az/strings.xml
index 9d85126..a756ac0 100644
--- a/packages/SystemUI/res/values-az/strings.xml
+++ b/packages/SystemUI/res/values-az/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Rominq"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-b+sr+Latn/strings.xml b/packages/SystemUI/res/values-b+sr+Latn/strings.xml
index 07c321d6..a3232e1 100644
--- a/packages/SystemUI/res/values-b+sr+Latn/strings.xml
+++ b/packages/SystemUI/res/values-b+sr+Latn/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-be/strings.xml b/packages/SystemUI/res/values-be/strings.xml
index ec73200..f97d1ec 100644
--- a/packages/SystemUI/res/values-be/strings.xml
+++ b/packages/SystemUI/res/values-be/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роўмінг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml
index 6eeae8f..856c020 100644
--- a/packages/SystemUI/res/values-bg/strings.xml
+++ b/packages/SystemUI/res/values-bg/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роуминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-bn/strings.xml b/packages/SystemUI/res/values-bn/strings.xml
index 8e4e9a1..7c3f250f 100644
--- a/packages/SystemUI/res/values-bn/strings.xml
+++ b/packages/SystemUI/res/values-bn/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"রোমিং"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-bs/strings.xml b/packages/SystemUI/res/values-bs/strings.xml
index c5f94bd..62cb309 100644
--- a/packages/SystemUI/res/values-bs/strings.xml
+++ b/packages/SystemUI/res/values-bs/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml
index 2ae91dd..18dbd2c 100644
--- a/packages/SystemUI/res/values-ca/strings.xml
+++ b/packages/SystemUI/res/values-ca/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"Vols permetre que <xliff:g id="APPLICATION">%1$s</xliff:g> accedeixi a <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nAquesta aplicació no té permís de gravació, però pot capturar àudio a través d\'aquest dispositiu USB."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"Vols permetre que <xliff:g id="APPLICATION">%1$s</xliff:g> accedeixi a <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"Vols obrir <xliff:g id="APPLICATION">%1$s</xliff:g> per gestionar <xliff:g id="USB_DEVICE">%2$s</xliff:g>?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"Vols permetre que <xliff:g id="APPLICATION">%1$s</xliff:g> accedeixi a <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nAquesta aplicació no té permís de gravació, però pot capturar àudio a través d\'aquest dispositiu USB."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"Vols obrir <xliff:g id="APPLICATION">%1$s</xliff:g> per gestionar <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"Les aplicacions instal·lades no funcionen amb l\'accessori USB. Més informació: <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"Accessori USB"</string>
@@ -111,8 +110,8 @@
<string name="accessibility_phone_button" msgid="6738112589538563574">"Telèfon"</string>
<string name="accessibility_voice_assist_button" msgid="487611083884852965">"Assistència per veu"</string>
<string name="accessibility_unlock_button" msgid="128158454631118828">"Desbloqueja"</string>
- <string name="accessibility_waiting_for_fingerprint" msgid="4808860050517462885">"S\'està esperant l\'empremta dactilar"</string>
- <string name="accessibility_unlock_without_fingerprint" msgid="7541705575183694446">"Desbloqueja sense utilitzar l\'empremta dactilar"</string>
+ <string name="accessibility_waiting_for_fingerprint" msgid="4808860050517462885">"S\'està esperant l\'empremta digital"</string>
+ <string name="accessibility_unlock_without_fingerprint" msgid="7541705575183694446">"Desbloqueja sense utilitzar l\'empremta digital"</string>
<string name="accessibility_scanning_face" msgid="769545173211758586">"S\'està escanejant la cara"</string>
<string name="accessibility_send_smart_reply" msgid="7766727839703044493">"Envia"</string>
<string name="accessibility_manage_notification" msgid="2026361503393549753">"Gestiona les notificacions"</string>
@@ -137,7 +136,7 @@
<string name="biometric_dialog_wrong_password" msgid="2343518162282889518">"Contrasenya incorrecta"</string>
<string name="biometric_dialog_credential_too_many_attempts" msgid="1556206869468265728">"Has superat el nombre d\'intents incorrectes permesos.\nTorna-ho a provar d\'aquí a <xliff:g id="NUMBER">%d</xliff:g> segons."</string>
<string name="fingerprint_dialog_touch_sensor" msgid="8511557690663181761">"Toca el sensor d\'empremtes dactilars"</string>
- <string name="accessibility_fingerprint_dialog_fingerprint_icon" msgid="3125122495414253226">"Icona d\'empremta dactilar"</string>
+ <string name="accessibility_fingerprint_dialog_fingerprint_icon" msgid="3125122495414253226">"Icona d\'empremta digital"</string>
<string name="face_dialog_looking_for_face" msgid="7049276266074494689">"S\'està cercant la teva cara…"</string>
<string name="accessibility_face_dialog_face_icon" msgid="2658119009870383490">"Icona facial"</string>
<string name="accessibility_compatibility_zoom_button" msgid="8461115318742350699">"Botó de zoom de compatibilitat."</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Itinerància"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
@@ -536,7 +532,7 @@
<string name="keyguard_indication_trust_disabled" msgid="7412534203633528135">"El dispositiu continuarà bloquejat fins que no el desbloquegis manualment."</string>
<string name="hidden_notifications_title" msgid="7139628534207443290">"Rep notificacions més ràpidament"</string>
<string name="hidden_notifications_text" msgid="2326409389088668981">"Mostra-les abans de desbloquejar"</string>
- <string name="hidden_notifications_cancel" msgid="3690709735122344913">"No"</string>
+ <string name="hidden_notifications_cancel" msgid="3690709735122344913">"No, gràcies"</string>
<string name="hidden_notifications_setup" msgid="41079514801976810">"Configura"</string>
<string name="zen_mode_and_condition" msgid="4462471036429759903">"<xliff:g id="ZEN_MODE">%1$s</xliff:g>. <xliff:g id="EXIT_CONDITION">%2$s</xliff:g>"</string>
<string name="volume_zen_end_now" msgid="6930243045593601084">"Desactiva ara"</string>
@@ -916,7 +912,7 @@
<string name="slice_permission_deny" msgid="7683681514008048807">"Denega"</string>
<string name="auto_saver_title" msgid="1217959994732964228">"Toca per programar l\'estalvi de bateria"</string>
<string name="auto_saver_text" msgid="2563289953551438248">"Activa\'l quan sigui probable que et quedis sense bateria"</string>
- <string name="no_auto_saver_action" msgid="8086002101711328500">"No"</string>
+ <string name="no_auto_saver_action" msgid="8086002101711328500">"No, gràcies"</string>
<string name="auto_saver_enabled_title" msgid="6726474226058316862">"S\'ha activat la programació de l\'estalvi de bateria"</string>
<string name="auto_saver_enabled_text" msgid="874711029884777579">"L\'estalvi de bateria s\'activarà automàticament quan el nivell de bateria sigui inferior al <xliff:g id="PERCENTAGE">%d</xliff:g>%%."</string>
<string name="open_saver_setting_action" msgid="8314624730997322529">"Configuració"</string>
diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml
index 916986f..68800f0 100644
--- a/packages/SystemUI/res/values-cs/strings.xml
+++ b/packages/SystemUI/res/values-cs/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml
index 99fa80e..d3dbc6e 100644
--- a/packages/SystemUI/res/values-da/strings.xml
+++ b/packages/SystemUI/res/values-da/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml
index aced5d7..15f7876 100644
--- a/packages/SystemUI/res/values-de/strings.xml
+++ b/packages/SystemUI/res/values-de/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml
index 044d396..d30aec9 100644
--- a/packages/SystemUI/res/values-el/strings.xml
+++ b/packages/SystemUI/res/values-el/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Περιαγωγή"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-en-rAU/strings.xml b/packages/SystemUI/res/values-en-rAU/strings.xml
index 5bf1b0f..1e50b5a 100644
--- a/packages/SystemUI/res/values-en-rAU/strings.xml
+++ b/packages/SystemUI/res/values-en-rAU/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-en-rCA/strings.xml b/packages/SystemUI/res/values-en-rCA/strings.xml
index a327151..b2a6e6a 100644
--- a/packages/SystemUI/res/values-en-rCA/strings.xml
+++ b/packages/SystemUI/res/values-en-rCA/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml
index 5bf1b0f..1e50b5a 100644
--- a/packages/SystemUI/res/values-en-rGB/strings.xml
+++ b/packages/SystemUI/res/values-en-rGB/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml
index 5bf1b0f..1e50b5a 100644
--- a/packages/SystemUI/res/values-en-rIN/strings.xml
+++ b/packages/SystemUI/res/values-en-rIN/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-en-rXC/strings.xml b/packages/SystemUI/res/values-en-rXC/strings.xml
index 15617b3..568fdb5 100644
--- a/packages/SystemUI/res/values-en-rXC/strings.xml
+++ b/packages/SystemUI/res/values-en-rXC/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml
index a69de3b..46b402e 100644
--- a/packages/SystemUI/res/values-es-rUS/strings.xml
+++ b/packages/SystemUI/res/values-es-rUS/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml
index f96f7b9..d45bf9f 100644
--- a/packages/SystemUI/res/values-es/strings.xml
+++ b/packages/SystemUI/res/values-es/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"¿Quieres que <xliff:g id="APPLICATION">%1$s</xliff:g> pueda acceder a <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nEsta aplicación no tiene permisos para grabar, pero podría captar audio a través de este dispositivo USB."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"¿Quieres permitir que <xliff:g id="APPLICATION">%1$s</xliff:g> acceda a <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"¿Quieres abrir <xliff:g id="APPLICATION">%1$s</xliff:g> para utilizar <xliff:g id="USB_DEVICE">%2$s</xliff:g>?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"¿Quieres abrir <xliff:g id="APPLICATION">%1$s</xliff:g> para gestionar <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nEsta aplicación no tiene permisos para grabar, pero puede capturar audio mediante este dispositivo USB."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"¿Quieres abrir <xliff:g id="APPLICATION">%1$s</xliff:g> para utilizar <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"Ninguna aplicación instalada funciona con este accesorio USB. Más información: <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"Accesorio USB"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5G E"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Itinerancia"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-et/strings.xml b/packages/SystemUI/res/values-et/strings.xml
index b106a01..3f7c835 100644
--- a/packages/SystemUI/res/values-et/strings.xml
+++ b/packages/SystemUI/res/values-et/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Rändlus"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-eu/strings.xml b/packages/SystemUI/res/values-eu/strings.xml
index 4e9fe245..b6730cfb 100644
--- a/packages/SystemUI/res/values-eu/strings.xml
+++ b/packages/SystemUI/res/values-eu/strings.xml
@@ -62,7 +62,7 @@
<string name="usb_debugging_always" msgid="303335496705863070">"Eman beti ordenagailu honetatik arazteko baimena"</string>
<string name="usb_debugging_allow" msgid="2272145052073254852">"Baimendu"</string>
<string name="usb_debugging_secondary_user_title" msgid="6353808721761220421">"Ez da onartzen USB arazketa"</string>
- <string name="usb_debugging_secondary_user_message" msgid="6067122453571699801">"Gailu honetan saioa hasita duen erabiltzaileak ezin du aktibatu USB arazketa. Eginbide hori erabiltzeko, aldatu erabiltzaile nagusira."</string>
+ <string name="usb_debugging_secondary_user_message" msgid="6067122453571699801">"Gailu honetan saioa hasita daukan erabiltzaileak ezin du aktibatu USB arazketa. Eginbide hori erabiltzeko, aldatu erabiltzaile nagusira."</string>
<string name="usb_contaminant_title" msgid="206854874263058490">"Desgaitu egin da USB ataka"</string>
<string name="usb_contaminant_message" msgid="7379089091591609111">"USB ataka desgaitu egin da gailua likido edo zikinkeriengandik babesteko, eta ez du hautemango osagarririk.\n\nJakinarazpen bat jasoko duzu USB ataka berriz erabiltzeko moduan dagoenean."</string>
<string name="usb_port_enabled" msgid="7906141351687694867">"USB ataka gaitu da kargagailuak eta osagarriak hautemateko"</string>
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Ibiltaritza"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml
index 1751cc9..4f04220 100644
--- a/packages/SystemUI/res/values-fa/strings.xml
+++ b/packages/SystemUI/res/values-fa/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"فراگردی"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml
index c6c90b3..63bc925 100644
--- a/packages/SystemUI/res/values-fi/strings.xml
+++ b/packages/SystemUI/res/values-fi/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml
index 01427c9..df8b8e4 100644
--- a/packages/SystemUI/res/values-fr-rCA/strings.xml
+++ b/packages/SystemUI/res/values-fr-rCA/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Itinérance"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml
index 852bd11..12e06fd0 100644
--- a/packages/SystemUI/res/values-fr/strings.xml
+++ b/packages/SystemUI/res/values-fr/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Itinérance"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-gl/strings.xml b/packages/SystemUI/res/values-gl/strings.xml
index 885302e..85f8cf4 100644
--- a/packages/SystemUI/res/values-gl/strings.xml
+++ b/packages/SystemUI/res/values-gl/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Itinerancia"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-gu/strings.xml b/packages/SystemUI/res/values-gu/strings.xml
index b3ec665..95d7f41 100644
--- a/packages/SystemUI/res/values-gu/strings.xml
+++ b/packages/SystemUI/res/values-gu/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"રોમિંગ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml
index 56117ed..c32ec38 100644
--- a/packages/SystemUI/res/values-hi/strings.xml
+++ b/packages/SystemUI/res/values-hi/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"आप <xliff:g id="APPLICATION">%1$s</xliff:g> को <xliff:g id="USB_DEVICE">%2$s</xliff:g> ऐक्सेस करने की अनुमति देना चाहते हैं?\nइस ऐप्लिकेशन को रिकॉर्ड करने की अनुमति नहीं दी गई है. हालांकि, ऐप्लिकेशन इस यूएसबी डिवाइस से ऑडियो कैप्चर कर सकता है."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g> को <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> के ऐक्सेस की अनुमति दें?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> के लिए <xliff:g id="APPLICATION">%1$s</xliff:g> खोलें?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> का इस्तेमाल करने के लिए <xliff:g id="APPLICATION">%1$s</xliff:g> को खोलना चाहते हैं?\n इस ऐप्लिकेशन को रिकॉर्ड करने की अनुमति नहीं दी गई है. हालांकि, ऐप्लिकेशन इस यूएसबी डिवाइस से ऑडियो कैप्चर कर सकता है."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> के लिए <xliff:g id="APPLICATION">%1$s</xliff:g> खोलें?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"इस USB सहायक डिवाइस के साथ कोई भी इंस्टॉल ऐप्स काम नहीं करता. इस सहायक डिवाइस के बारे में यहां ज़्यादा जानें: <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB सहायक साधन"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"एलटीई"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"रोमिंग"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml
index 96b1623..e633878 100644
--- a/packages/SystemUI/res/values-hr/strings.xml
+++ b/packages/SystemUI/res/values-hr/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G i više"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml
index bd23d4d..299e318 100644
--- a/packages/SystemUI/res/values-hu/strings.xml
+++ b/packages/SystemUI/res/values-hu/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Barangolás"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-hy/strings.xml b/packages/SystemUI/res/values-hy/strings.xml
index 2647f2f..6291d5d 100644
--- a/packages/SystemUI/res/values-hy/strings.xml
+++ b/packages/SystemUI/res/values-hy/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Ռոումինգ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index d0b1045..cf9c4e0 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-is/strings.xml b/packages/SystemUI/res/values-is/strings.xml
index 8985d27..f98b943 100644
--- a/packages/SystemUI/res/values-is/strings.xml
+++ b/packages/SystemUI/res/values-is/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Reiki"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml
index 68169ab..c08cdd3 100644
--- a/packages/SystemUI/res/values-it/strings.xml
+++ b/packages/SystemUI/res/values-it/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml
index d059489..fc0c640 100644
--- a/packages/SystemUI/res/values-iw/strings.xml
+++ b/packages/SystemUI/res/values-iw/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"האם לאפשר לאפליקציה <xliff:g id="APPLICATION">%1$s</xliff:g> גישה אל <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nאפליקציה זו לא קיבלה הרשאה להקליט אך יכולה לתעד אודיו באמצעות מכשיר USB זה."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"האם לתת לאפליקציה <xliff:g id="APPLICATION">%1$s</xliff:g> גישה אל <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"האם לפתוח את <xliff:g id="APPLICATION">%1$s</xliff:g> כדי לעבוד עם <xliff:g id="USB_DEVICE">%2$s</xliff:g>?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"לפתוח את <xliff:g id="APPLICATION">%1$s</xliff:g> לטיפול במכשיר <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nאפליקציה זו לא קיבלה הרשאה להקליט אך יכולה לתעד אודיו באמצעות מכשיר USB זה."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"האם לפתוח את <xliff:g id="APPLICATION">%1$s</xliff:g> כדי לעבוד עם <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"אין אפליקציות מותקנות הפועלות עם אביזר ה-USB. למידע נוסף על אביזר זה היכנס לכתובת <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"אביזר USB"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"+4G"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"+LTE"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"+G5"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"נדידה"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml
index e89ae5b..5759e4b 100644
--- a/packages/SystemUI/res/values-ja/strings.xml
+++ b/packages/SystemUI/res/values-ja/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ローミング"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ka/strings.xml b/packages/SystemUI/res/values-ka/strings.xml
index 50006dd..8c10ea4 100644
--- a/packages/SystemUI/res/values-ka/strings.xml
+++ b/packages/SystemUI/res/values-ka/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"როუმინგი"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-kk/strings.xml b/packages/SystemUI/res/values-kk/strings.xml
index 05e521c..c646715 100644
--- a/packages/SystemUI/res/values-kk/strings.xml
+++ b/packages/SystemUI/res/values-kk/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роуминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-km/strings.xml b/packages/SystemUI/res/values-km/strings.xml
index a628383..4f87cf1 100644
--- a/packages/SystemUI/res/values-km/strings.xml
+++ b/packages/SystemUI/res/values-km/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"រ៉ូមីង"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-kn/strings.xml b/packages/SystemUI/res/values-kn/strings.xml
index dc4674a..f208298 100644
--- a/packages/SystemUI/res/values-kn/strings.xml
+++ b/packages/SystemUI/res/values-kn/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ರೋಮಿಂಗ್"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml
index 714af0c..c57d98f 100644
--- a/packages/SystemUI/res/values-ko/strings.xml
+++ b/packages/SystemUI/res/values-ko/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G 이상"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"로밍"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ky/strings.xml b/packages/SystemUI/res/values-ky/strings.xml
index 820c6b3..b712d62 100644
--- a/packages/SystemUI/res/values-ky/strings.xml
+++ b/packages/SystemUI/res/values-ky/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роуминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-lo/strings.xml b/packages/SystemUI/res/values-lo/strings.xml
index 89d3779..7440be7 100644
--- a/packages/SystemUI/res/values-lo/strings.xml
+++ b/packages/SystemUI/res/values-lo/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ໂຣມມິງ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml
index 208f49b..4a2281d1 100644
--- a/packages/SystemUI/res/values-lt/strings.xml
+++ b/packages/SystemUI/res/values-lt/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5GE"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Tarptinklinis ryšys"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml
index a96fc3b..2505636 100644
--- a/packages/SystemUI/res/values-lv/strings.xml
+++ b/packages/SystemUI/res/values-lv/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Viesabonēšana"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-mk/strings.xml b/packages/SystemUI/res/values-mk/strings.xml
index f8dea79..d2eab61 100644
--- a/packages/SystemUI/res/values-mk/strings.xml
+++ b/packages/SystemUI/res/values-mk/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роаминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml
index 66265cb..ca79e12 100644
--- a/packages/SystemUI/res/values-ml/strings.xml
+++ b/packages/SystemUI/res/values-ml/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ആക്സസ് ചെയ്യാൻ <xliff:g id="APPLICATION">%1$s</xliff:g> എന്നതിനെ അനുവദിക്കണോ?\nഈ ആപ്പിന് റെക്കോർഡ് അനുമതി നൽകിയിട്ടില്ല, എന്നാൽ ഈ USB ഉപകരണത്തിലൂടെ ഓഡിയോ ക്യാപ്ചർ ചെയ്യാനാവും."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> ആക്സസ് ചെയ്യാൻ <xliff:g id="APPLICATION">%1$s</xliff:g>-നെ അനുവദിക്കണോ?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> കൈകാര്യം ചെയ്യാൻ <xliff:g id="APPLICATION">%1$s</xliff:g> തുറക്കണോ?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="APPLICATION">%1$s</xliff:g> തുറന്ന് <xliff:g id="USB_DEVICE">%2$s</xliff:g> കൈകാര്യം ചെയ്യണോ?\nഈ ആപ്പിന് റെക്കോർഡ് അനുമതി നൽകിയിട്ടില്ല, എന്നാൽ ഈ USB ഉപകരണത്തിലൂടെ ഓഡിയോ ക്യാപ്ചർ ചെയ്യാനാവും."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> കൈകാര്യം ചെയ്യാൻ <xliff:g id="APPLICATION">%1$s</xliff:g> തുറക്കണോ?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ഈ USB ആക്സസ്സറിയിൽ ഇൻസ്റ്റാളുചെയ്തവയൊന്നും പ്രവർത്തിക്കുന്നില്ല. <xliff:g id="URL">%1$s</xliff:g>-ൽ ഇതേക്കുറിച്ച് കൂടുതലറിയുക"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB ആക്സസ്സറി"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"റോമിംഗ്"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDG"</string>
diff --git a/packages/SystemUI/res/values-mn/strings.xml b/packages/SystemUI/res/values-mn/strings.xml
index 00e6dcb..50bb578 100644
--- a/packages/SystemUI/res/values-mn/strings.xml
+++ b/packages/SystemUI/res/values-mn/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роуминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml
index 671060b..7324c51 100644
--- a/packages/SystemUI/res/values-mr/strings.xml
+++ b/packages/SystemUI/res/values-mr/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="APPLICATION">%1$s</xliff:g> ला <xliff:g id="USB_DEVICE">%2$s</xliff:g> अॅक्सेस करण्याची अनुमती द्यायची का?\nया अॅपला रेकॉर्ड करण्याची परवानगी दिलेली नाही पण या USB डिव्हाइसद्वारे ऑडिओ कॅप्चर केला जाऊ शकतो."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g> ला <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> अॅक्सेस करण्याची अनुमती द्यायची का?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> हाताळण्यासाठी <xliff:g id="APPLICATION">%1$s</xliff:g> उघडायचे का?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> हँडल करण्यासाठी <xliff:g id="APPLICATION">%1$s</xliff:g> उघडायचे आहे का? \n या अॅपला रेकॉर्ड करण्याची परवानगी दिलेली नाही पण या USB डिव्हाइसद्वारे ऑडिओ कॅप्चर केला जाऊ शकतो."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> हाताळण्यासाठी <xliff:g id="APPLICATION">%1$s</xliff:g> उघडायचे का?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"इंस्टॉल केलेली अॅप्स या USB उपसाधनासह कार्य करत नाहीत. <xliff:g id="URL">%1$s</xliff:g> येथे या उपसाधनाविषयी अधिक जाणून घ्या"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB उपसाधन"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"४G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"५Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"१X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"रोमिंग"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ms/strings.xml b/packages/SystemUI/res/values-ms/strings.xml
index 265f161..0faaa5f 100644
--- a/packages/SystemUI/res/values-ms/strings.xml
+++ b/packages/SystemUI/res/values-ms/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Perayauan"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-my/strings.xml b/packages/SystemUI/res/values-my/strings.xml
index c06bb8c..566dc66 100644
--- a/packages/SystemUI/res/values-my/strings.xml
+++ b/packages/SystemUI/res/values-my/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ပြင်ပကွန်ရက်နှင့် ချိတ်ဆက်ခြင်း"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml
index c213b10..aabdd8b9 100644
--- a/packages/SystemUI/res/values-nb/strings.xml
+++ b/packages/SystemUI/res/values-nb/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ne/strings.xml b/packages/SystemUI/res/values-ne/strings.xml
index 8006279..ebffa2f 100644
--- a/packages/SystemUI/res/values-ne/strings.xml
+++ b/packages/SystemUI/res/values-ne/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="APPLICATION">%1$s</xliff:g> लाई <xliff:g id="USB_DEVICE">%2$s</xliff:g> माथि पहुँच राख्न अनुमति दिने हो?\nयो अनुप्रयोगलाई रेकर्ड गर्ने अनुमति प्रदान गरिएको छैन तर यसले USB यन्त्रमार्फत अडियो क्याप्चर गर्न सक्छ।"</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g> लाई <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> माथि पहुँच राख्ने अनुमति दिने हो?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> को व्यवस्थापन गर्न <xliff:g id="APPLICATION">%1$s</xliff:g> खोल्ने हो?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="APPLICATION">%1$s</xliff:g> लाई <xliff:g id="USB_DEVICE">%2$s</xliff:g> सञ्चालन गर्न खोल्ने हो?\nयो अनुप्रयोगलाई रेकर्ड गर्ने अनुमति प्रदान गरिएको छैन तर यसले USB यन्त्रमार्फत अडियो क्याप्चर गर्न सक्छ।"</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> को व्यवस्थापन गर्न <xliff:g id="APPLICATION">%1$s</xliff:g> खोल्ने हो?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"यस USB उपकरणसँग स्थापित अनुप्रयोग काम गर्दैन। यस उपकरणको बारेमा <xliff:g id="URL">%1$s</xliff:g> मा धेरै जान्नुहोस्"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB सहयोगी"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"रोमिङ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml
index 61e4c33..aa68dce 100644
--- a/packages/SystemUI/res/values-nl/strings.xml
+++ b/packages/SystemUI/res/values-nl/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5GE"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-or/strings.xml b/packages/SystemUI/res/values-or/strings.xml
index 527d69f..0985196 100644
--- a/packages/SystemUI/res/values-or/strings.xml
+++ b/packages/SystemUI/res/values-or/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ଆକ୍ସେସ୍ କରିବାକୁ <xliff:g id="APPLICATION">%1$s</xliff:g>କୁ ଅନୁମତି ଦେବେ କି?\nଏହି ଆପ୍କୁ ରେକର୍ଡ କରିବାକୁ ଅନୁମତି ଦିଆଯାଇ ନାହିଁ କିନ୍ତୁ ଏହି USB ଡିଭାଇସ୍ ଜରିଆରେ ଅଡିଓ କ୍ୟାପ୍ଟର୍ କରିପାରିବ।"</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> ଆକ୍ସେସ୍ କରିବାକୁ <xliff:g id="APPLICATION">%1$s</xliff:g>କୁ ଅନୁମତି ଦେବେ?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ନିୟନ୍ତ୍ରଣ କରିବାକୁ <xliff:g id="APPLICATION">%1$s</xliff:g> ଖୋଲିବେ?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ପରିଚାଳନା କରିବାକୁ <xliff:g id="APPLICATION">%1$s</xliff:g>କୁ ଖୋଲିବେ?\nଏହି ଆପ୍କୁ ରେକର୍ଡ କରିବାକୁ ଅନୁମତି ଦିଆଯାଇ ନାହିଁ କିନ୍ତୁ ଏହି USB ଡିଭାଇସ୍ ଜରିଆରେ, ଏହା ଅଡିଓ କ୍ୟାପ୍ଟର୍ କରିପାରିବ।"</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> ନିୟନ୍ତ୍ରଣ କରିବାକୁ <xliff:g id="APPLICATION">%1$s</xliff:g> ଖୋଲିବେ?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ଇନଷ୍ଟଲ୍ ହୋଇଥିବା କୌଣସି ଆପ୍ ଏହି USB ଆକ୍ସେସୋରୀରେ କାମ କରେନାହିଁ। ଏହି ଆକ୍ସେସୋରୀ ବିଷୟରେ <xliff:g id="URL">%1$s</xliff:g>ରେ ଅଧିକ ଜାଣନ୍ତୁ"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB ଆକ୍ସେସରୀ"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ରୋମିଙ୍ଗ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-pa/strings.xml b/packages/SystemUI/res/values-pa/strings.xml
index 18ddddf..cf7f3e9 100644
--- a/packages/SystemUI/res/values-pa/strings.xml
+++ b/packages/SystemUI/res/values-pa/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"ਕੀ <xliff:g id="APPLICATION">%1$s</xliff:g> ਨੂੰ <xliff:g id="USB_DEVICE">%2$s</xliff:g> ਤੱਕ ਪਹੁੰਚ ਕਰਨ ਦੇਣੀ ਹੈ?\nਇਸ ਐਪ ਨੂੰ ਰਿਕਾਰਡ ਕਰਨ ਦੀ ਇਜਾਜ਼ਤ ਨਹੀਂ ਦਿੱਤੀ ਗਈ ਪਰ ਇਹ USB ਡੀਵਾਈਸ ਰਾਹੀਂ ਆਡੀਓ ਕੈਪਚਰ ਕਰ ਸਕਦੀ ਹੈ।"</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"ਕੀ <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> ਤੱਕ <xliff:g id="APPLICATION">%1$s</xliff:g> ਨੂੰ ਪਹੁੰਚ ਕਰਨ ਦੇਣੀ ਹੈ?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"ਕੀ <xliff:g id="USB_DEVICE">%2$s</xliff:g> ਨੂੰ ਵਰਤਣ ਲਈ <xliff:g id="APPLICATION">%1$s</xliff:g> ਖੋਲ੍ਹਣੀ ਹੈ?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ਨੂੰ ਸੰਭਾਲਣ ਲਈ <xliff:g id="APPLICATION">%1$s</xliff:g> ਖੋਲ੍ਹੋ?\nਇਸ ਐਪ ਨੂੰ ਰਿਕਾਰਡ ਕਰਨ ਦੀ ਇਜਾਜ਼ਤ ਨਹੀਂ ਦਿੱਤੀ ਗਈ ਪਰ ਇਹ USB ਡੀਵਾਈਸ ਰਾਹੀਂ ਆਡੀਓ ਕੈਪਚਰ ਕਰ ਸਕਦੀ ਹੈ।"</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"ਕੀ <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> ਨੂੰ ਵਰਤਣ ਲਈ <xliff:g id="APPLICATION">%1$s</xliff:g> ਖੋਲ੍ਹਣੀ ਹੈ?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ਕੋਈ ਇੰਸਟੌਲ ਕੀਤੇ ਐਪਸ ਇਸ USB ਐਕਸੈਸਰੀ ਨਾਲ ਕੰਮ ਨਹੀਂ ਕਰਦੇ। <xliff:g id="URL">%1$s</xliff:g> ਤੇ ਇਸ ਐਕਸੈਸਰੀ ਬਾਰੇ ਹੋਰ ਜਾਣੋ"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB ਐਕਸੈਸਰੀ"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ਰੋਮਿੰਗ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml
index 44b4112..dc79963 100644
--- a/packages/SystemUI/res/values-pl/strings.xml
+++ b/packages/SystemUI/res/values-pl/strings.xml
@@ -188,11 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <!-- String.format failed for translation -->
- <!-- no translation found for data_connection_5ge (4699478963278829331) -->
- <skip />
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml
index 57d64f5..a9a0309 100644
--- a/packages/SystemUI/res/values-pt-rBR/strings.xml
+++ b/packages/SystemUI/res/values-pt-rBR/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index 6c80211..ef59a5e 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index 57d64f5..a9a0309 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml
index a6bd29b..a4618d3 100644
--- a/packages/SystemUI/res/values-ro/strings.xml
+++ b/packages/SystemUI/res/values-ro/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml
index 3459440..9574f0c 100644
--- a/packages/SystemUI/res/values-ru/strings.xml
+++ b/packages/SystemUI/res/values-ru/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5GE"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роуминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-si/strings.xml b/packages/SystemUI/res/values-si/strings.xml
index ab3dc222..2876eb9 100644
--- a/packages/SystemUI/res/values-si/strings.xml
+++ b/packages/SystemUI/res/values-si/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"රෝමිං"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml
index aa004b4..a969932 100644
--- a/packages/SystemUI/res/values-sk/strings.xml
+++ b/packages/SystemUI/res/values-sk/strings.xml
@@ -50,7 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"Povoliť aplikácii <xliff:g id="APPLICATION">%1$s</xliff:g> pristupovať k zariadeniu <xliff:g id="USB_DEVICE">%2$s</xliff:g>?\nTejto aplikácii nebolo udelené povolenie na nahrávanie, môže však snímať zvuk cez toto zariadenie USB."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"Povoliť aplikácii <xliff:g id="APPLICATION">%1$s</xliff:g> prístup k zariadeniu <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"Otvoriť aplikáciu <xliff:g id="APPLICATION">%1$s</xliff:g> na použitie zariadenia <xliff:g id="USB_DEVICE">%2$s</xliff:g>?"</string>
- <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"Chcete spracovávať zariadenie <xliff:g id="USB_DEVICE">%2$s</xliff:g> pomocou aplikácie <xliff:g id="APPLICATION">%1$s</xliff:g>?\nTejto aplikácii nebolo udelené povolenie na nahrávanie, ale môže nasnímať zvuk cez toto zariadenie USB."</string>
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"Chcete otvoriť aplikáciu <xliff:g id="APPLICATION">%1$s</xliff:g> na správu zariadenia <xliff:g id="USB_DEVICE">%2$s</xliff:g> ?\nTejto aplikácii nebolo udelené povolenie na nahrávanie, ale môže nasnímať zvuk cez toto zariadenie USB."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"Otvoriť aplikáciu <xliff:g id="APPLICATION">%1$s</xliff:g> na použitie zariadenia <xliff:g id="USB_ACCESSORY">%2$s</xliff:g>?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"S týmto zariad. USB nefunguje žiadna nainštal. aplikácia. Ďalšie informácie na <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"Periférne zariadenie USB"</string>
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml
index 03fa751..9e4045f 100644
--- a/packages/SystemUI/res/values-sl/strings.xml
+++ b/packages/SystemUI/res/values-sl/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Gostovanje"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml
index 21915c9..6ce621c 100644
--- a/packages/SystemUI/res/values-sq/strings.xml
+++ b/packages/SystemUI/res/values-sq/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml
index 64ab59b0..50775d9 100644
--- a/packages/SystemUI/res/values-sr/strings.xml
+++ b/packages/SystemUI/res/values-sr/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роминг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml
index 0a65cc7..c7fb27c 100644
--- a/packages/SystemUI/res/values-sv/strings.xml
+++ b/packages/SystemUI/res/values-sv/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5GE"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml
index 48c1fab..12851eb 100644
--- a/packages/SystemUI/res/values-sw/strings.xml
+++ b/packages/SystemUI/res/values-sw/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Mitandao ya ng\'ambo"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ta/strings.xml b/packages/SystemUI/res/values-ta/strings.xml
index 7263bf6..0d49f27 100644
--- a/packages/SystemUI/res/values-ta/strings.xml
+++ b/packages/SystemUI/res/values-ta/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"ரோமிங்"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-te/strings.xml b/packages/SystemUI/res/values-te/strings.xml
index af330f18f..1600df7 100644
--- a/packages/SystemUI/res/values-te/strings.xml
+++ b/packages/SystemUI/res/values-te/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="USB_DEVICE">%2$s</xliff:g>యాక్సెస్ చేయడానికి <xliff:g id="APPLICATION">%1$s</xliff:g>ను అనుమతించాలా?\nఈ యాప్నకు రికార్డ్ చేసే అనుమతి మంజూరు చేయబడలేదు, కానీ ఈ USB పరికరం ద్వారా ఆడియోను క్యాప్చర్ చేయగలదు."</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g>ని యాక్సెస్ చేయడానికి <xliff:g id="APPLICATION">%1$s</xliff:g>ని అనుమతించాలా?"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g>ని నిర్వహించడానికి <xliff:g id="APPLICATION">%1$s</xliff:g>ని తెరవాలా?"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g>ని హ్యాండిల్ చేయడానికి <xliff:g id="APPLICATION">%1$s</xliff:g>ను తెరవాలా?\nఈ యాప్కు రికార్డ్ చేసే అనుమతి మంజూరు కాలేదు, అయినా ఈ USB పరికరం ద్వారా ఆడియోను క్యాప్చర్ చేయగలదు."</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g>ని నిర్వహించడానికి <xliff:g id="APPLICATION">%1$s</xliff:g>ని తెరవాలా?"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ఈ USB ఉపకరణంతో ఇన్స్టాల్ చేయబడిన అనువర్తనాలు ఏవీ పని చేయవు. ఈ ఉపకరణం గురించి <xliff:g id="URL">%1$s</xliff:g>లో మరింత తెలుసుకోండి"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB ఉపకరణం"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"రోమింగ్"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml
index fc062b4..554009e 100644
--- a/packages/SystemUI/res/values-th/strings.xml
+++ b/packages/SystemUI/res/values-th/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5GE"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"โรมมิ่ง"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml
index 37dd49f..309265a 100644
--- a/packages/SystemUI/res/values-tl/strings.xml
+++ b/packages/SystemUI/res/values-tl/strings.xml
@@ -102,7 +102,7 @@
<string name="accessibility_back" msgid="567011538994429120">"Bumalik"</string>
<string name="accessibility_home" msgid="8217216074895377641">"Home"</string>
<string name="accessibility_menu" msgid="316839303324695949">"Menu"</string>
- <string name="accessibility_accessibility_button" msgid="7601252764577607915">"Pagiging Naa-access"</string>
+ <string name="accessibility_accessibility_button" msgid="7601252764577607915">"Pagiging Accessible"</string>
<string name="accessibility_rotate_button" msgid="7402949513740253006">"I-rotate ang screen"</string>
<string name="accessibility_recent" msgid="5208608566793607626">"Overview"</string>
<string name="accessibility_search_light" msgid="1103867596330271848">"Hanapin"</string>
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Roaming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
@@ -572,7 +569,7 @@
<string name="stream_notification" msgid="2563720670905665031">"Notification"</string>
<string name="stream_bluetooth_sco" msgid="2055645746402746292">"Bluetooth"</string>
<string name="stream_dtmf" msgid="2447177903892477915">"Dual multi tone frequency"</string>
- <string name="stream_accessibility" msgid="301136219144385106">"Pagiging Naa-access"</string>
+ <string name="stream_accessibility" msgid="301136219144385106">"Pagiging Accessible"</string>
<string name="ring_toggle_title" msgid="3281244519428819576">"Mga Tawag"</string>
<string name="volume_ringer_status_normal" msgid="4273142424125855384">"Ipa-ring"</string>
<string name="volume_ringer_status_vibrate" msgid="1825615171021346557">"I-vibrate"</string>
diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml
index c052f4a..f7f4d81 100644
--- a/packages/SystemUI/res/values-tr/strings.xml
+++ b/packages/SystemUI/res/values-tr/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Dolaşım"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml
index de6b6f2..39b4deb 100644
--- a/packages/SystemUI/res/values-uk/strings.xml
+++ b/packages/SystemUI/res/values-uk/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Роумінг"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-ur/strings.xml b/packages/SystemUI/res/values-ur/strings.xml
index b361a4a..aa261da 100644
--- a/packages/SystemUI/res/values-ur/strings.xml
+++ b/packages/SystemUI/res/values-ur/strings.xml
@@ -50,8 +50,7 @@
<string name="usb_device_permission_prompt_warn" msgid="1842558472039505091">"<xliff:g id="APPLICATION">%1$s</xliff:g> کو <xliff:g id="USB_DEVICE">%2$s</xliff:g> تک رسائی دیں؟\nاس ایپ کو ریکارڈ کی اجازت عطا نہیں کی گئی ہے مگر اس USB آلہ سے کیپچر کر سکتے ہیں۔"</string>
<string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g> کو <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> تک رسائی حاصل کرنے کی اجازت دیں؟"</string>
<string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> ہینڈل کرنے کیلئے <xliff:g id="APPLICATION">%1$s</xliff:g> کھولیں؟"</string>
- <!-- no translation found for usb_device_confirm_prompt_warn (210658281376801521) -->
- <skip />
+ <string name="usb_device_confirm_prompt_warn" msgid="210658281376801521">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> کو ہینڈل کرنے کے ليے <xliff:g id="APPLICATION">%1$s</xliff:g> کھولیں؟ \nاس ایپ کو ریکارڈ کی اجازت عطا نہیں کی گئی ہے مگر اس USB آلہ سے کیپچر کر سکتے ہیں۔"</string>
<string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> ہینڈل کرنے کیلئے <xliff:g id="APPLICATION">%1$s</xliff:g> کھولیں؟"</string>
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"اس USB لوازم کے ساتھ کوئی انسٹال کردہ ایپس کام نہیں کرتی ہیں۔ <xliff:g id="URL">%1$s</xliff:g> پر مزید جانیں"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB لوازم"</string>
@@ -189,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"رومنگ"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-uz/strings.xml b/packages/SystemUI/res/values-uz/strings.xml
index 5c077d8..f538853 100644
--- a/packages/SystemUI/res/values-uz/strings.xml
+++ b/packages/SystemUI/res/values-uz/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Rouming"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml
index 88849c8..78bf627 100644
--- a/packages/SystemUI/res/values-vi/strings.xml
+++ b/packages/SystemUI/res/values-vi/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G trở lên"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Chuyển vùng"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml
index cdc2070..de6ad78 100644
--- a/packages/SystemUI/res/values-zh-rCN/strings.xml
+++ b/packages/SystemUI/res/values-zh-rCN/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"漫游"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-zh-rHK/strings.xml b/packages/SystemUI/res/values-zh-rHK/strings.xml
index a69bb7b..0bf6fbf 100644
--- a/packages/SystemUI/res/values-zh-rHK/strings.xml
+++ b/packages/SystemUI/res/values-zh-rHK/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5GE"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"漫遊"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml
index dedaebf..9b3aeb2 100644
--- a/packages/SystemUI/res/values-zh-rTW/strings.xml
+++ b/packages/SystemUI/res/values-zh-rTW/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"漫遊"</string>
<string name="data_connection_edge" msgid="871835227939216682">"EDGE"</string>
diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml
index 192bfb4..9cf9313 100644
--- a/packages/SystemUI/res/values-zu/strings.xml
+++ b/packages/SystemUI/res/values-zu/strings.xml
@@ -188,9 +188,6 @@
<string name="data_connection_4g_plus" msgid="1148687201877800700">"4G+"</string>
<string name="data_connection_lte" msgid="2694876797724028614">"I-LTE"</string>
<string name="data_connection_lte_plus" msgid="3423013208570937424">"I-LTE+"</string>
- <string name="data_connection_5ge" msgid="4699478963278829331">"5Ge"</string>
- <string name="data_connection_5g" msgid="6357743323196864504">"5G"</string>
- <string name="data_connection_5g_plus" msgid="3284146603743732965">"5G+"</string>
<string name="data_connection_cdma" msgid="8176597308239086780">"1X"</string>
<string name="data_connection_roaming" msgid="6037232010953697354">"Iyazulazula"</string>
<string name="data_connection_edge" msgid="871835227939216682">"I-EDGE"</string>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index d722d61..14371fe 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1164,4 +1164,11 @@
<!-- Size of the RAT type for CellularTile -->
<dimen name="celltile_rat_type_size">10sp</dimen>
+
+ <dimen name="new_qs_vertical_margin">8dp</dimen>
+
+ <!-- Size of media cards in the QSPanel carousel -->
+ <dimen name="qs_media_height">150dp</dimen>
+ <dimen name="qs_media_width">350dp</dimen>
+ <dimen name="qs_media_padding">8dp</dimen>
</resources>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
index 00e8b53..70f8e15 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
@@ -78,6 +78,7 @@
// Should match the values in PhoneWindowManager
public static final String CLOSE_SYSTEM_WINDOWS_REASON_RECENTS = "recentapps";
+ public static final String CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY = "homekey";
private final PackageManager mPackageManager;
private final BackgroundExecutor mBackgroundExecutor;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index ebac3d9..caee8cc 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -131,8 +131,7 @@
protected void verifyPasswordAndUnlock() {
if (mDismissing) return; // already verified but haven't been dismissed; don't do it again.
- final LockscreenCredential password =
- LockscreenCredential.createPassword(getPasswordText());
+ final LockscreenCredential password = getEnteredCredential();
setPasswordEntryInputEnabled(false);
if (mPendingLockCheck != null) {
mPendingLockCheck.cancel(false);
@@ -223,7 +222,7 @@
}
protected abstract void resetPasswordText(boolean animate, boolean announce);
- protected abstract CharSequence getPasswordText();
+ protected abstract LockscreenCredential getEnteredCredential();
protected abstract void setPasswordEntryEnabled(boolean enabled);
protected abstract void setPasswordEntryInputEnabled(boolean enabled);
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
index 12c9fc9..f8f3dc8 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
@@ -36,6 +36,7 @@
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
+import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.TextViewInputDisabler;
import com.android.systemui.R;
@@ -243,8 +244,8 @@
}
@Override
- protected CharSequence getPasswordText() {
- return mPasswordEntry.getText();
+ protected LockscreenCredential getEnteredCredential() {
+ return LockscreenCredential.createPasswordOrNone(mPasswordEntry.getText());
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
index 8e9df55..c67decc 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
@@ -23,6 +23,7 @@
import android.view.MotionEvent;
import android.view.View;
+import com.android.internal.widget.LockscreenCredential;
import com.android.systemui.R;
/**
@@ -167,8 +168,8 @@
}
@Override
- protected CharSequence getPasswordText() {
- return mPasswordEntry.getText();
+ protected LockscreenCredential getEnteredCredential() {
+ return LockscreenCredential.createPinOrNone(mPasswordEntry.getText());
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index ac5e255..27410be 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -39,7 +39,6 @@
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_TIMEOUT;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.systemui.DejankUtils.whitelistIpcs;
-import static com.android.systemui.Dependency.MAIN_LOOPER_NAME;
import android.annotation.AnyThread;
import android.annotation.MainThread;
@@ -101,6 +100,7 @@
import com.android.settingslib.WirelessUtils;
import com.android.systemui.DejankUtils;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.MainLooper;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
@@ -118,7 +118,6 @@
import java.util.function.Consumer;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -1500,7 +1499,7 @@
@VisibleForTesting
@Inject
- protected KeyguardUpdateMonitor(Context context, @Named(MAIN_LOOPER_NAME) Looper mainLooper) {
+ protected KeyguardUpdateMonitor(Context context, @MainLooper Looper mainLooper) {
mContext = context;
mSubscriptionManager = SubscriptionManager.from(context);
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index ff8a932..486d02c 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -40,6 +40,10 @@
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.colorextraction.SysuiColorExtractor;
+import com.android.systemui.dagger.qualifiers.BgHandler;
+import com.android.systemui.dagger.qualifiers.BgLooper;
+import com.android.systemui.dagger.qualifiers.MainHandler;
+import com.android.systemui.dagger.qualifiers.MainLooper;
import com.android.systemui.dock.DockManager;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.ScreenLifecycle;
@@ -148,16 +152,16 @@
/**
* Key for getting a the main looper.
*/
- public static final String MAIN_LOOPER_NAME = "main_looper";
+ private static final String MAIN_LOOPER_NAME = "main_looper";
/**
* Key for getting a background Looper for background work.
*/
- public static final String BG_LOOPER_NAME = "background_looper";
+ private static final String BG_LOOPER_NAME = "background_looper";
/**
* Key for getting a background Handler for background work.
*/
- public static final String BG_HANDLER_NAME = "background_handler";
+ private static final String BG_HANDLER_NAME = "background_handler";
/**
* Key for getting a Handler for receiving time tick broadcasts on.
*/
@@ -165,7 +169,7 @@
/**
* Generic handler on the main thread.
*/
- public static final String MAIN_HANDLER_NAME = "main_handler";
+ private static final String MAIN_HANDLER_NAME = "main_handler";
/**
* An email address to send memory leak reports to by default.
@@ -300,10 +304,10 @@
@Inject Lazy<AutoHideController> mAutoHideController;
@Inject Lazy<ForegroundServiceNotificationListener> mForegroundServiceNotificationListener;
@Inject Lazy<PrivacyItemController> mPrivacyItemController;
- @Inject @Named(BG_LOOPER_NAME) Lazy<Looper> mBgLooper;
- @Inject @Named(BG_HANDLER_NAME) Lazy<Handler> mBgHandler;
- @Inject @Named(MAIN_LOOPER_NAME) Lazy<Looper> mMainLooper;
- @Inject @Named(MAIN_HANDLER_NAME) Lazy<Handler> mMainHandler;
+ @Inject @BgLooper Lazy<Looper> mBgLooper;
+ @Inject @BgHandler Lazy<Handler> mBgHandler;
+ @Inject @MainLooper Lazy<Looper> mMainLooper;
+ @Inject @MainHandler Lazy<Handler> mMainHandler;
@Inject @Named(TIME_TICK_HANDLER_NAME) Lazy<Handler> mTimeTickHandler;
@Nullable
@Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy<String> mLeakReportEmail;
diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java
index df0d787..795a8ce3 100644
--- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java
+++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java
@@ -21,10 +21,13 @@
import android.util.SparseArray;
import com.android.internal.messages.nano.SystemMessageProto;
+import com.android.systemui.statusbar.notification.NotificationEntryManager;
+import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import javax.inject.Inject;
import javax.inject.Singleton;
+
/**
* Tracks state of foreground services and notifications related to foreground services per user.
*/
@@ -33,9 +36,11 @@
private final SparseArray<ForegroundServicesUserState> mUserServices = new SparseArray<>();
private final Object mMutex = new Object();
+ private final NotificationEntryManager mEntryManager;
@Inject
- public ForegroundServiceController() {
+ public ForegroundServiceController(NotificationEntryManager entryManager) {
+ mEntryManager = entryManager;
}
/**
@@ -90,11 +95,18 @@
}
/**
- * Records active app ops. App Ops are stored in FSC in addition to NotificationData in
- * case they change before we have a notification to tag.
+ * Records active app ops and updates the app op for the pending or visible notifications
+ * with the given parameters.
+ * App Ops are stored in FSC in addition to NotificationEntry in case they change before we
+ * have a notification to tag.
+ * @param appOpCode code for appOp to add/remove
+ * @param uid of user the notification is sent to
+ * @param packageName package that created the notification
+ * @param active whether the appOpCode is active or not
*/
- public void onAppOpChanged(int code, int uid, String packageName, boolean active) {
+ public void onAppOpChanged(int appOpCode, int uid, String packageName, boolean active) {
int userId = UserHandle.getUserId(uid);
+ // Record active app ops
synchronized (mMutex) {
ForegroundServicesUserState userServices = mUserServices.get(userId);
if (userServices == null) {
@@ -102,9 +114,30 @@
mUserServices.put(userId, userServices);
}
if (active) {
- userServices.addOp(packageName, code);
+ userServices.addOp(packageName, appOpCode);
} else {
- userServices.removeOp(packageName, code);
+ userServices.removeOp(packageName, appOpCode);
+ }
+ }
+
+ // Update appOp if there's an associated pending or visible notification:
+ final String foregroundKey = getStandardLayoutKey(userId, packageName);
+ if (foregroundKey != null) {
+ final NotificationEntry entry = mEntryManager.getPendingOrCurrentNotif(foregroundKey);
+ if (entry != null
+ && uid == entry.getSbn().getUid()
+ && packageName.equals(entry.getSbn().getPackageName())) {
+ boolean changed;
+ synchronized (entry.mActiveAppOps) {
+ if (active) {
+ changed = entry.mActiveAppOps.add(appOpCode);
+ } else {
+ changed = entry.mActiveAppOps.remove(appOpCode);
+ }
+ }
+ if (changed) {
+ mEntryManager.updateNotifications("appOpChanged pkg=" + packageName);
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java
index 4a3b6df..b983966 100644
--- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java
+++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
+import android.util.ArraySet;
import android.util.Log;
import com.android.internal.statusbar.NotificationVisibility;
@@ -40,6 +41,7 @@
private final Context mContext;
private final ForegroundServiceController mForegroundServiceController;
+ private final NotificationEntryManager mEntryManager;
@Inject
public ForegroundServiceNotificationListener(Context context,
@@ -47,15 +49,16 @@
NotificationEntryManager notificationEntryManager) {
mContext = context;
mForegroundServiceController = foregroundServiceController;
- notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
+ mEntryManager = notificationEntryManager;
+ mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@Override
public void onPendingEntryAdded(NotificationEntry entry) {
- addNotification(entry.getSbn(), entry.getImportance());
+ addNotification(entry, entry.getImportance());
}
@Override
- public void onPostEntryUpdated(NotificationEntry entry) {
- updateNotification(entry.getSbn(), entry.getImportance());
+ public void onPreEntryUpdated(NotificationEntry entry) {
+ updateNotification(entry, entry.getImportance());
}
@Override
@@ -67,15 +70,14 @@
}
});
- notificationEntryManager.addNotificationLifetimeExtender(
- new ForegroundServiceLifetimeExtender());
+ mEntryManager.addNotificationLifetimeExtender(new ForegroundServiceLifetimeExtender());
}
/**
- * @param sbn notification that was just posted
+ * @param entry notification that was just posted
*/
- private void addNotification(StatusBarNotification sbn, int importance) {
- updateNotification(sbn, importance);
+ private void addNotification(NotificationEntry entry, int importance) {
+ updateNotification(entry, importance);
}
/**
@@ -113,9 +115,10 @@
}
/**
- * @param sbn notification that was just changed in some way
+ * @param entry notification that was just changed in some way
*/
- private void updateNotification(StatusBarNotification sbn, int newImportance) {
+ private void updateNotification(NotificationEntry entry, int newImportance) {
+ final StatusBarNotification sbn = entry.getSbn();
mForegroundServiceController.updateUserState(
sbn.getUserId(),
userState -> {
@@ -143,8 +146,22 @@
}
}
}
+ tagForeground(entry);
return true;
},
true /* create if not found */);
}
+
+ private void tagForeground(NotificationEntry entry) {
+ final StatusBarNotification sbn = entry.getSbn();
+ ArraySet<Integer> activeOps = mForegroundServiceController.getAppOps(
+ sbn.getUserId(),
+ sbn.getPackageName());
+ if (activeOps != null) {
+ synchronized (entry.mActiveAppOps) {
+ entry.mActiveAppOps.clear();
+ entry.mActiveAppOps.addAll(activeOps);
+ }
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/LatencyTester.java b/packages/SystemUI/src/com/android/systemui/LatencyTester.java
index ddbabee..30a60ab 100644
--- a/packages/SystemUI/src/com/android/systemui/LatencyTester.java
+++ b/packages/SystemUI/src/com/android/systemui/LatencyTester.java
@@ -16,6 +16,8 @@
package com.android.systemui;
+import static android.os.PowerManager.WAKE_REASON_UNKNOWN;
+
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -28,21 +30,32 @@
import com.android.internal.util.LatencyTracker;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
-import com.android.systemui.statusbar.phone.StatusBar;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
/**
* Class that only runs on debuggable builds that listens to broadcasts that simulate actions in the
* system that are used for testing the latency.
*/
+@Singleton
public class LatencyTester extends SystemUI {
- private static final String ACTION_FINGERPRINT_WAKE =
+ private static final String
+ ACTION_FINGERPRINT_WAKE =
"com.android.systemui.latency.ACTION_FINGERPRINT_WAKE";
- private static final String ACTION_TURN_ON_SCREEN =
+ private static final String
+ ACTION_TURN_ON_SCREEN =
"com.android.systemui.latency.ACTION_TURN_ON_SCREEN";
+ private final BiometricUnlockController mBiometricUnlockController;
+ private final PowerManager mPowerManager;
- public LatencyTester(Context context) {
+ @Inject
+ public LatencyTester(Context context, BiometricUnlockController biometricUnlockController,
+ PowerManager powerManager) {
super(context);
+ mBiometricUnlockController = biometricUnlockController;
+ mPowerManager = powerManager;
}
@Override
@@ -68,19 +81,17 @@
}
private void fakeTurnOnScreen() {
- PowerManager powerManager = mContext.getSystemService(PowerManager.class);
if (LatencyTracker.isEnabled(mContext)) {
LatencyTracker.getInstance(mContext).onActionStart(
LatencyTracker.ACTION_TURN_ON_SCREEN);
}
- powerManager.wakeUp(SystemClock.uptimeMillis(), "android.policy:LATENCY_TESTS");
+ mPowerManager.wakeUp(
+ SystemClock.uptimeMillis(), WAKE_REASON_UNKNOWN, "android.policy:LATENCY_TESTS");
}
private void fakeWakeAndUnlock() {
- BiometricUnlockController biometricUnlockController = getComponent(StatusBar.class)
- .getBiometricUnlockController();
- biometricUnlockController.onBiometricAcquired(BiometricSourceType.FINGERPRINT);
- biometricUnlockController.onBiometricAuthenticated(
+ mBiometricUnlockController.onBiometricAcquired(BiometricSourceType.FINGERPRINT);
+ mBiometricUnlockController.onBiometricAuthenticated(
KeyguardUpdateMonitor.getCurrentUser(), BiometricSourceType.FINGERPRINT);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index ad20986..8a99e451 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -81,10 +81,16 @@
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import dagger.Lazy;
+
/**
* An overlay that draws screen decorations in software (e.g for rounded corners or display cutout)
* for antialiasing and emulation purposes.
*/
+@Singleton
public class ScreenDecorations extends SystemUI implements Tunable {
private static final boolean DEBUG = false;
private static final String TAG = "ScreenDecorations";
@@ -94,6 +100,7 @@
private static final boolean DEBUG_SCREENSHOT_ROUNDED_CORNERS =
SystemProperties.getBoolean("debug.screenshot_rounded_corners", false);
private static final boolean VERBOSE = false;
+ private final Lazy<StatusBar> mStatusBarLazy;
private DisplayManager mDisplayManager;
private DisplayManager.DisplayListener mDisplayListener;
@@ -132,8 +139,10 @@
return result;
}
- public ScreenDecorations(Context context) {
+ @Inject
+ public ScreenDecorations(Context context, Lazy<StatusBar> statusBarLazy) {
super(context);
+ mStatusBarLazy = statusBarLazy;
}
@Override
@@ -434,13 +443,13 @@
private void setupStatusBarPadding(int padding) {
// Add some padding to all the content near the edge of the screen.
- StatusBar sb = getComponent(StatusBar.class);
- View statusBar = (sb != null ? sb.getStatusBarWindow() : null);
- if (statusBar != null) {
- TunablePadding.addTunablePadding(statusBar.findViewById(R.id.keyguard_header), PADDING,
- padding, FLAG_END);
+ StatusBar statusBar = mStatusBarLazy.get();
+ View statusBarWindow = statusBar.getStatusBarWindow();
+ if (statusBarWindow != null) {
+ TunablePadding.addTunablePadding(statusBarWindow.findViewById(R.id.keyguard_header),
+ PADDING, padding, FLAG_END);
- FragmentHostManager fragmentHostManager = FragmentHostManager.get(statusBar);
+ FragmentHostManager fragmentHostManager = FragmentHostManager.get(statusBarWindow);
fragmentHostManager.addTagListener(CollapsedStatusBarFragment.TAG,
new TunablePaddingTagListener(padding, R.id.status_bar));
fragmentHostManager.addTagListener(QS.TAG,
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java
index aa13fa8..746515a 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java
@@ -27,6 +27,8 @@
import androidx.annotation.Nullable;
import androidx.core.app.AppComponentFactory;
+import com.android.systemui.dagger.ContextComponentHelper;
+
import javax.inject.Inject;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
index 91776a3..022bf06 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -34,6 +34,7 @@
import android.util.Log;
import android.util.TimingsTraceLog;
+import com.android.systemui.dagger.ContextComponentHelper;
import com.android.systemui.plugins.OverlayPlugin;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.shared.plugins.PluginManager;
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
index 11db481..0a547b6 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
@@ -27,6 +27,9 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.ViewMediatorCallback;
+import com.android.systemui.dagger.DaggerSystemUIRootComponent;
+import com.android.systemui.dagger.DependencyProvider;
+import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -107,7 +110,7 @@
protected SystemUIRootComponent buildSystemUIRootComponent(Context context) {
return DaggerSystemUIRootComponent.builder()
- .dependencyProvider(new com.android.systemui.DependencyProvider())
+ .dependencyProvider(new DependencyProvider())
.contextHolder(new ContextHolder(context))
.build();
}
diff --git a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
index ef171d3..f616d57 100644
--- a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
@@ -16,8 +16,6 @@
package com.android.systemui.appops;
-import static com.android.systemui.Dependency.BG_LOOPER_NAME;
-
import android.app.AppOpsManager;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -31,6 +29,7 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dumpable;
+import com.android.systemui.dagger.qualifiers.BgLooper;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -39,7 +38,6 @@
import java.util.Set;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -79,7 +77,7 @@
};
@Inject
- public AppOpsControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper) {
+ public AppOpsControllerImpl(Context context, @BgLooper Looper bgLooper) {
this(context, bgLooper, new PermissionFlagsCache(context));
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java
index d20cd72..f5f1fad 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java
@@ -23,7 +23,6 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.hardware.biometrics.BiometricPrompt;
import android.os.Bundle;
@@ -41,7 +40,6 @@
import android.widget.TextView;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.R;
import java.lang.annotation.Retention;
@@ -152,10 +150,6 @@
public int getMediumToLargeAnimationDurationMs() {
return AuthDialog.ANIMATE_MEDIUM_TO_LARGE_DURATION_MS;
}
-
- public int getAnimateCredentialStartDelayMs() {
- return AuthDialog.ANIMATE_CREDENTIAL_START_DELAY_MS;
- }
}
private final Injector mInjector;
@@ -632,9 +626,7 @@
*/
void startTransitionToCredentialUI() {
updateSize(AuthDialog.SIZE_LARGE);
- mHandler.postDelayed(() -> {
- mCallback.onAction(Callback.ACTION_USE_DEVICE_CREDENTIAL);
- }, mInjector.getAnimateCredentialStartDelayMs());
+ mCallback.onAction(Callback.ACTION_USE_DEVICE_CREDENTIAL);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index f1abdb3..3948416 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -24,13 +24,12 @@
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
-import android.hardware.biometrics.Authenticator;
import android.hardware.biometrics.BiometricAuthenticator;
-import android.hardware.biometrics.BiometricPrompt;
import android.os.Binder;
import android.os.Bundle;
+import android.os.Handler;
import android.os.IBinder;
-import android.os.UserManager;
+import android.os.Looper;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -75,6 +74,7 @@
@interface ContainerState {}
final Config mConfig;
+ private final Handler mHandler;
private final Injector mInjector;
private final IBinder mWindowToken = new Binder();
private final WindowManager mWindowManager;
@@ -177,6 +177,10 @@
View getPanelView(FrameLayout parent) {
return parent.findViewById(R.id.panel);
}
+
+ int getAnimateCredentialStartDelayMs() {
+ return AuthDialog.ANIMATE_CREDENTIAL_START_DELAY_MS;
+ }
}
@VisibleForTesting
@@ -201,7 +205,9 @@
break;
case AuthBiometricView.Callback.ACTION_USE_DEVICE_CREDENTIAL:
mConfig.mCallback.onDeviceCredentialPressed();
- addCredentialView(false /* animatePanel */, true /* animateContents */);
+ mHandler.postDelayed(() -> {
+ addCredentialView(false /* animatePanel */, true /* animateContents */);
+ }, mInjector.getAnimateCredentialStartDelayMs());
break;
default:
Log.e(TAG, "Unhandled action: " + action);
@@ -223,6 +229,7 @@
mConfig = config;
mInjector = injector;
+ mHandler = new Handler(Looper.getMainLooper());
mWindowManager = mContext.getSystemService(WindowManager.class);
mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index cdc2623..446ed25 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -16,6 +16,9 @@
package com.android.systemui.biometrics;
+import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
+import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
+
import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.IActivityTaskManager;
@@ -27,6 +30,8 @@
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.IBiometricServiceReceiverInternal;
+import android.hardware.face.FaceManager;
+import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -34,6 +39,7 @@
import android.util.Log;
import android.view.WindowManager;
+import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.SomeArgs;
import com.android.systemui.SystemUI;
@@ -87,8 +93,11 @@
Log.w(TAG, "Evicting client due to: " + topPackage);
mCurrentDialog.dismissWithoutCallback(true /* animate */);
mCurrentDialog = null;
- mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_USER_CANCEL);
- mReceiver = null;
+ if (mReceiver != null) {
+ mReceiver.onDialogDismissed(
+ BiometricPrompt.DISMISSED_REASON_USER_CANCEL);
+ mReceiver = null;
+ }
}
}
} catch (RemoteException e) {
@@ -99,6 +108,10 @@
@Override
public void onTryAgainPressed() {
+ if (mReceiver == null) {
+ Log.e(TAG, "onTryAgainPressed: Receiver is null");
+ return;
+ }
try {
mReceiver.onTryAgainPressed();
} catch (RemoteException e) {
@@ -108,6 +121,10 @@
@Override
public void onDeviceCredentialPressed() {
+ if (mReceiver == null) {
+ Log.e(TAG, "onDeviceCredentialPressed: Receiver is null");
+ return;
+ }
try {
mReceiver.onDeviceCredentialPressed();
} catch (RemoteException e) {
@@ -155,7 +172,7 @@
private void sendResultAndCleanUp(@DismissedReason int reason) {
if (mReceiver == null) {
- Log.e(TAG, "Receiver is null");
+ Log.e(TAG, "sendResultAndCleanUp: Receiver is null");
return;
}
try {
@@ -229,15 +246,8 @@
}
@Override
- public void onBiometricAuthenticated(boolean authenticated, String failureReason) {
- if (DEBUG) Log.d(TAG, "onBiometricAuthenticated: " + authenticated
- + " reason: " + failureReason);
-
- if (authenticated) {
- mCurrentDialog.onAuthenticationSucceeded();
- } else {
- mCurrentDialog.onAuthenticationFailed(failureReason);
- }
+ public void onBiometricAuthenticated() {
+ mCurrentDialog.onAuthenticationSucceeded();
}
@Override
@@ -247,16 +257,45 @@
mCurrentDialog.onHelp(message);
}
- @Override
- public void onBiometricError(int errorCode, String error) {
- if (DEBUG) Log.d(TAG, "onBiometricError: " + errorCode + ", " + error);
+ private String getErrorString(int modality, int error, int vendorCode) {
+ switch (modality) {
+ case TYPE_FACE:
+ return FaceManager.getErrorString(mContext, error, vendorCode);
- final boolean isLockout = errorCode == BiometricConstants.BIOMETRIC_ERROR_LOCKOUT
- || errorCode == BiometricConstants.BIOMETRIC_ERROR_LOCKOUT_PERMANENT;
+ case TYPE_FINGERPRINT:
+ return FingerprintManager.getErrorString(mContext, error, vendorCode);
+
+ default:
+ return "";
+ }
+ }
+
+ @Override
+ public void onBiometricError(int modality, int error, int vendorCode) {
+ if (DEBUG) {
+ Log.d(TAG, String.format("onBiometricError(%d, %d, %d)", modality, error, vendorCode));
+ }
+
+ final boolean isLockout = (error == BiometricConstants.BIOMETRIC_ERROR_LOCKOUT)
+ || (error == BiometricConstants.BIOMETRIC_ERROR_LOCKOUT_PERMANENT);
+
+ // TODO(b/141025588): Create separate methods for handling hard and soft errors.
+ final boolean isSoftError = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED
+ || error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT);
+
if (mCurrentDialog.isAllowDeviceCredentials() && isLockout) {
+ if (DEBUG) Log.d(TAG, "onBiometricError, lockout");
mCurrentDialog.animateToCredentialUI();
+ } else if (isSoftError) {
+ final String errorMessage = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED)
+ ? mContext.getString(R.string.biometric_not_recognized)
+ : getErrorString(modality, error, vendorCode);
+ if (DEBUG) Log.d(TAG, "onBiometricError, soft error: " + errorMessage);
+ mCurrentDialog.onAuthenticationFailed(errorMessage);
} else {
- mCurrentDialog.onError(error);
+ final String errorMessage = getErrorString(modality, error, vendorCode);
+ if (DEBUG) Log.d(TAG, "onBiometricError, hard error: " + errorMessage);
+ mCurrentDialog.onError(errorMessage);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java
index 2b8b586..4acbade 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java
@@ -19,7 +19,6 @@
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.content.Context;
-import android.graphics.Color;
import android.graphics.Outline;
import android.util.Log;
import android.view.View;
@@ -142,7 +141,6 @@
mContentHeight = (int) animation.getAnimatedValue();
mPanelView.invalidateOutline();
});
- heightAnimator.start();
// Animate width
ValueAnimator widthAnimator = ValueAnimator.ofInt(mContentWidth, contentWidth);
@@ -163,7 +161,8 @@
AnimatorSet as = new AnimatorSet();
as.setDuration(animateDurationMs);
as.setInterpolator(new AccelerateDecelerateInterpolator());
- as.playTogether(cornerAnimator, widthAnimator, marginAnimator, alphaAnimator);
+ as.playTogether(cornerAnimator, heightAnimator, widthAnimator, marginAnimator,
+ alphaAnimator);
as.start();
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt b/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt
index 5e977b4..ff4711c 100644
--- a/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt
+++ b/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt
@@ -26,13 +26,12 @@
import android.util.Log
import android.util.SparseArray
import com.android.internal.annotations.VisibleForTesting
-import com.android.systemui.Dependency.BG_LOOPER_NAME
-import com.android.systemui.Dependency.MAIN_HANDLER_NAME
import com.android.systemui.Dumpable
+import com.android.systemui.dagger.qualifiers.BgLooper
+import com.android.systemui.dagger.qualifiers.MainHandler
import java.io.FileDescriptor
import java.io.PrintWriter
import javax.inject.Inject
-import javax.inject.Named
import javax.inject.Singleton
data class ReceiverData(
@@ -61,8 +60,8 @@
@Singleton
open class BroadcastDispatcher @Inject constructor (
private val context: Context,
- @Named(MAIN_HANDLER_NAME) private val mainHandler: Handler,
- @Named(BG_LOOPER_NAME) private val bgLooper: Looper
+ @MainHandler private val mainHandler: Handler,
+ @BgLooper private val bgLooper: Looper
) : Dumpable {
// Only modify in BG thread
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java
index 914258f..db85fa0 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java
@@ -17,7 +17,6 @@
package com.android.systemui.classifier;
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_MANAGER_ENABLED;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
import android.content.Context;
import android.hardware.SensorManager;
@@ -31,6 +30,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.classifier.brightline.BrightLineFalsingManager;
import com.android.systemui.classifier.brightline.FalsingDataProvider;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.FalsingPlugin;
import com.android.systemui.plugins.PluginListener;
@@ -41,7 +41,6 @@
import java.io.PrintWriter;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -62,7 +61,7 @@
@Inject
FalsingManagerProxy(Context context, PluginManager pluginManager,
- @Named(MAIN_HANDLER_NAME) Handler handler,
+ @MainHandler Handler handler,
ProximitySensor proximitySensor,
DeviceConfigProxy deviceConfig) {
mProximitySensor = proximitySensor;
diff --git a/packages/SystemUI/src/com/android/systemui/ActivityBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/ActivityBinder.java
similarity index 93%
rename from packages/SystemUI/src/com/android/systemui/ActivityBinder.java
rename to packages/SystemUI/src/com/android/systemui/dagger/ActivityBinder.java
index 2c8a672..4be610f 100644
--- a/packages/SystemUI/src/com/android/systemui/ActivityBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ActivityBinder.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import android.app.Activity;
+import com.android.systemui.ForegroundServicesDialog;
import com.android.systemui.tuner.TunerActivity;
import dagger.Binds;
diff --git a/packages/SystemUI/src/com/android/systemui/ComponentBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/ComponentBinder.java
similarity index 96%
rename from packages/SystemUI/src/com/android/systemui/ComponentBinder.java
rename to packages/SystemUI/src/com/android/systemui/dagger/ComponentBinder.java
index 3b35c61..4e4c06e 100644
--- a/packages/SystemUI/src/com/android/systemui/ComponentBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ComponentBinder.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import dagger.Binds;
import dagger.Module;
diff --git a/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentHelper.java
similarity index 93%
rename from packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java
rename to packages/SystemUI/src/com/android/systemui/dagger/ContextComponentHelper.java
index 2cf0f8d..d6d1e41 100644
--- a/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentHelper.java
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import android.app.Activity;
import android.app.Service;
+import com.android.systemui.SystemUI;
+
/**
* Interface necessary to make Dagger happy. See {@link ContextComponentResolver}.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentResolver.java
similarity index 96%
rename from packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java
rename to packages/SystemUI/src/com/android/systemui/dagger/ContextComponentResolver.java
index 9952632..d7822c9 100644
--- a/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentResolver.java
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import android.app.Activity;
import android.app.Service;
+import com.android.systemui.SystemUI;
+
import java.util.Map;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/DependencyBinder.java
similarity index 94%
rename from packages/SystemUI/src/com/android/systemui/DependencyBinder.java
rename to packages/SystemUI/src/com/android/systemui/dagger/DependencyBinder.java
index f9f0f1b..9032c6f 100644
--- a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/DependencyBinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * 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.
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
+import com.android.systemui.ActivityStarterDelegate;
import com.android.systemui.appops.AppOpsController;
import com.android.systemui.appops.AppOpsControllerImpl;
import com.android.systemui.classifier.FalsingManagerProxy;
+import com.android.systemui.doze.DozeHost;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.FalsingManager;
@@ -32,6 +34,7 @@
import com.android.systemui.statusbar.StatusBarStateControllerImpl;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.DarkIconDispatcherImpl;
+import com.android.systemui.statusbar.phone.DozeServiceHost;
import com.android.systemui.statusbar.phone.ManagedProfileController;
import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl;
import com.android.systemui.statusbar.phone.StatusBarIconController;
@@ -240,5 +243,10 @@
/**
*/
@Binds
- public abstract FalsingManager provideFalsingmanager(FalsingManagerProxy falsingManagerImpl);
+ public abstract FalsingManager provideFalsingManager(FalsingManagerProxy falsingManagerImpl);
+
+ /**
+ */
+ @Binds
+ public abstract DozeHost provideDozeHost(DozeServiceHost dozeServiceHost);
}
diff --git a/packages/SystemUI/src/com/android/systemui/DependencyProvider.java b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java
similarity index 63%
rename from packages/SystemUI/src/com/android/systemui/DependencyProvider.java
rename to packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java
index 8c1f8ac..87434f3 100644
--- a/packages/SystemUI/src/com/android/systemui/DependencyProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * 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.
@@ -14,51 +14,35 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
-import static com.android.systemui.Dependency.BG_HANDLER_NAME;
-import static com.android.systemui.Dependency.BG_LOOPER_NAME;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-import static com.android.systemui.Dependency.MAIN_LOOPER_NAME;
import static com.android.systemui.Dependency.TIME_TICK_HANDLER_NAME;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import android.annotation.Nullable;
-import android.app.ActivityManager;
-import android.app.AlarmManager;
-import android.app.IActivityManager;
import android.app.INotificationManager;
-import android.app.IWallpaperManager;
-import android.app.WallpaperManager;
import android.content.Context;
-import android.content.res.Resources;
-import android.hardware.SensorPrivacyManager;
import android.hardware.display.AmbientDisplayConfiguration;
import android.hardware.display.NightDisplayListener;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
-import android.os.PowerManager;
import android.os.Process;
import android.os.ServiceManager;
-import android.os.UserHandle;
import android.util.DisplayMetrics;
import android.view.IWindowManager;
-import android.view.WindowManager;
-import android.view.WindowManagerGlobal;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.widget.LockPatternUtils;
-import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.systemui.dagger.qualifiers.BgHandler;
+import com.android.systemui.dagger.qualifiers.BgLooper;
+import com.android.systemui.dagger.qualifiers.MainHandler;
+import com.android.systemui.dagger.qualifiers.MainLooper;
import com.android.systemui.doze.AlwaysOnDisplayPolicy;
import com.android.systemui.plugins.PluginInitializerImpl;
import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.shared.plugins.PluginManagerImpl;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
-import com.android.systemui.shared.system.PackageManagerWrapper;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -70,11 +54,7 @@
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.util.leak.LeakDetector;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-
import javax.inject.Named;
-import javax.inject.Qualifier;
import javax.inject.Singleton;
import dagger.Module;
@@ -82,16 +62,14 @@
/**
* Provides dependencies for the root component of sysui injection.
+ *
+ * Only SystemUI owned classes and instances should go in here. Other, framework-owned classes
+ * should go in {@link SystemServicesModule}.
+ *
* See SystemUI/docs/dagger.md
*/
@Module
public class DependencyProvider {
- @Qualifier
- @Documented
- @Retention(RUNTIME)
- public @interface MainResources {
- // TODO: use attribute to get other, non-main resources?
- }
@Singleton
@Provides
@@ -104,7 +82,7 @@
@Singleton
@Provides
- @Named(BG_LOOPER_NAME)
+ @BgLooper
public Looper provideBgLooper() {
HandlerThread thread = new HandlerThread("SysUiBg",
Process.THREAD_PRIORITY_BACKGROUND);
@@ -113,29 +91,34 @@
}
/** Main Looper */
- @Singleton
@Provides
- @Named(MAIN_LOOPER_NAME)
+ @MainLooper
public Looper provideMainLooper() {
return Looper.getMainLooper();
}
@Singleton
@Provides
- @Named(BG_HANDLER_NAME)
- public Handler provideBgHandler(@Named(BG_LOOPER_NAME) Looper bgLooper) {
+ @BgHandler
+ public Handler provideBgHandler(@BgLooper Looper bgLooper) {
return new Handler(bgLooper);
}
@Singleton
@Provides
- @Named(MAIN_HANDLER_NAME)
- public Handler provideMainHandler(@Named(MAIN_LOOPER_NAME) Looper mainLooper) {
+ @MainHandler
+ public Handler provideMainHandler(@MainLooper Looper mainLooper) {
return new Handler(mainLooper);
}
/** */
@Provides
+ public AmbientDisplayConfiguration provideAmbientDispalyConfiguration(Context context) {
+ return new AmbientDisplayConfiguration(context);
+ }
+
+ /** */
+ @Provides
public Handler provideHandler() {
return new Handler();
}
@@ -148,23 +131,10 @@
@Singleton
@Provides
- @Nullable
- public LocalBluetoothManager provideLocalBluetoothController(Context context,
- @Named(BG_HANDLER_NAME) Handler bgHandler) {
- return LocalBluetoothManager.create(context, bgHandler,
- UserHandle.ALL);
- }
-
- @Singleton
- @Provides
- public MetricsLogger provideMetricsLogger() {
- return new MetricsLogger();
- }
-
- @Singleton
- @Provides
- public IWindowManager provideIWindowManager() {
- return WindowManagerGlobal.getWindowManagerService();
+ // Single instance of DisplayMetrics, gets updated by StatusBar, but can be used
+ // anywhere it is needed.
+ public DisplayMetrics provideDisplayMetrics() {
+ return new DisplayMetrics();
}
@Singleton
@@ -184,20 +154,6 @@
@Singleton
@Provides
- // Single instance of DisplayMetrics, gets updated by StatusBar, but can be used
- // anywhere it is needed.
- public DisplayMetrics provideDisplayMetrics() {
- return new DisplayMetrics();
- }
-
- @Singleton
- @Provides
- public SensorPrivacyManager provideSensorPrivacyManager(Context context) {
- return context.getSystemService(SensorPrivacyManager.class);
- }
-
- @Singleton
- @Provides
public LeakDetector provideLeakDetector() {
return LeakDetector.create();
@@ -205,8 +161,14 @@
@Singleton
@Provides
+ public MetricsLogger provideMetricsLogger() {
+ return new MetricsLogger();
+ }
+
+ @Singleton
+ @Provides
public NightDisplayListener provideNightDisplayListener(Context context,
- @Named(BG_HANDLER_NAME) Handler bgHandler) {
+ @BgHandler Handler bgHandler) {
return new NightDisplayListener(context, bgHandler);
}
@@ -219,7 +181,7 @@
@Singleton
@Provides
public NavigationBarController provideNavigationBarController(Context context,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
+ @MainHandler Handler mainHandler) {
return new NavigationBarController(context, mainHandler);
}
@@ -232,7 +194,7 @@
@Singleton
@Provides
public AutoHideController provideAutoHideController(Context context,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler,
+ @MainHandler Handler mainHandler,
NotificationRemoteInputManager notificationRemoteInputManager,
IWindowManager iWindowManager) {
return new AutoHideController(context, mainHandler, notificationRemoteInputManager,
@@ -253,25 +215,12 @@
@Singleton
@Provides
- public PackageManagerWrapper providePackageManagerWrapper() {
- return PackageManagerWrapper.getInstance();
- }
-
- @Singleton
- @Provides
public DeviceProvisionedController provideDeviceProvisionedController(Context context,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
+ @MainHandler Handler mainHandler) {
return new DeviceProvisionedControllerImpl(context, mainHandler);
}
/** */
- @Singleton
- @Provides
- public AlarmManager provideAlarmManager(Context context) {
- return context.getSystemService(AlarmManager.class);
- }
-
- /** */
@Provides
public LockPatternUtils provideLockPatternUtils(Context context) {
return new LockPatternUtils(context);
@@ -279,52 +228,7 @@
/** */
@Provides
- public AmbientDisplayConfiguration provideAmbientDispalyConfiguration(Context context) {
- return new AmbientDisplayConfiguration(context);
- }
-
- /** */
- @Provides
public AlwaysOnDisplayPolicy provideAlwaysOnDisplayPolicy(Context context) {
return new AlwaysOnDisplayPolicy(context);
}
-
- /** */
- @Provides
- public PowerManager providePowerManager(Context context) {
- return context.getSystemService(PowerManager.class);
- }
-
- /** */
- @Provides
- @MainResources
- public Resources provideResources(Context context) {
- return context.getResources();
- }
-
- /** */
- @Provides
- @Nullable
- public IWallpaperManager provideIWallpaperManager() {
- return IWallpaperManager.Stub.asInterface(
- ServiceManager.getService(Context.WALLPAPER_SERVICE));
- }
-
- /** */
- @Provides
- public WallpaperManager providesWallpaperManager(Context context) {
- return (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE);
- }
-
- /** */
- @Provides
- public WindowManager providesWindowManager(Context context) {
- return context.getSystemService(WindowManager.class);
- }
-
- /** */
- @Provides
- public IActivityManager providesIActivityManager() {
- return ActivityManager.getService();
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/ServiceBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/ServiceBinder.java
similarity index 94%
rename from packages/SystemUI/src/com/android/systemui/ServiceBinder.java
rename to packages/SystemUI/src/com/android/systemui/dagger/ServiceBinder.java
index c11236e..1f2c0a1 100644
--- a/packages/SystemUI/src/com/android/systemui/ServiceBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ServiceBinder.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import android.app.Service;
+import com.android.systemui.ImageWallpaper;
import com.android.systemui.doze.DozeService;
import com.android.systemui.keyguard.KeyguardService;
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java
new file mode 100644
index 0000000..fffba8c
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java
@@ -0,0 +1,130 @@
+/*
+ * 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.systemui.dagger;
+
+import android.annotation.Nullable;
+import android.annotation.SuppressLint;
+import android.app.ActivityManager;
+import android.app.AlarmManager;
+import android.app.IActivityManager;
+import android.app.IWallpaperManager;
+import android.app.WallpaperManager;
+import android.content.Context;
+import android.content.res.Resources;
+import android.hardware.SensorPrivacyManager;
+import android.os.Handler;
+import android.os.PowerManager;
+import android.os.ServiceManager;
+import android.os.UserHandle;
+import android.view.IWindowManager;
+import android.view.WindowManager;
+import android.view.WindowManagerGlobal;
+
+import com.android.internal.util.LatencyTracker;
+import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.systemui.dagger.qualifiers.BgHandler;
+import com.android.systemui.dagger.qualifiers.MainResources;
+import com.android.systemui.shared.system.PackageManagerWrapper;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+
+/**
+ * Provides Non-SystemUI, Framework-Owned instances to the dependency graph.
+ */
+@Module
+public class SystemServicesModule {
+
+ @Singleton
+ @Provides
+ static AlarmManager provideAlarmManager(Context context) {
+ return context.getSystemService(AlarmManager.class);
+ }
+
+ @Singleton
+ @Provides
+ static IActivityManager provideIActivityManager() {
+ return ActivityManager.getService();
+ }
+
+ @Provides
+ @Nullable
+ static IWallpaperManager provideIWallPaperManager() {
+ return IWallpaperManager.Stub.asInterface(
+ ServiceManager.getService(Context.WALLPAPER_SERVICE));
+ }
+
+ @Singleton
+ @Provides
+ static IWindowManager provideIWindowManager() {
+ return WindowManagerGlobal.getWindowManagerService();
+ }
+
+ @Singleton
+ @Provides
+ static LatencyTracker provideLatencyTracker(Context context) {
+ return LatencyTracker.getInstance(context);
+ }
+
+ @SuppressLint("MissingPermission")
+ @Singleton
+ @Provides
+ @Nullable
+ static LocalBluetoothManager provideLocalBluetoothController(Context context,
+ @BgHandler Handler bgHandler) {
+ return LocalBluetoothManager.create(context, bgHandler, UserHandle.ALL);
+ }
+
+ @Singleton
+ @Provides
+ static PackageManagerWrapper providePackageManagerWrapper() {
+ return PackageManagerWrapper.getInstance();
+ }
+
+ /** */
+ @Singleton
+ @Provides
+ static PowerManager providePowerManager(Context context) {
+ return context.getSystemService(PowerManager.class);
+ }
+
+ @Provides
+ @MainResources
+ static Resources provideResources(Context context) {
+ return context.getResources();
+ }
+
+ @Singleton
+ @Provides
+ static SensorPrivacyManager provideSensorPrivacyManager(Context context) {
+ return context.getSystemService(SensorPrivacyManager.class);
+ }
+
+ @Provides
+ static WallpaperManager provideWallpaperManager(Context context) {
+ return (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE);
+ }
+
+ @Singleton
+ @Provides
+ static WindowManager provideWindowManager(Context context) {
+ return context.getSystemService(WindowManager.class);
+ }
+
+}
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
similarity index 80%
rename from packages/SystemUI/src/com/android/systemui/SystemUIBinder.java
rename to packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
index a5a5598..738f539 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
@@ -14,8 +14,11 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
+import com.android.systemui.LatencyTester;
+import com.android.systemui.ScreenDecorations;
+import com.android.systemui.SystemUI;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.pip.PipUI;
import com.android.systemui.power.PowerUI;
@@ -47,6 +50,12 @@
@ClassKey(KeyguardViewMediator.class)
public abstract SystemUI bindKeyguardViewMediator(KeyguardViewMediator sysui);
+ /** Inject into LatencyTests. */
+ @Binds
+ @IntoMap
+ @ClassKey(LatencyTester.class)
+ public abstract SystemUI bindLatencyTester(LatencyTester sysui);
+
/** Inject into PipUI. */
@Binds
@IntoMap
@@ -65,6 +74,12 @@
@ClassKey(Recents.class)
public abstract SystemUI bindRecents(Recents sysui);
+ /** Inject into ScreenDecorations. */
+ @Binds
+ @IntoMap
+ @ClassKey(ScreenDecorations.class)
+ public abstract SystemUI bindScreenDecorations(ScreenDecorations sysui);
+
/** Inject into VolumeUI. */
@Binds
@IntoMap
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
similarity index 97%
rename from packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java
rename to packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
index 176bcbf..c95b50b 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
import androidx.annotation.Nullable;
+import com.android.systemui.SystemUI;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.power.EnhancedEstimates;
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
similarity index 82%
rename from packages/SystemUI/src/com/android/systemui/SystemUIModule.java
rename to packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index 4520a1a6..4e60f19 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import android.annotation.Nullable;
import android.content.Context;
import android.content.pm.PackageManager;
+import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.assist.AssistModule;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -36,7 +37,9 @@
* A dagger module for injecting components of System UI that are not overridden by the System UI
* implementation.
*/
-@Module(includes = {AssistModule.class, ComponentBinder.class, PeopleHubModule.class})
+@Module(includes = {AssistModule.class,
+ ComponentBinder.class,
+ PeopleHubModule.class})
public abstract class SystemUIModule {
@Singleton
@@ -44,11 +47,13 @@
@Nullable
static KeyguardLiftController provideKeyguardLiftController(Context context,
StatusBarStateController statusBarStateController,
- AsyncSensorManager asyncSensorManager) {
+ AsyncSensorManager asyncSensorManager,
+ KeyguardUpdateMonitor keyguardUpdateMonitor) {
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
return null;
}
- return new KeyguardLiftController(statusBarStateController, asyncSensorManager);
+ return new KeyguardLiftController(statusBarStateController, asyncSensorManager,
+ keyguardUpdateMonitor);
}
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java
similarity index 91%
rename from packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java
rename to packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java
index bcbe672..113c9c8 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java
@@ -14,12 +14,15 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger;
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import android.content.ContentProvider;
+import com.android.systemui.Dependency;
+import com.android.systemui.SystemUIAppComponentFactory;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.util.InjectionInflationController;
@@ -36,6 +39,7 @@
@Component(modules = {
DependencyProvider.class,
DependencyBinder.class,
+ SystemServicesModule.class,
SystemUIFactory.ContextHolder.class,
SystemUIModule.class,
SystemUIDefaultModule.class})
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgHandler.java
similarity index 61%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgHandler.java
index d2ec357..bc6b83b 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -14,6 +14,17 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package com.android.systemui.dagger.qualifiers;
-parcelable TimeSignal;
\ No newline at end of file
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+public @interface BgHandler {
+}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgLooper.java
similarity index 61%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgLooper.java
index d2ec357..2aadda1 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgLooper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -14,6 +14,17 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package com.android.systemui.dagger.qualifiers;
-parcelable TimeSignal;
\ No newline at end of file
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+public @interface BgLooper {
+}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainHandler.java
similarity index 61%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainHandler.java
index d2ec357..79661fa 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -14,6 +14,17 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package com.android.systemui.dagger.qualifiers;
-parcelable TimeSignal;
\ No newline at end of file
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+public @interface MainHandler {
+}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainLooper.java
similarity index 61%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainLooper.java
index d2ec357..750d7d7 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainLooper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -14,6 +14,17 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package com.android.systemui.dagger.qualifiers;
-parcelable TimeSignal;
\ No newline at end of file
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+public @interface MainLooper {
+}
diff --git a/packages/SystemUI/src/com/android/systemui/ComponentBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainResources.java
similarity index 60%
copy from packages/SystemUI/src/com/android/systemui/ComponentBinder.java
copy to packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainResources.java
index 3b35c61..3daeda5 100644
--- a/packages/SystemUI/src/com/android/systemui/ComponentBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainResources.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package com.android.systemui;
+package com.android.systemui.dagger.qualifiers;
-import dagger.Binds;
-import dagger.Module;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
-/**
- * Dagger Module that collects related sub-modules together.
- */
-@Module(includes = {ActivityBinder.class, ServiceBinder.class, SystemUIBinder.class})
-public abstract class ComponentBinder {
- /** */
- @Binds
- public abstract ContextComponentHelper bindComponentHelper(
- ContextComponentResolver componentHelper);
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+public @interface MainResources {
+ // TODO: use attribute to get other, non-main resources?
}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
index a36ff0d..33f68cf 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
@@ -57,6 +57,7 @@
private final ProximitySensor mProximitySensor;
private final DelayedWakeLock.Builder mDelayedWakeLockBuilder;
private final Handler mHandler;
+ private final BiometricUnlockController mBiometricUnlockController;
@Inject
public DozeFactory(FalsingManager falsingManager, DozeLog dozeLog,
@@ -65,7 +66,8 @@
WakefulnessLifecycle wakefulnessLifecycle, KeyguardUpdateMonitor keyguardUpdateMonitor,
DockManager dockManager, @Nullable IWallpaperManager wallpaperManager,
ProximitySensor proximitySensor,
- DelayedWakeLock.Builder delayedWakeLockBuilder, Handler handler) {
+ DelayedWakeLock.Builder delayedWakeLockBuilder, Handler handler,
+ BiometricUnlockController biometricUnlockController) {
mFalsingManager = falsingManager;
mDozeLog = dozeLog;
mDozeParameters = dozeParameters;
@@ -79,6 +81,7 @@
mProximitySensor = proximitySensor;
mDelayedWakeLockBuilder = delayedWakeLockBuilder;
mHandler = handler;
+ mBiometricUnlockController = biometricUnlockController;
}
/** Creates a DozeMachine with its parts for {@code dozeService}. */
@@ -107,9 +110,7 @@
createDozeScreenBrightness(dozeService, wrappedService, mAsyncSensorManager, host,
mDozeParameters, mHandler),
new DozeWallpaperState(
- mWallpaperManager,
- getBiometricUnlockController(dozeService),
- mDozeParameters),
+ mWallpaperManager, mBiometricUnlockController, mDozeParameters),
new DozeDockHandler(dozeService, machine, host, config, mHandler, mDockManager),
new DozeAuthRemover(dozeService)
});
@@ -149,10 +150,4 @@
final SystemUIApplication app = (SystemUIApplication) appCandidate;
return app.getComponent(DozeHost.class);
}
-
- public static BiometricUnlockController getBiometricUnlockController(DozeService service) {
- Application appCandidate = service.getApplication();
- final SystemUIApplication app = (SystemUIApplication) appCandidate;
- return app.getComponent(BiometricUnlockController.class);
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
index 1a6bd60..d1047e2 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
@@ -68,6 +68,12 @@
*/
void prepareForGentleSleep(Runnable onDisplayOffCallback);
+ /**
+ * Cancel pending {@code onDisplayOffCallback} callback.
+ * @see #prepareForGentleSleep(Runnable)
+ */
+ void cancelGentleSleep();
+
void onIgnoreTouchWhilePulsing(boolean ignore);
/**
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeScreenState.java b/packages/SystemUI/src/com/android/systemui/doze/DozeScreenState.java
index 95c42fc..e1b4f31 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeScreenState.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeScreenState.java
@@ -71,7 +71,7 @@
@Override
public void transitionTo(DozeMachine.State oldState, DozeMachine.State newState) {
int screenState = newState.screenState(mParameters);
- mDozeHost.prepareForGentleSleep(null);
+ mDozeHost.cancelGentleSleep();
if (newState == DozeMachine.State.FINISH) {
// Make sure not to apply the screen state after DozeService was destroyed.
diff --git a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java
index b4cc571..1b4857e 100644
--- a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java
+++ b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java
@@ -22,7 +22,7 @@
import com.android.systemui.ConfigurationChangedReceiver;
import com.android.systemui.Dumpable;
-import com.android.systemui.SystemUIRootComponent;
+import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.qs.QSFragment;
import com.android.systemui.statusbar.phone.NavigationBarFragment;
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
index 5723afd..c452f64 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -90,7 +90,7 @@
public static final int MESSAGE_UPDATE_ACTIONS = 4;
public static final int MESSAGE_UPDATE_DISMISS_FRACTION = 5;
public static final int MESSAGE_ANIMATION_ENDED = 6;
- public static final int MESSAGE_TOUCH_EVENT = 7;
+ public static final int MESSAGE_POINTER_EVENT = 7;
private static final int INITIAL_DISMISS_DELAY = 3500;
private static final int POST_INTERACTION_DISMISS_DELAY = 2000;
@@ -165,9 +165,9 @@
break;
}
- case MESSAGE_TOUCH_EVENT: {
+ case MESSAGE_POINTER_EVENT: {
final MotionEvent ev = (MotionEvent) msg.obj;
- dispatchTouchEvent(ev);
+ dispatchPointerEvent(ev);
break;
}
}
@@ -219,6 +219,9 @@
updateFromIntent(getIntent());
setTitle(R.string.pip_menu_title);
setDisablePreviewScreenshots(true);
+
+ // Hide without an animation.
+ getWindow().setExitTransition(null);
}
@Override
@@ -269,6 +272,17 @@
}
}
+ /**
+ * Dispatch a pointer event from {@link PipTouchHandler}.
+ */
+ private void dispatchPointerEvent(MotionEvent event) {
+ if (event.isTouchEvent()) {
+ dispatchTouchEvent(event);
+ } else {
+ dispatchGenericMotionEvent(event);
+ }
+ }
+
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (!mAllowTouches) {
@@ -288,8 +302,6 @@
public void finish() {
notifyActivityCallback(null);
super.finish();
- // Hide without an animation (the menu should already be invisible at this point)
- overridePendingTransition(0, 0);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
index 62c59e5..b8e0b81 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
@@ -508,12 +508,12 @@
}
/**
- * Handles touch event sent from pip input consumer.
+ * Handles a pointer event sent from pip input consumer.
*/
- void handleTouchEvent(MotionEvent ev) {
+ void handlePointerEvent(MotionEvent ev) {
if (mToActivityMessenger != null) {
Message m = Message.obtain();
- m.what = PipMenuActivity.MESSAGE_TOUCH_EVENT;
+ m.what = PipMenuActivity.MESSAGE_POINTER_EVENT;
m.obj = ev;
try {
mToActivityMessenger.send(m);
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index 1f36d97..f59b372 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -132,6 +132,7 @@
private boolean mSendingHoverAccessibilityEvents;
private boolean mMovementWithinMinimize;
private boolean mMovementWithinDismiss;
+ private PipAccessibilityInteractionConnection mConnection;
// Touch state
private final PipTouchState mTouchState;
@@ -213,9 +214,10 @@
// Register the listener for input consumer touch events
inputConsumerController.setInputListener(this::handleTouchEvent);
inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
- onRegistrationChanged(inputConsumerController.isRegistered());
mPipBoundsHandler = pipBoundsHandler;
+ mConnection = new PipAccessibilityInteractionConnection(mMotionHelper,
+ this::onAccessibilityShowMenu, mHandler);
}
public void setTouchEnabled(boolean enabled) {
@@ -339,9 +341,7 @@
private void onRegistrationChanged(boolean isRegistered) {
mAccessibilityManager.setPictureInPictureActionReplacingConnection(isRegistered
- ? new PipAccessibilityInteractionConnection(mMotionHelper,
- this::onAccessibilityShowMenu, mHandler) : null);
-
+ ? mConnection : null);
if (!isRegistered && mTouchState.isUserInteracting()) {
// If the input consumer is unregistered while the user is interacting, then we may not
// get the final TOUCH_UP event, so clean up the dismiss target as well
@@ -409,27 +409,15 @@
}
case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_MOVE: {
- if (mAccessibilityManager.isEnabled() && !mSendingHoverAccessibilityEvents) {
- AccessibilityEvent event = AccessibilityEvent.obtain(
- AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
- event.setImportantForAccessibility(true);
- event.setSourceNodeId(AccessibilityNodeInfo.ROOT_NODE_ID);
- event.setWindowId(
- AccessibilityWindowInfo.PICTURE_IN_PICTURE_ACTION_REPLACER_WINDOW_ID);
- mAccessibilityManager.sendAccessibilityEvent(event);
+ if (!shouldDeliverToMenu && !mSendingHoverAccessibilityEvents) {
+ sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
mSendingHoverAccessibilityEvents = true;
}
break;
}
case MotionEvent.ACTION_HOVER_EXIT: {
- if (mAccessibilityManager.isEnabled() && mSendingHoverAccessibilityEvents) {
- AccessibilityEvent event = AccessibilityEvent.obtain(
- AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
- event.setImportantForAccessibility(true);
- event.setSourceNodeId(AccessibilityNodeInfo.ROOT_NODE_ID);
- event.setWindowId(
- AccessibilityWindowInfo.PICTURE_IN_PICTURE_ACTION_REPLACER_WINDOW_ID);
- mAccessibilityManager.sendAccessibilityEvent(event);
+ if (!shouldDeliverToMenu && mSendingHoverAccessibilityEvents) {
+ sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
mSendingHoverAccessibilityEvents = false;
}
break;
@@ -445,12 +433,25 @@
mMenuController.pokeMenu();
}
- mMenuController.handleTouchEvent(cloneEvent);
+ mMenuController.handlePointerEvent(cloneEvent);
}
return true;
}
+ private void sendAccessibilityHoverEvent(int type) {
+ if (!mAccessibilityManager.isEnabled()) {
+ return;
+ }
+
+ AccessibilityEvent event = AccessibilityEvent.obtain(type);
+ event.setImportantForAccessibility(true);
+ event.setSourceNodeId(AccessibilityNodeInfo.ROOT_NODE_ID);
+ event.setWindowId(
+ AccessibilityWindowInfo.PICTURE_IN_PICTURE_ACTION_REPLACER_WINDOW_ID);
+ mAccessibilityManager.sendAccessibilityEvent(event);
+ }
+
/**
* Updates the appearance of the menu and scrim on top of the PiP while dismissing.
*/
@@ -523,6 +524,10 @@
* Sets the menu visibility.
*/
private void setMenuState(int menuState, boolean resize) {
+ if (mMenuState == menuState && !resize) {
+ return;
+ }
+
if (menuState == MENU_STATE_FULL && mMenuState != MENU_STATE_FULL) {
// Save the current snap fraction and if we do not drag or move the PiP, then
// we store back to this snap fraction. Otherwise, we'll reset the snap
@@ -571,6 +576,9 @@
}
mMenuState = menuState;
updateMovementBounds(menuState);
+ // If pip menu has dismissed, we should register the A11y ActionReplacingConnection for pip
+ // as well, or it can't handle a11y focus and pip menu can't perform any action.
+ onRegistrationChanged(menuState == MENU_STATE_NONE);
if (menuState != MENU_STATE_CLOSE) {
MetricsLoggerWrapper.logPictureInPictureMenuVisible(mContext, menuState == MENU_STATE_FULL);
}
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
index 98f0b2a..f60d9db 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
@@ -55,7 +55,11 @@
import java.util.concurrent.Future;
import javax.inject.Inject;
+import javax.inject.Singleton;
+import dagger.Lazy;
+
+@Singleton
public class PowerUI extends SystemUI {
static final String TAG = "PowerUI";
@@ -101,11 +105,14 @@
private IThermalEventListener mSkinThermalEventListener;
private IThermalEventListener mUsbThermalEventListener;
private final BroadcastDispatcher mBroadcastDispatcher;
+ private final Lazy<StatusBar> mStatusBarLazy;
@Inject
- public PowerUI(Context context, BroadcastDispatcher broadcastDispatcher) {
+ public PowerUI(Context context, BroadcastDispatcher broadcastDispatcher,
+ Lazy<StatusBar> statusBarLazy) {
super(context);
mBroadcastDispatcher = broadcastDispatcher;
+ mStatusBarLazy = statusBarLazy;
}
public void start() {
@@ -663,8 +670,7 @@
int status = temp.getStatus();
if (status >= Temperature.THROTTLING_EMERGENCY) {
- StatusBar statusBar = getComponent(StatusBar.class);
- if (statusBar != null && !statusBar.isDeviceInVrMode()) {
+ if (!mStatusBarLazy.get().isDeviceInVrMode()) {
mWarnings.showHighTemperatureWarning();
Slog.d(TAG, "SkinThermalEventListener: notifyThrottling was called "
+ ", current skin status = " + status
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
index 631b8b7..22fb4c0 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
@@ -22,25 +22,20 @@
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
-import android.os.Handler
-import android.os.Looper
-import android.os.Message
-import android.os.UserHandle
-import android.os.UserManager
+import android.os.*
import android.provider.DeviceConfig
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags
-import com.android.systemui.Dependency.BG_HANDLER_NAME
-import com.android.systemui.Dependency.MAIN_HANDLER_NAME
+import com.android.systemui.Dumpable
import com.android.systemui.R
import com.android.systemui.appops.AppOpItem
import com.android.systemui.appops.AppOpsController
-import com.android.systemui.Dumpable
+import com.android.systemui.dagger.qualifiers.BgHandler
+import com.android.systemui.dagger.qualifiers.MainHandler
import java.io.FileDescriptor
import java.io.PrintWriter
import java.lang.ref.WeakReference
import javax.inject.Inject
-import javax.inject.Named
import javax.inject.Singleton
fun isPermissionsHubEnabled() = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
@@ -50,8 +45,8 @@
class PrivacyItemController @Inject constructor(
val context: Context,
private val appOpsController: AppOpsController,
- @Named(MAIN_HANDLER_NAME) private val uiHandler: Handler,
- @Named(BG_HANDLER_NAME) private val bgHandler: Handler
+ @MainHandler private val uiHandler: Handler,
+ @BgHandler private val bgHandler: Handler
) : Dumpable {
@VisibleForTesting
diff --git a/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt b/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt
new file mode 100644
index 0000000..f710f7f
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt
@@ -0,0 +1,133 @@
+/*
+ * 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.systemui.qs
+
+import android.content.Context
+import android.content.res.Configuration
+import android.view.View
+import android.view.ViewGroup
+import com.android.systemui.R
+import com.android.systemui.qs.TileLayout.exactly
+
+class DoubleLineTileLayout(context: Context) : ViewGroup(context), QSPanel.QSTileLayout {
+
+ protected val mRecords = ArrayList<QSPanel.TileRecord>()
+ private var _listening = false
+ private var smallTileSize = 0
+ private val twoLineHeight
+ get() = smallTileSize * 2 + cellMarginVertical
+ private var cellMarginHorizontal = 0
+ private var cellMarginVertical = 0
+
+ init {
+ isFocusableInTouchMode = true
+ clipChildren = false
+ clipToPadding = false
+
+ updateResources()
+ }
+
+ override fun addTile(tile: QSPanel.TileRecord) {
+ mRecords.add(tile)
+ tile.tile.setListening(this, _listening)
+ addTileView(tile)
+ }
+
+ protected fun addTileView(tile: QSPanel.TileRecord) {
+ addView(tile.tileView)
+ }
+
+ override fun removeTile(tile: QSPanel.TileRecord) {
+ mRecords.remove(tile)
+ tile.tile.setListening(this, false)
+ removeView(tile.tileView)
+ }
+
+ override fun removeAllViews() {
+ mRecords.forEach { it.tile.setListening(this, false) }
+ mRecords.clear()
+ super.removeAllViews()
+ }
+
+ override fun getOffsetTop(tile: QSPanel.TileRecord?) = top
+
+ override fun updateResources(): Boolean {
+ with(mContext.resources) {
+ smallTileSize = getDimensionPixelSize(R.dimen.qs_quick_tile_size)
+ cellMarginHorizontal = getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal)
+ cellMarginVertical = getDimensionPixelSize(R.dimen.new_qs_vertical_margin)
+ }
+ requestLayout()
+ return false
+ }
+
+ override fun setListening(listening: Boolean) {
+ if (_listening == listening) return
+ _listening = listening
+ for (record in mRecords) {
+ record.tile.setListening(this, listening)
+ }
+ }
+
+ override fun getNumVisibleTiles() = mRecords.size
+
+ override fun onConfigurationChanged(newConfig: Configuration) {
+ super.onConfigurationChanged(newConfig)
+ updateResources()
+ }
+
+ override fun onFinishInflate() {
+ updateResources()
+ }
+
+ override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
+ var previousView: View = this
+ var tiles = 0
+
+ mRecords.forEach {
+ val tileView = it.tileView
+ if (tileView.visibility != View.GONE) {
+ tileView.updateAccessibilityOrder(previousView)
+ previousView = tileView
+ tiles++
+ tileView.measure(exactly(smallTileSize), exactly(smallTileSize))
+ }
+ }
+
+ val height = twoLineHeight
+ val columns = tiles / 2
+ val width = paddingStart + paddingEnd +
+ columns * smallTileSize +
+ (columns - 1) * cellMarginHorizontal
+ setMeasuredDimension(width, height)
+ }
+
+ override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
+ val tiles = mRecords.filter { it.tileView.visibility != View.GONE }
+ tiles.forEachIndexed {
+ index, tile ->
+ val column = index % (tiles.size / 2)
+ val left = getLeftForColumn(column)
+ val top = if (index < tiles.size / 2) 0 else getTopBottomRow()
+ tile.tileView.layout(left, top, left + smallTileSize, top + smallTileSize)
+ }
+ }
+
+ private fun getLeftForColumn(column: Int) = column * (smallTileSize + cellMarginHorizontal)
+
+ private fun getTopBottomRow() = smallTileSize + cellMarginVertical
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
index 9221b68..a267bbb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
@@ -14,6 +14,7 @@
package com.android.systemui.qs;
+import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
@@ -267,6 +268,17 @@
mAllViews.add(tileView);
count++;
}
+
+
+ int flag = Settings.System.getInt(mQsPanel.getContext().getContentResolver(),
+ "qs_media_player", 0);
+ if (flag == 1) {
+ View qsMediaView = mQsPanel.getMediaPanel();
+ View qqsMediaView = mQuickQsPanel.getMediaPlayer().getView();
+ translationXBuilder.addFloat(qsMediaView, "alpha", 0, 1);
+ translationXBuilder.addFloat(qqsMediaView, "alpha", 1, 0);
+ }
+
if (mAllowFancy) {
// Make brightness appear static position and alpha in through second half.
View brightness = mQsPanel.getBrightnessView();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
index b9f3a7f..5742787 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
@@ -17,9 +17,7 @@
package com.android.systemui.qs;
import static com.android.systemui.Dependency.BG_HANDLER;
-import static com.android.systemui.Dependency.BG_HANDLER_NAME;
import static com.android.systemui.Dependency.MAIN_LOOPER;
-import static com.android.systemui.Dependency.MAIN_LOOPER_NAME;
import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
import android.annotation.MainThread;
@@ -41,6 +39,8 @@
import com.android.keyguard.CarrierTextController;
import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.BgHandler;
+import com.android.systemui.dagger.qualifiers.MainLooper;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.policy.NetworkController;
@@ -77,8 +77,8 @@
@Inject
public QSCarrierGroup(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
NetworkController networkController, ActivityStarter activityStarter,
- @Named(BG_HANDLER_NAME) Handler handler,
- @Named(MAIN_LOOPER_NAME) Looper looper) {
+ @BgHandler Handler handler,
+ @MainLooper Looper looper) {
super(context, attrs);
mNetworkController = networkController;
mActivityStarter = activityStarter;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSMediaPlayer.java b/packages/SystemUI/src/com/android/systemui/qs/QSMediaPlayer.java
new file mode 100644
index 0000000..6949640
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSMediaPlayer.java
@@ -0,0 +1,306 @@
+/*
+ * 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.systemui.qs;
+
+import android.app.Notification;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.ColorStateList;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.Icon;
+import android.graphics.drawable.RippleDrawable;
+import android.media.MediaMetadata;
+import android.media.session.MediaController;
+import android.media.session.MediaSession;
+import android.media.session.PlaybackState;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RemoteViews;
+import android.widget.TextView;
+
+import androidx.core.graphics.drawable.RoundedBitmapDrawable;
+import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
+
+import com.android.settingslib.media.MediaOutputSliceConstants;
+import com.android.systemui.Dependency;
+import com.android.systemui.R;
+import com.android.systemui.plugins.ActivityStarter;
+
+/**
+ * Single media player for carousel in QSPanel
+ */
+public class QSMediaPlayer {
+
+ private static final String TAG = "QSMediaPlayer";
+
+ private Context mContext;
+ private LinearLayout mMediaNotifView;
+ private MediaSession.Token mToken;
+ private MediaController mController;
+ private int mWidth;
+ private int mHeight;
+
+ /**
+ *
+ * @param context
+ * @param parent
+ * @param width
+ * @param height
+ */
+ public QSMediaPlayer(Context context, ViewGroup parent, int width, int height) {
+ mContext = context;
+ LayoutInflater inflater = LayoutInflater.from(mContext);
+ mMediaNotifView = (LinearLayout) inflater.inflate(R.layout.qs_media_panel, parent, false);
+
+ mWidth = width;
+ mHeight = height;
+ }
+
+ public View getView() {
+ return mMediaNotifView;
+ }
+
+ /**
+ *
+ * @param token token for this media session
+ * @param icon app notification icon
+ * @param iconColor foreground color (for text, icons)
+ * @param bgColor background color
+ * @param actionsContainer a LinearLayout containing the media action buttons
+ * @param notif
+ */
+ public void setMediaSession(MediaSession.Token token, Icon icon, int iconColor, int bgColor,
+ View actionsContainer, Notification notif) {
+ Log.d(TAG, "got media session: " + token);
+ mToken = token;
+ mController = new MediaController(mContext, token);
+ MediaMetadata mMediaMetadata = mController.getMetadata();
+
+ if (mMediaMetadata == null) {
+ Log.e(TAG, "Media metadata was null");
+ return;
+ }
+
+ Notification.Builder builder = Notification.Builder.recoverBuilder(mContext, notif);
+
+ // Album art
+ addAlbumArtBackground(mMediaMetadata, bgColor, mWidth, mHeight);
+
+ // Reuse notification header instead of reimplementing everything
+ RemoteViews headerRemoteView = builder.makeNotificationHeader();
+ LinearLayout headerView = mMediaNotifView.findViewById(R.id.header);
+ View result = headerRemoteView.apply(mContext, headerView);
+ result.setPadding(0, 0, 0, 0);
+ LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, 75);
+ result.setLayoutParams(lp);
+ headerView.removeAllViews();
+ headerView.addView(result);
+
+ View seamless = headerView.findViewById(com.android.internal.R.id.media_seamless);
+ seamless.setVisibility(View.VISIBLE);
+
+ // App icon
+ ImageView appIcon = headerView.findViewById(com.android.internal.R.id.icon);
+ Drawable iconDrawable = icon.loadDrawable(mContext);
+ iconDrawable.setTint(iconColor);
+ appIcon.setImageDrawable(iconDrawable);
+
+ // App title
+ TextView appName = headerView.findViewById(com.android.internal.R.id.app_name_text);
+ String appNameString = builder.loadHeaderAppName();
+ appName.setText(appNameString);
+ appName.setTextColor(iconColor);
+
+ // Action
+ mMediaNotifView.setOnClickListener(v -> {
+ try {
+ notif.contentIntent.send();
+ // Also close shade
+ mContext.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
+ } catch (PendingIntent.CanceledException e) {
+ Log.e(TAG, "Pending intent was canceled");
+ e.printStackTrace();
+ }
+ });
+
+ // Separator
+ TextView separator = headerView.findViewById(com.android.internal.R.id.header_text_divider);
+ separator.setTextColor(iconColor);
+
+ // Album name
+ TextView albumName = headerView.findViewById(com.android.internal.R.id.header_text);
+ String albumString = mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ALBUM);
+ if (TextUtils.isEmpty(albumString)) {
+ albumName.setVisibility(View.GONE);
+ separator.setVisibility(View.GONE);
+ } else {
+ albumName.setText(albumString);
+ albumName.setTextColor(iconColor);
+ albumName.setVisibility(View.VISIBLE);
+ separator.setVisibility(View.VISIBLE);
+ }
+
+ // Transfer chip
+ View transferBackgroundView = headerView.findViewById(
+ com.android.internal.R.id.media_seamless);
+ LinearLayout viewLayout = (LinearLayout) transferBackgroundView;
+ RippleDrawable bkgDrawable = (RippleDrawable) viewLayout.getBackground();
+ GradientDrawable rect = (GradientDrawable) bkgDrawable.getDrawable(0);
+ rect.setStroke(2, iconColor);
+ rect.setColor(bgColor);
+ ImageView transferIcon = headerView.findViewById(
+ com.android.internal.R.id.media_seamless_image);
+ transferIcon.setBackgroundColor(bgColor);
+ transferIcon.setImageTintList(ColorStateList.valueOf(iconColor));
+ TextView transferText = headerView.findViewById(
+ com.android.internal.R.id.media_seamless_text);
+ transferText.setTextColor(iconColor);
+
+ ActivityStarter mActivityStarter = Dependency.get(ActivityStarter.class);
+ transferBackgroundView.setOnClickListener(v -> {
+ final Intent intent = new Intent()
+ .setAction(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT);
+ mActivityStarter.startActivity(intent, false, true /* dismissShade */,
+ Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ });
+
+ // Artist name
+ TextView artistText = mMediaNotifView.findViewById(R.id.header_title);
+ String artistName = mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ARTIST);
+ artistText.setText(artistName);
+ artistText.setTextColor(iconColor);
+
+ // Song name
+ TextView titleText = mMediaNotifView.findViewById(R.id.header_text);
+ String songName = mMediaMetadata.getString(MediaMetadata.METADATA_KEY_TITLE);
+ titleText.setText(songName);
+ titleText.setTextColor(iconColor);
+
+ // Media controls
+ LinearLayout parentActionsLayout = (LinearLayout) actionsContainer;
+ final int[] actionIds = {
+ R.id.action0,
+ R.id.action1,
+ R.id.action2,
+ R.id.action3,
+ R.id.action4
+ };
+ final int[] notifActionIds = {
+ com.android.internal.R.id.action0,
+ com.android.internal.R.id.action1,
+ com.android.internal.R.id.action2,
+ com.android.internal.R.id.action3,
+ com.android.internal.R.id.action4
+ };
+ for (int i = 0; i < parentActionsLayout.getChildCount() && i < actionIds.length; i++) {
+ ImageButton thisBtn = mMediaNotifView.findViewById(actionIds[i]);
+ ImageButton thatBtn = parentActionsLayout.findViewById(notifActionIds[i]);
+ if (thatBtn == null || thatBtn.getDrawable() == null) {
+ thisBtn.setVisibility(View.GONE);
+ continue;
+ }
+
+ Drawable thatIcon = thatBtn.getDrawable();
+ thisBtn.setImageDrawable(thatIcon.mutate());
+ thisBtn.setVisibility(View.VISIBLE);
+ thisBtn.setOnClickListener(v -> {
+ Log.d(TAG, "clicking on other button");
+ thatBtn.performClick();
+ });
+ }
+ }
+
+ public MediaSession.Token getMediaSessionToken() {
+ return mToken;
+ }
+
+ public String getMediaPlayerPackage() {
+ return mController.getPackageName();
+ }
+
+ /**
+ * Check whether the media controlled by this player is currently playing
+ * @return whether it is playing, or false if no controller information
+ */
+ public boolean isPlaying() {
+ if (mController == null) {
+ return false;
+ }
+
+ PlaybackState state = mController.getPlaybackState();
+ if (state == null) {
+ return false;
+ }
+
+ return (state.getState() == PlaybackState.STATE_PLAYING);
+ }
+
+ private void addAlbumArtBackground(MediaMetadata metadata, int bgColor, int width, int height) {
+ Bitmap albumArt = metadata.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART);
+ if (albumArt != null) {
+
+ Bitmap original = albumArt.copy(Bitmap.Config.ARGB_8888, true);
+ Bitmap scaled = scaleBitmap(original, width, height);
+ Canvas canvas = new Canvas(scaled);
+
+ // Add translucent layer over album art to improve contrast
+ Paint p = new Paint();
+ p.setStyle(Paint.Style.FILL);
+ p.setColor(bgColor);
+ p.setAlpha(200);
+ canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), p);
+
+ RoundedBitmapDrawable roundedDrawable = RoundedBitmapDrawableFactory.create(
+ mContext.getResources(), scaled);
+ roundedDrawable.setCornerRadius(20);
+
+ mMediaNotifView.setBackground(roundedDrawable);
+ } else {
+ Log.e(TAG, "No album art available");
+ }
+ }
+
+ private Bitmap scaleBitmap(Bitmap original, int width, int height) {
+ Bitmap cropped = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(cropped);
+
+ float scale = (float) cropped.getWidth() / (float) original.getWidth();
+ float dy = (cropped.getHeight() - original.getHeight() * scale) / 2.0f;
+ Matrix transformation = new Matrix();
+ transformation.postTranslate(0, dy);
+ transformation.preScale(scale, scale);
+
+ Paint paint = new Paint();
+ paint.setFilterBitmap(true);
+ canvas.drawBitmap(original, transformation, paint);
+
+ return cropped;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 2e24403..b48814b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -24,16 +24,22 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.drawable.Icon;
+import android.media.session.MediaSession;
import android.metrics.LogMaker;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
+import android.service.notification.StatusBarNotification;
import android.service.quicksettings.Tile;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.FrameLayout;
+import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import com.android.internal.logging.MetricsLogger;
@@ -82,6 +88,9 @@
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private final QSTileRevealController mQsTileRevealController;
+ private final LinearLayout mMediaCarousel;
+ private final ArrayList<QSMediaPlayer> mMediaPlayers = new ArrayList<>();
+
protected boolean mExpanded;
protected boolean mListening;
@@ -140,6 +149,28 @@
addDivider();
+ // Add media carousel
+ int flag = Settings.System.getInt(context.getContentResolver(), "qs_media_player", 0);
+ if (flag == 1) {
+ HorizontalScrollView mediaScrollView = new HorizontalScrollView(mContext);
+ mediaScrollView.setHorizontalScrollBarEnabled(false);
+ int playerHeight = (int) getResources().getDimension(R.dimen.qs_media_height);
+ int padding = (int) getResources().getDimension(R.dimen.qs_media_padding);
+ LayoutParams lpView = new LayoutParams(LayoutParams.MATCH_PARENT, playerHeight);
+ lpView.setMarginStart(padding);
+ lpView.setMarginEnd(padding);
+ addView(mediaScrollView, lpView);
+
+ LayoutParams lpCarousel = new LayoutParams(LayoutParams.MATCH_PARENT,
+ LayoutParams.WRAP_CONTENT);
+ mMediaCarousel = new LinearLayout(mContext);
+ mMediaCarousel.setOrientation(LinearLayout.HORIZONTAL);
+ mediaScrollView.addView(mMediaCarousel, lpCarousel);
+ mediaScrollView.setVisibility(View.GONE);
+ } else {
+ mMediaCarousel = null;
+ }
+
mFooter = new QSSecurityFooter(this, context);
addView(mFooter.getView());
@@ -159,6 +190,76 @@
}
+ /**
+ * Add or update a player for the associated media session
+ * @param token
+ * @param icon
+ * @param iconColor
+ * @param bgColor
+ * @param actionsContainer
+ * @param notif
+ */
+ public void addMediaSession(MediaSession.Token token, Icon icon, int iconColor, int bgColor,
+ View actionsContainer, StatusBarNotification notif) {
+ int flag = Settings.System.getInt(mContext.getContentResolver(), "qs_media_player", 0);
+ if (flag != 1) {
+ // Shouldn't happen, but just in case
+ Log.e(TAG, "Tried to add media session without player!");
+ return;
+ }
+ QSMediaPlayer player = null;
+ String packageName = notif.getPackageName();
+ for (QSMediaPlayer p : mMediaPlayers) {
+ if (p.getMediaSessionToken().equals(token)) {
+ Log.d(TAG, "a player for this session already exists");
+ player = p;
+ break;
+ }
+
+ if (packageName.equals(p.getMediaPlayerPackage())) {
+ Log.d(TAG, "found an old session for this app");
+ player = p;
+ break;
+ }
+ }
+
+ int playerHeight = (int) getResources().getDimension(R.dimen.qs_media_height);
+ int playerWidth = (int) getResources().getDimension(R.dimen.qs_media_width);
+ int padding = (int) getResources().getDimension(R.dimen.qs_media_padding);
+ LayoutParams lp = new LayoutParams(playerWidth, ViewGroup.LayoutParams.MATCH_PARENT);
+ lp.setMarginStart(padding);
+ lp.setMarginEnd(padding);
+
+ if (player == null) {
+ Log.d(TAG, "creating new player");
+
+ player = new QSMediaPlayer(mContext, this, playerWidth, playerHeight);
+
+ if (player.isPlaying()) {
+ mMediaCarousel.addView(player.getView(), 0, lp); // add in front
+ } else {
+ mMediaCarousel.addView(player.getView(), lp); // add at end
+ }
+ mMediaPlayers.add(player);
+ } else if (player.isPlaying()) {
+ // move it to the front
+ mMediaCarousel.removeView(player.getView());
+ mMediaCarousel.addView(player.getView(), 0, lp);
+ }
+
+ Log.d(TAG, "setting player session");
+ player.setMediaSession(token, icon, iconColor, bgColor, actionsContainer,
+ notif.getNotification());
+
+ if (mMediaPlayers.size() > 0) {
+ ((View) mMediaCarousel.getParent()).setVisibility(View.VISIBLE);
+ }
+ }
+
+ protected View getMediaPanel() {
+ return mMediaCarousel;
+ }
+
protected void addDivider() {
mDivider = LayoutInflater.from(mContext).inflate(R.layout.qs_divider, this, false);
mDivider.setBackgroundColor(Utils.applyAlpha(mDivider.getAlpha(),
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
index 1e763cf..b395c3c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
@@ -30,11 +30,12 @@
import android.text.TextUtils;
import android.util.Log;
-import com.android.systemui.Dependency;
import com.android.systemui.DumpController;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.SysUiServiceProvider;
+import com.android.systemui.dagger.qualifiers.BgLooper;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.qs.QSFactory;
import com.android.systemui.plugins.qs.QSTile;
@@ -61,7 +62,6 @@
import java.util.function.Predicate;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
@@ -94,8 +94,8 @@
public QSTileHost(Context context,
StatusBarIconController iconController,
QSFactoryImpl defaultFactory,
- @Named(Dependency.MAIN_HANDLER_NAME) Handler mainHandler,
- @Named(Dependency.BG_LOOPER_NAME) Looper bgLooper,
+ @MainHandler Handler mainHandler,
+ @BgLooper Looper bgLooper,
PluginManager pluginManager,
TunerService tunerService,
Provider<AutoTileManager> autoTiles,
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSMediaPlayer.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSMediaPlayer.java
new file mode 100644
index 0000000..3ec71ac
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSMediaPlayer.java
@@ -0,0 +1,208 @@
+/*
+ * 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.systemui.qs;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
+import android.media.MediaMetadata;
+import android.media.session.MediaController;
+import android.media.session.MediaSession;
+import android.media.session.PlaybackState;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.core.graphics.drawable.RoundedBitmapDrawable;
+import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
+
+import com.android.systemui.R;
+
+/**
+ * QQS mini media player
+ */
+public class QuickQSMediaPlayer {
+
+ private static final String TAG = "QQSMediaPlayer";
+
+ private Context mContext;
+ private LinearLayout mMediaNotifView;
+ private MediaSession.Token mToken;
+ private MediaController mController;
+
+ /**
+ *
+ * @param context
+ * @param parent
+ */
+ public QuickQSMediaPlayer(Context context, ViewGroup parent) {
+ mContext = context;
+ LayoutInflater inflater = LayoutInflater.from(mContext);
+ mMediaNotifView = (LinearLayout) inflater.inflate(R.layout.qqs_media_panel, parent, false);
+ }
+
+ public View getView() {
+ return mMediaNotifView;
+ }
+
+ /**
+ *
+ * @param token token for this media session
+ * @param icon app notification icon
+ * @param iconColor foreground color (for text, icons)
+ * @param bgColor background color
+ * @param actionsContainer a LinearLayout containing the media action buttons
+ */
+ public void setMediaSession(MediaSession.Token token, Icon icon, int iconColor, int bgColor,
+ View actionsContainer) {
+ Log.d(TAG, "Setting media session: " + token);
+ mToken = token;
+ mController = new MediaController(mContext, token);
+ MediaMetadata mMediaMetadata = mController.getMetadata();
+
+ if (mMediaMetadata == null) {
+ Log.e(TAG, "Media metadata was null");
+ return;
+ }
+
+ // Album art
+ addAlbumArtBackground(mMediaMetadata, bgColor);
+
+ // App icon
+ ImageView appIcon = mMediaNotifView.findViewById(R.id.icon);
+ Drawable iconDrawable = icon.loadDrawable(mContext);
+ iconDrawable.setTint(iconColor);
+ appIcon.setImageDrawable(iconDrawable);
+
+ // Artist name
+ TextView appText = mMediaNotifView.findViewById(R.id.header_title);
+ String artistName = mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ARTIST);
+ appText.setText(artistName);
+ appText.setTextColor(iconColor);
+
+ // Song name
+ TextView titleText = mMediaNotifView.findViewById(R.id.header_text);
+ String songName = mMediaMetadata.getString(MediaMetadata.METADATA_KEY_TITLE);
+ titleText.setText(songName);
+ titleText.setTextColor(iconColor);
+
+ // Action buttons
+ LinearLayout parentActionsLayout = (LinearLayout) actionsContainer;
+ final int[] actionIds = {R.id.action0, R.id.action1, R.id.action2};
+
+ // TODO some apps choose different buttons to show in compact mode
+ final int[] notifActionIds = {
+ com.android.internal.R.id.action1,
+ com.android.internal.R.id.action2,
+ com.android.internal.R.id.action3
+ };
+ for (int i = 0; i < parentActionsLayout.getChildCount() && i < actionIds.length; i++) {
+ ImageButton thisBtn = mMediaNotifView.findViewById(actionIds[i]);
+ ImageButton thatBtn = parentActionsLayout.findViewById(notifActionIds[i]);
+ if (thatBtn == null || thatBtn.getDrawable() == null) {
+ thisBtn.setVisibility(View.GONE);
+ continue;
+ }
+
+ Drawable thatIcon = thatBtn.getDrawable();
+ thisBtn.setImageDrawable(thatIcon.mutate());
+ thisBtn.setVisibility(View.VISIBLE);
+
+ thisBtn.setOnClickListener(v -> {
+ Log.d(TAG, "clicking on other button");
+ thatBtn.performClick();
+ });
+ }
+ }
+
+ public MediaSession.Token getMediaSessionToken() {
+ return mToken;
+ }
+
+ /**
+ * Check whether the media controlled by this player is currently playing
+ * @return whether it is playing, or false if no controller information
+ */
+ public boolean isPlaying() {
+ if (mController == null) {
+ return false;
+ }
+
+ PlaybackState state = mController.getPlaybackState();
+ if (state == null) {
+ return false;
+ }
+
+ return (state.getState() == PlaybackState.STATE_PLAYING);
+ }
+
+ private void addAlbumArtBackground(MediaMetadata metadata, int bgColor) {
+ Bitmap albumArt = metadata.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART);
+ if (albumArt != null) {
+ Rect bounds = new Rect();
+ mMediaNotifView.getBoundsOnScreen(bounds);
+ int width = bounds.width();
+ int height = bounds.height();
+
+ Bitmap original = albumArt.copy(Bitmap.Config.ARGB_8888, true);
+ Bitmap scaled = scaleBitmap(original, width, height);
+ Canvas canvas = new Canvas(scaled);
+
+ // Add translucent layer over album art to improve contrast
+ Paint p = new Paint();
+ p.setStyle(Paint.Style.FILL);
+ p.setColor(bgColor);
+ p.setAlpha(200);
+ canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), p);
+
+ RoundedBitmapDrawable roundedDrawable = RoundedBitmapDrawableFactory.create(
+ mContext.getResources(), scaled);
+ roundedDrawable.setCornerRadius(20);
+
+ mMediaNotifView.setBackground(roundedDrawable);
+ } else {
+ Log.e(TAG, "No album art available");
+ }
+ }
+
+ private Bitmap scaleBitmap(Bitmap original, int width, int height) {
+ Bitmap cropped = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(cropped);
+
+ float scale = (float) cropped.getWidth() / (float) original.getWidth();
+ float dy = (cropped.getHeight() - original.getHeight() * scale) / 2.0f;
+ Matrix transformation = new Matrix();
+ transformation.postTranslate(0, dy);
+ transformation.preScale(scale, scale);
+
+ Paint paint = new Paint();
+ paint.setFilterBitmap(true);
+ canvas.drawBitmap(original, transformation, paint);
+
+ return cropped;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 85aafa0..dcd4633 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
@@ -55,6 +56,7 @@
private boolean mDisabledByPolicy;
private int mMaxTiles;
protected QSPanel mFullPanel;
+ private QuickQSMediaPlayer mMediaPlayer;
@Inject
public QuickQSPanel(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
@@ -69,11 +71,43 @@
}
removeView((View) mTileLayout);
}
- sDefaultMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_columns);
- mTileLayout = new HeaderTileLayout(context);
- mTileLayout.setListening(mListening);
- addView((View) mTileLayout, 0 /* Between brightness and footer */);
- super.setPadding(0, 0, 0, 0);
+
+ int flag = Settings.System.getInt(context.getContentResolver(), "qs_media_player", 0);
+ if (flag == 1) {
+ LinearLayout mHorizontalLinearLayout = new LinearLayout(mContext);
+ mHorizontalLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
+ mHorizontalLinearLayout.setClipChildren(false);
+ mHorizontalLinearLayout.setClipToPadding(false);
+
+ LayoutParams lp = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
+
+ mTileLayout = new DoubleLineTileLayout(context);
+ lp.setMarginEnd(10);
+ lp.setMarginStart(0);
+ mHorizontalLinearLayout.addView((View) mTileLayout, lp);
+
+ mMediaPlayer = new QuickQSMediaPlayer(mContext, mHorizontalLinearLayout);
+
+ lp.setMarginEnd(0);
+ lp.setMarginStart(10);
+ mHorizontalLinearLayout.addView(mMediaPlayer.getView(), lp);
+
+ sDefaultMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_columns);
+
+ mTileLayout.setListening(mListening);
+ addView(mHorizontalLinearLayout, 0 /* Between brightness and footer */);
+ super.setPadding(0, 0, 0, 0);
+ } else {
+ sDefaultMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_columns);
+ mTileLayout = new HeaderTileLayout(context);
+ mTileLayout.setListening(mListening);
+ addView((View) mTileLayout, 0 /* Between brightness and footer */);
+ super.setPadding(0, 0, 0, 0);
+ }
+ }
+
+ public QuickQSMediaPlayer getMediaPlayer() {
+ return mMediaPlayer;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 4013586..592e388 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -392,9 +392,15 @@
mSystemIconsView.setLayoutParams(mSystemIconsView.getLayoutParams());
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
+
+ int flag = Settings.System.getInt(mContext.getContentResolver(), "qs_media_player", 0);
if (mQsDisabled) {
lp.height = resources.getDimensionPixelSize(
com.android.internal.R.dimen.quick_qs_offset_height);
+ } else if (flag == 1) {
+ lp.height = Math.max(getMinimumHeight(),
+ resources.getDimensionPixelSize(
+ com.android.internal.R.dimen.quick_qs_total_height_with_media));
} else {
lp.height = Math.max(getMinimumHeight(),
resources.getDimensionPixelSize(
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
index 1c8e451..9a33c8c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
@@ -145,7 +145,7 @@
return mBluetoothTileProvider.get();
case "controls":
if (Settings.System.getInt(mHost.getContext().getContentResolver(),
- "qs_controls_tile_enabled", 0) == 1) {
+ "npv_plugin_flag", 0) == 3) {
return mControlsTileProvider.get();
} else return null;
case "cell":
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ControlsTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ControlsTile.java
index 0a59618..39ae66e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ControlsTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ControlsTile.java
@@ -22,11 +22,11 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.LinearLayout;
+import android.widget.FrameLayout;
import com.android.systemui.R;
import com.android.systemui.plugins.ActivityStarter;
-import com.android.systemui.plugins.HomeControlsPlugin;
+import com.android.systemui.plugins.NPVPlugin;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.plugins.qs.QSTile.BooleanState;
@@ -44,7 +44,7 @@
private ControlsDetailAdapter mDetailAdapter;
private final ActivityStarter mActivityStarter;
private PluginManager mPluginManager;
- private HomeControlsPlugin mPlugin;
+ private NPVPlugin mPlugin;
private Intent mHomeAppIntent;
@Inject
@@ -81,7 +81,7 @@
public void setDetailListening(boolean listening) {
if (mPlugin == null) return;
- mPlugin.setVisible(listening);
+ mPlugin.setListening(listening);
}
@Override
@@ -142,7 +142,7 @@
private class ControlsDetailAdapter implements DetailAdapter {
private View mDetailView;
- protected LinearLayout mHomeControlsLayout;
+ protected FrameLayout mHomeControlsLayout;
public CharSequence getTitle() {
return "Controls";
@@ -157,24 +157,30 @@
}
public View createDetailView(Context context, View convertView, final ViewGroup parent) {
- mHomeControlsLayout = (LinearLayout) LayoutInflater.from(context).inflate(
- R.layout.home_controls, parent, false);
+ if (convertView != null) return convertView;
+
+ mHomeControlsLayout = (FrameLayout) LayoutInflater.from(context).inflate(
+ R.layout.home_controls, parent, false);
mHomeControlsLayout.setVisibility(View.VISIBLE);
+ parent.addView(mHomeControlsLayout);
+
mPluginManager.addPluginListener(
- new PluginListener<HomeControlsPlugin>() {
+ new PluginListener<NPVPlugin>() {
@Override
- public void onPluginConnected(HomeControlsPlugin plugin,
+ public void onPluginConnected(NPVPlugin plugin,
Context pluginContext) {
mPlugin = plugin;
- mPlugin.sendParentGroup(mHomeControlsLayout);
- mPlugin.setVisible(true);
+ mPlugin.attachToRoot(mHomeControlsLayout);
+ mPlugin.setListening(true);
}
@Override
- public void onPluginDisconnected(HomeControlsPlugin plugin) {
+ public void onPluginDisconnected(NPVPlugin plugin) {
+ mPlugin.setListening(false);
+ mHomeControlsLayout.removeAllViews();
}
- }, HomeControlsPlugin.class, false);
+ }, NPVPlugin.class, false);
return mHomeControlsLayout;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index c9dc08e..34f5437 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -261,9 +261,9 @@
default void showAuthenticationDialog(Bundle bundle,
IBiometricServiceReceiverInternal receiver, int biometricModality,
boolean requireConfirmation, int userId, String opPackageName) { }
- default void onBiometricAuthenticated(boolean authenticated, String failureReason) { }
+ default void onBiometricAuthenticated() { }
default void onBiometricHelp(String message) { }
- default void onBiometricError(int errorCode, String error) { }
+ default void onBiometricError(int modality, int error, int vendorCode) { }
default void hideAuthenticationDialog() { }
/**
@@ -792,12 +792,9 @@
}
@Override
- public void onBiometricAuthenticated(boolean authenticated, String failureReason) {
+ public void onBiometricAuthenticated() {
synchronized (mLock) {
- SomeArgs args = SomeArgs.obtain();
- args.arg1 = authenticated;
- args.arg2 = failureReason;
- mHandler.obtainMessage(MSG_BIOMETRIC_AUTHENTICATED, args).sendToTarget();
+ mHandler.obtainMessage(MSG_BIOMETRIC_AUTHENTICATED).sendToTarget();
}
}
@@ -809,9 +806,13 @@
}
@Override
- public void onBiometricError(int errorCode, String error) {
+ public void onBiometricError(int modality, int error, int vendorCode) {
synchronized (mLock) {
- mHandler.obtainMessage(MSG_BIOMETRIC_ERROR, errorCode, 0, error).sendToTarget();
+ SomeArgs args = SomeArgs.obtain();
+ args.argi1 = modality;
+ args.argi2 = error;
+ args.argi3 = vendorCode;
+ mHandler.obtainMessage(MSG_BIOMETRIC_ERROR, args).sendToTarget();
}
}
@@ -1098,13 +1099,9 @@
break;
}
case MSG_BIOMETRIC_AUTHENTICATED: {
- SomeArgs someArgs = (SomeArgs) msg.obj;
for (int i = 0; i < mCallbacks.size(); i++) {
- mCallbacks.get(i).onBiometricAuthenticated(
- (boolean) someArgs.arg1 /* authenticated */,
- (String) someArgs.arg2 /* failureReason */);
+ mCallbacks.get(i).onBiometricAuthenticated();
}
- someArgs.recycle();
break;
}
case MSG_BIOMETRIC_HELP:
@@ -1113,9 +1110,15 @@
}
break;
case MSG_BIOMETRIC_ERROR:
+ SomeArgs someArgs = (SomeArgs) msg.obj;
for (int i = 0; i < mCallbacks.size(); i++) {
- mCallbacks.get(i).onBiometricError(msg.arg1, (String) msg.obj);
+ mCallbacks.get(i).onBiometricError(
+ someArgs.argi1 /* modality */,
+ someArgs.argi2 /* error */,
+ someArgs.argi3 /* vendorCode */
+ );
}
+ someArgs.recycle();
break;
case MSG_BIOMETRIC_HIDE:
for (int i = 0; i < mCallbacks.size(); i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java
index 0679595..341c49a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java
@@ -16,18 +16,17 @@
package com.android.systemui.statusbar;
-import static com.android.systemui.Dependency.BG_HANDLER_NAME;
-
import android.annotation.NonNull;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.provider.DeviceConfig;
import android.util.ArrayMap;
+import com.android.systemui.dagger.qualifiers.BgHandler;
+
import java.util.Map;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -50,8 +49,7 @@
private final Map<String, Boolean> mCachedDeviceConfigFlags = new ArrayMap<>();
@Inject
- public FeatureFlags(
- @Named(BG_HANDLER_NAME) Handler bgHandler) {
+ public FeatureFlags(@BgHandler Handler bgHandler) {
DeviceConfig.addOnPropertiesChangedListener(
"systemui",
new HandlerExecutor(bgHandler),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
index 275475d6..1f38904 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
@@ -18,7 +18,6 @@
import static android.view.Display.DEFAULT_DISPLAY;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
import static com.android.systemui.SysUiServiceProvider.getComponent;
import android.content.Context;
@@ -38,6 +37,7 @@
import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.systemui.Dependency;
import com.android.systemui.assist.AssistHandleViewController;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -48,7 +48,6 @@
import com.android.systemui.statusbar.policy.BatteryController;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
@@ -67,7 +66,7 @@
SparseArray<NavigationBarFragment> mNavigationBars = new SparseArray<>();
@Inject
- public NavigationBarController(Context context, @Named(MAIN_HANDLER_NAME) Handler handler) {
+ public NavigationBarController(Context context, @MainHandler Handler handler) {
mContext = context;
mHandler = handler;
mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 0988e34..d668665 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -163,7 +163,7 @@
if (!isPlaybackActive(state.getState())) {
clearCurrentMediaNotification();
}
- dispatchUpdateMediaMetaData(true /* changed */, true /* allowAnimation */);
+ findAndUpdateMediaNotifications();
}
}
@@ -200,6 +200,16 @@
mEntryManager = notificationEntryManager;
notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@Override
+ public void onPendingEntryAdded(NotificationEntry entry) {
+ findAndUpdateMediaNotifications();
+ }
+
+ @Override
+ public void onPreEntryUpdated(NotificationEntry entry) {
+ findAndUpdateMediaNotifications();
+ }
+
+ @Override
public void onEntryRemoved(
NotificationEntry entry,
NotificationVisibility visibility,
@@ -272,16 +282,12 @@
boolean metaDataChanged = false;
synchronized (mEntryManager.getNotificationData()) {
- ArrayList<NotificationEntry> activeNotifications =
- mEntryManager.getNotificationData().getActiveNotifications();
- final int N = activeNotifications.size();
+ Set<NotificationEntry> allNotifications = mEntryManager.getAllNotifs();
// Promote the media notification with a controller in 'playing' state, if any.
NotificationEntry mediaNotification = null;
MediaController controller = null;
- for (int i = 0; i < N; i++) {
- final NotificationEntry entry = activeNotifications.get(i);
-
+ for (NotificationEntry entry : allNotifications) {
if (entry.isMediaNotification()) {
final MediaSession.Token token =
entry.getSbn().getNotification().extras.getParcelable(
@@ -319,8 +325,7 @@
// now to see if we have one like this
final String pkg = aController.getPackageName();
- for (int i = 0; i < N; i++) {
- final NotificationEntry entry = activeNotifications.get(i);
+ for (NotificationEntry entry : allNotifications) {
if (entry.getSbn().getPackageName().equals(pkg)) {
if (DEBUG_MEDIA) {
Log.v(TAG, "DEBUG_MEDIA: found controller matching "
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
index 23968d5..c838ac5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
@@ -17,8 +17,6 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -52,6 +50,7 @@
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.NotificationEntryListener;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -69,7 +68,6 @@
import java.util.Set;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Lazy;
@@ -262,7 +260,7 @@
NotificationEntryManager notificationEntryManager,
Lazy<ShadeController> shadeController,
StatusBarStateController statusBarStateController,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
+ @MainHandler Handler mainHandler) {
mContext = context;
mLockscreenUserManager = lockscreenUserManager;
mSmartReplyController = smartReplyController;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
index c2bb5b7..d6b87af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
@@ -16,19 +16,19 @@
package com.android.systemui.statusbar;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.content.Context;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Trace;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -47,7 +47,6 @@
import java.util.Stack;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Lazy;
@@ -88,6 +87,7 @@
private final BubbleController mBubbleController;
private final DynamicPrivacyController mDynamicPrivacyController;
private final KeyguardBypassController mBypassController;
+ private final Context mContext;
private NotificationPresenter mPresenter;
private NotificationListContainer mListContainer;
@@ -99,8 +99,7 @@
private boolean mIsHandleDynamicPrivacyChangeScheduled;
@Inject
- public NotificationViewHierarchyManager(Context context,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler,
+ public NotificationViewHierarchyManager(Context context, @MainHandler Handler mainHandler,
NotificationLockscreenUserManager notificationLockscreenUserManager,
NotificationGroupManager groupManager,
VisualStabilityManager visualStabilityManager,
@@ -110,6 +109,7 @@
KeyguardBypassController bypassController,
BubbleController bubbleController,
DynamicPrivacyController privacyController) {
+ mContext = context;
mHandler = mainHandler;
mLockscreenUserManager = notificationLockscreenUserManager;
mBypassController = bypassController;
@@ -146,7 +146,11 @@
final int N = activeNotifications.size();
for (int i = 0; i < N; i++) {
NotificationEntry ent = activeNotifications.get(i);
+ int flag = Settings.System.getInt(mContext.getContentResolver(),
+ "qs_media_player", 0);
+ boolean hideMedia = (flag == 1);
if (ent.isRowDismissed() || ent.isRowRemoved()
+ || (ent.isMediaNotification() && hideMedia)
|| mBubbleController.isBubbleNotificationSuppressedFromShade(ent.getKey())) {
// we don't want to update removed notifications because they could
// temporarily become children if they were isolated before.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
index f284f73..53fbe5b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.notification;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
@@ -155,7 +156,8 @@
focusedStack.configuration.windowConfiguration
.getWindowingMode();
if (windowingMode == WINDOWING_MODE_FULLSCREEN
- || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
+ || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
+ || windowingMode == WINDOWING_MODE_FREEFORM) {
checkAndPostForStack(focusedStack, notifs, noMan, pm);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryListener.java
index dfc6450..df78fa3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryListener.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryListener.java
@@ -20,12 +20,12 @@
import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
+import androidx.annotation.NonNull;
+
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
-import androidx.annotation.NonNull;
-
/**
* Listener interface for changes sent by NotificationEntryManager.
*/
@@ -37,13 +37,6 @@
default void onPendingEntryAdded(NotificationEntry entry) {
}
- // TODO: Combine this with onPreEntryUpdated into "onBeforeEntryFiltered" or similar
- /**
- * Called when a new entry is created but before it has been filtered or displayed to the user.
- */
- default void onBeforeNotificationAdded(NotificationEntry entry) {
- }
-
/**
* Called when a new entry is created.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
index 6e464f4..404087d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
@@ -53,8 +53,10 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -138,6 +140,14 @@
mNotificationEntryListeners.add(listener);
}
+ /**
+ * Removes a {@link NotificationEntryListener} previously registered via
+ * {@link #addNotificationEntryListener(NotificationEntryListener)}.
+ */
+ public void removeNotificationEntryListener(NotificationEntryListener listener) {
+ mNotificationEntryListeners.remove(listener);
+ }
+
/** Sets the {@link NotificationRemoveInterceptor}. */
public void setNotificationRemoveInterceptor(NotificationRemoveInterceptor interceptor) {
mRemoveInterceptor = interceptor;
@@ -254,9 +264,6 @@
listener.onEntryInflated(entry, inflatedFlags);
}
mNotificationData.add(entry);
- for (NotificationEntryListener listener : mNotificationEntryListeners) {
- listener.onBeforeNotificationAdded(entry);
- }
updateNotifications("onAsyncInflationFinished");
for (NotificationEntryListener listener : mNotificationEntryListeners) {
listener.onNotificationAdded(entry);
@@ -555,6 +562,27 @@
return mPendingNotifications.values();
}
+ /**
+ * @return all notification we're currently aware of (both pending and visible notifications)
+ */
+ public Set<NotificationEntry> getAllNotifs() {
+ Set<NotificationEntry> allNotifs = new HashSet<>(mPendingNotifications.values());
+ allNotifs.addAll(mNotificationData.getActiveNotifications());
+ return allNotifs;
+ }
+
+ /**
+ * Gets the pending or visible notification entry with the given key. Returns null if
+ * notification doesn't exist.
+ */
+ public NotificationEntry getPendingOrCurrentNotif(String key) {
+ if (mPendingNotifications.containsKey(key)) {
+ return mPendingNotifications.get(key);
+ } else {
+ return mNotificationData.get(key);
+ }
+ }
+
private void extendLifetime(NotificationEntry entry, NotificationLifetimeExtender extender) {
NotificationLifetimeExtender activeExtender = mRetainedNotifications.get(entry);
if (activeExtender != null && activeExtender != extender) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java
index 533dfb6..2eefe29 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java
@@ -18,10 +18,6 @@
import static com.android.internal.util.Preconditions.checkNotNull;
-import android.os.UserHandle;
-import android.service.notification.StatusBarNotification;
-import android.util.ArraySet;
-
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.ForegroundServiceController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -70,11 +66,6 @@
boolean removedByUser) {
mListContainer.cleanUpViewStateForEntry(entry);
}
-
- @Override
- public void onBeforeNotificationAdded(NotificationEntry entry) {
- tagForeground(entry.getSbn());
- }
};
private final DeviceProvisionedListener mDeviceProvisionedListener =
@@ -84,29 +75,4 @@
mEntryManager.updateNotifications("device provisioned changed");
}
};
-
- // TODO: This method is horrifically inefficient
- private void tagForeground(StatusBarNotification notification) {
- ArraySet<Integer> activeOps =
- mForegroundServiceController.getAppOps(
- notification.getUserId(), notification.getPackageName());
- if (activeOps != null) {
- int len = activeOps.size();
- for (int i = 0; i < len; i++) {
- updateNotificationsForAppOp(activeOps.valueAt(i), notification.getUid(),
- notification.getPackageName(), true);
- }
- }
- }
-
- /** When an app op changes, propagate that change to notifications. */
- public void updateNotificationsForAppOp(int appOp, int uid, String pkg, boolean showIcon) {
- String foregroundKey =
- mForegroundServiceController.getStandardLayoutKey(UserHandle.getUserId(uid), pkg);
- if (foregroundKey != null) {
- mEntryManager
- .getNotificationData().updateAppOp(appOp, uid, pkg, foregroundKey, showIcon);
- mEntryManager.updateNotifications("app opp changed pkg=" + pkg);
- }
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
index 6fe4abe..1daf484 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.notification;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.os.Handler;
import android.os.SystemClock;
import android.view.View;
@@ -25,6 +23,7 @@
import androidx.collection.ArraySet;
import com.android.systemui.Dumpable;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -35,7 +34,6 @@
import java.util.ArrayList;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -64,8 +62,7 @@
@Inject
public VisualStabilityManager(
- NotificationEntryManager notificationEntryManager,
- @Named(MAIN_HANDLER_NAME) Handler handler) {
+ NotificationEntryManager notificationEntryManager, @MainHandler Handler handler) {
mHandler = handler;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
index 7e398bb..9981c93 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
@@ -37,6 +37,7 @@
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
import com.android.systemui.statusbar.notification.logging.NotifEvent;
import com.android.systemui.statusbar.notification.logging.NotifLog;
+import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -76,12 +77,16 @@
private final Ranking mTmpRanking = new Ranking();
private final boolean mUsePeopleFiltering;
private final NotifLog mNotifLog;
+ private final PeopleNotificationIdentifier mPeopleNotificationIdentifier;
@Inject
- public NotificationData(NotificationSectionsFeatureManager sectionsFeatureManager,
- NotifLog notifLog) {
+ public NotificationData(
+ NotificationSectionsFeatureManager sectionsFeatureManager,
+ NotifLog notifLog,
+ PeopleNotificationIdentifier peopleNotificationIdentifier) {
mUsePeopleFiltering = sectionsFeatureManager.isFilteringEnabled();
mNotifLog = notifLog;
+ mPeopleNotificationIdentifier = peopleNotificationIdentifier;
}
public void setHeadsUpManager(HeadsUpManager headsUpManager) {
@@ -220,24 +225,6 @@
updateRankingAndSort(ranking, reason);
}
- public void updateAppOp(int appOp, int uid, String pkg, String key, boolean showIcon) {
- synchronized (mEntries) {
- final int len = mEntries.size();
- for (int i = 0; i < len; i++) {
- NotificationEntry entry = mEntries.valueAt(i);
- if (uid == entry.getSbn().getUid()
- && pkg.equals(entry.getSbn().getPackageName())
- && key.equals(entry.getKey())) {
- if (showIcon) {
- entry.mActiveAppOps.add(appOp);
- } else {
- entry.mActiveAppOps.remove(appOp);
- }
- }
- }
- }
- }
-
/**
* Returns true if this notification should be displayed in the high-priority notifications
* section
@@ -460,8 +447,7 @@
}
private boolean isPeopleNotification(NotificationEntry e) {
- return e.getSbn().getNotification().getNotificationStyle()
- == Notification.MessagingStyle.class;
+ return mPeopleNotificationIdentifier.isPeopleNotification(e.getSbn());
}
public void dump(PrintWriter pw, String indent) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 71fc549..a4c8fc4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -130,7 +130,7 @@
private Throwable mDebugThrowable;
public CharSequence remoteInputTextWhenReset;
public long lastRemoteInputSent = NOT_LAUNCHED_YET;
- public ArraySet<Integer> mActiveAppOps = new ArraySet<>(3);
+ public final ArraySet<Integer> mActiveAppOps = new ArraySet<>(3);
public CharSequence headsUpStatusBarText;
public CharSequence headsUpStatusBarTextPublic;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubModule.kt
index 8c067b7..4f03003 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubModule.kt
@@ -23,15 +23,25 @@
abstract class PeopleHubModule {
@Binds
- abstract fun peopleHubSectionFooterViewController(
- viewAdapter: PeopleHubSectionFooterViewAdapterImpl
+ abstract fun peopleHubSectionFooterViewAdapter(
+ impl: PeopleHubSectionFooterViewAdapterImpl
): PeopleHubSectionFooterViewAdapter
@Binds
- abstract fun peopleHubDataSource(s: PeopleHubDataSourceImpl): DataSource<PeopleHubModel>
+ abstract fun peopleHubDataSource(impl: PeopleHubDataSourceImpl): DataSource<PeopleHubModel>
@Binds
abstract fun peopleHubViewModelFactoryDataSource(
- dataSource: PeopleHubViewModelFactoryDataSourceImpl
+ impl: PeopleHubViewModelFactoryDataSourceImpl
): DataSource<PeopleHubViewModelFactory>
+
+ @Binds
+ abstract fun peopleNotificationIdentifier(
+ impl: PeopleNotificationIdentifierImpl
+ ): PeopleNotificationIdentifier
+
+ @Binds
+ abstract fun notificationPersonExtractor(
+ pluginImpl: NotificationPersonExtractorPluginBoundary
+ ): NotificationPersonExtractor
}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubNotificationListener.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubNotificationListener.kt
index 90a860a..987b52db 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubNotificationListener.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubNotificationListener.kt
@@ -17,11 +17,14 @@
package com.android.systemui.statusbar.notification.people
import android.app.Notification
+import android.content.Context
import android.graphics.Canvas
import android.graphics.ColorFilter
import android.graphics.PixelFormat
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
+import android.os.UserHandle
+import android.service.notification.StatusBarNotification
import android.util.TypedValue
import android.view.View
import android.view.ViewGroup
@@ -30,59 +33,116 @@
import com.android.internal.widget.MessagingGroup
import com.android.launcher3.icons.BaseIconFactory
import com.android.systemui.R
+import com.android.systemui.plugins.NotificationPersonExtractorPlugin
import com.android.systemui.statusbar.notification.NotificationEntryListener
import com.android.systemui.statusbar.notification.NotificationEntryManager
import com.android.systemui.statusbar.notification.collection.NotificationEntry
+import com.android.systemui.statusbar.policy.ExtensionController
import java.util.ArrayDeque
import javax.inject.Inject
import javax.inject.Singleton
private const val MAX_STORED_INACTIVE_PEOPLE = 10
-@Singleton
-class PeopleHubDataSourceImpl @Inject constructor(
- notificationEntryManager: NotificationEntryManager,
- private val peopleHubManager: PeopleHubManager
-) : DataSource<PeopleHubModel> {
+interface NotificationPersonExtractor {
+ fun extractPerson(sbn: StatusBarNotification): PersonModel?
+ fun extractPersonKey(sbn: StatusBarNotification): String?
+ fun isPersonNotification(sbn: StatusBarNotification): Boolean
+}
- private var dataListener: DataListener<PeopleHubModel>? = null
+@Singleton
+class NotificationPersonExtractorPluginBoundary @Inject constructor(
+ extensionController: ExtensionController,
+ private val context: Context
+) : NotificationPersonExtractor {
+
+ private var plugin: NotificationPersonExtractorPlugin? = null
init {
- notificationEntryManager.addNotificationEntryListener(object : NotificationEntryListener {
- override fun onEntryInflated(entry: NotificationEntry, inflatedFlags: Int) =
- addVisibleEntry(entry)
-
- override fun onEntryReinflated(entry: NotificationEntry) = addVisibleEntry(entry)
-
- override fun onPostEntryUpdated(entry: NotificationEntry) = addVisibleEntry(entry)
-
- override fun onEntryRemoved(
- entry: NotificationEntry,
- visibility: NotificationVisibility?,
- removedByUser: Boolean
- ) = removeVisibleEntry(entry)
- })
+ plugin = extensionController
+ .newExtension(NotificationPersonExtractorPlugin::class.java)
+ .withPlugin(NotificationPersonExtractorPlugin::class.java)
+ .withCallback { extractor ->
+ plugin = extractor
+ }
+ .build()
+ .get()
}
- private fun removeVisibleEntry(entry: NotificationEntry?) {
- if (entry?.extractPersonKey()?.let(peopleHubManager::removeActivePerson) == true) {
+ override fun extractPerson(sbn: StatusBarNotification) =
+ plugin?.extractPerson(sbn)?.let { data ->
+ val badged = addBadgeToDrawable(data.avatar, context, sbn.packageName, sbn.user)
+ PersonModel(data.key, data.name, badged, data.clickIntent)
+ }
+
+ override fun extractPersonKey(sbn: StatusBarNotification) = plugin?.extractPersonKey(sbn)
+
+ override fun isPersonNotification(sbn: StatusBarNotification): Boolean =
+ plugin?.isPersonNotification(sbn) ?: false
+}
+
+@Singleton
+class PeopleHubDataSourceImpl @Inject constructor(
+ private val notificationEntryManager: NotificationEntryManager,
+ private val peopleHubManager: PeopleHubManager,
+ private val extractor: NotificationPersonExtractor
+) : DataSource<PeopleHubModel> {
+
+ private val dataListeners = mutableListOf<DataListener<PeopleHubModel>>()
+
+ private val notificationEntryListener = object : NotificationEntryListener {
+ override fun onEntryInflated(entry: NotificationEntry, inflatedFlags: Int) =
+ addVisibleEntry(entry)
+
+ override fun onEntryReinflated(entry: NotificationEntry) = addVisibleEntry(entry)
+
+ override fun onPostEntryUpdated(entry: NotificationEntry) = addVisibleEntry(entry)
+
+ override fun onEntryRemoved(
+ entry: NotificationEntry,
+ visibility: NotificationVisibility?,
+ removedByUser: Boolean
+ ) = removeVisibleEntry(entry)
+ }
+
+ private fun removeVisibleEntry(entry: NotificationEntry) {
+ val key = extractor.extractPersonKey(entry.sbn) ?: entry.extractPersonKey()
+ if (key?.let(peopleHubManager::removeActivePerson) == true) {
updateUi()
}
}
- private fun addVisibleEntry(entry: NotificationEntry?) {
- if (entry?.extractPerson()?.let(peopleHubManager::addActivePerson) == true) {
+ private fun addVisibleEntry(entry: NotificationEntry) {
+ val personModel = extractor.extractPerson(entry.sbn) ?: entry.extractPerson()
+ if (personModel?.let(peopleHubManager::addActivePerson) == true) {
updateUi()
}
}
- override fun setListener(listener: DataListener<PeopleHubModel>) {
- this.dataListener = listener
- updateUi()
+ override fun registerListener(listener: DataListener<PeopleHubModel>): Subscription {
+ val registerWithNotificationEntryManager = dataListeners.isEmpty()
+ dataListeners.add(listener)
+ if (registerWithNotificationEntryManager) {
+ notificationEntryManager.addNotificationEntryListener(notificationEntryListener)
+ } else {
+ listener.onDataChanged(peopleHubManager.getPeopleHubModel())
+ }
+ return object : Subscription {
+ override fun unsubscribe() {
+ dataListeners.remove(listener)
+ if (dataListeners.isEmpty()) {
+ notificationEntryManager
+ .removeNotificationEntryListener(notificationEntryListener)
+ }
+ }
+ }
}
private fun updateUi() {
- dataListener?.onDataChanged(peopleHubManager.getPeopleHubModel())
+ val model = peopleHubManager.getPeopleHubModel()
+ for (listener in dataListeners) {
+ listener.onDataChanged(model)
+ }
}
}
@@ -124,19 +184,25 @@
if (!isMessagingNotification()) {
return null
}
-
- val clickIntent = sbn.notification.contentIntent
+ val clickIntent = sbn.notification.contentIntent ?: return null
val extras = sbn.notification.extras
val name = extras.getString(Notification.EXTRA_CONVERSATION_TITLE)
?: extras.getString(Notification.EXTRA_TITLE)
?: return null
val drawable = extractAvatarFromRow(this) ?: return null
+ val badgedAvatar = addBadgeToDrawable(drawable, row.context, sbn.packageName, sbn.user)
+ return PersonModel(key, name, badgedAvatar, clickIntent)
+}
- val context = row.context
+private fun addBadgeToDrawable(
+ drawable: Drawable,
+ context: Context,
+ packageName: String,
+ user: UserHandle
+): Drawable {
val pm = context.packageManager
- val appInfo = pm.getApplicationInfo(sbn.packageName, 0)
-
- val badgedAvatar = object : Drawable() {
+ val appInfo = pm.getApplicationInfoAsUser(packageName, 0, user)
+ return object : Drawable() {
override fun draw(canvas: Canvas) {
val iconBounds = getBounds()
val factory = object : BaseIconFactory(
@@ -146,7 +212,7 @@
true) {}
val badge = factory.createBadgedIconBitmap(
appInfo.loadIcon(pm),
- sbn.user,
+ user,
true,
appInfo.isInstantApp,
null)
@@ -156,7 +222,7 @@
colorFilter = drawable.colorFilter
val badgeWidth = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
- 16f,
+ 15f,
context.resources.displayMetrics
).toInt()
setBounds(
@@ -181,8 +247,6 @@
@PixelFormat.Opacity
override fun getOpacity(): Int = PixelFormat.OPAQUE
}
-
- return PersonModel(key, name, badgedAvatar, clickIntent)
}
private fun extractAvatarFromRow(entry: NotificationEntry): Drawable? =
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubViewController.kt
index 8d1253b..5c35408 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleHubViewController.kt
@@ -60,8 +60,9 @@
private val dataSource: DataSource<@JvmSuppressWildcards PeopleHubViewModelFactory>
) : PeopleHubSectionFooterViewAdapter {
- override fun bindView(viewBoundary: PeopleHubSectionFooterViewBoundary) =
- dataSource.setListener(PeopleHubDataListenerImpl(viewBoundary))
+ override fun bindView(viewBoundary: PeopleHubSectionFooterViewBoundary) {
+ dataSource.registerListener(PeopleHubDataListenerImpl(viewBoundary))
+ }
}
private class PeopleHubDataListenerImpl(
@@ -92,8 +93,8 @@
private val dataSource: DataSource<@JvmSuppressWildcards PeopleHubModel>
) : DataSource<PeopleHubViewModelFactory> {
- override fun setListener(listener: DataListener<PeopleHubViewModelFactory>) =
- dataSource.setListener(PeopleHubModelListenerImpl(activityStarter, listener))
+ override fun registerListener(listener: DataListener<PeopleHubViewModelFactory>) =
+ dataSource.registerListener(PeopleHubModelListenerImpl(activityStarter, listener))
}
private class PeopleHubModelListenerImpl(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt
new file mode 100644
index 0000000..78eaf3e
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt
@@ -0,0 +1,36 @@
+/*
+ * 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.systemui.statusbar.notification.people
+
+import android.app.Notification
+import android.service.notification.StatusBarNotification
+import javax.inject.Inject
+import javax.inject.Singleton
+
+interface PeopleNotificationIdentifier {
+ fun isPeopleNotification(sbn: StatusBarNotification): Boolean
+}
+
+@Singleton
+class PeopleNotificationIdentifierImpl @Inject constructor(
+ private val personExtractor: NotificationPersonExtractor
+) : PeopleNotificationIdentifier {
+
+ override fun isPeopleNotification(sbn: StatusBarNotification) =
+ sbn.notification.notificationStyle == Notification.MessagingStyle::class.java ||
+ personExtractor.isPersonNotification(sbn)
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/ViewPipeline.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/ViewPipeline.kt
index 33e3bb8..3ca3792 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/ViewPipeline.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/ViewPipeline.kt
@@ -28,10 +28,17 @@
/** Boundary between a View and data pipeline, as seen by the View. */
interface DataSource<out T> {
- fun setListener(listener: DataListener<T>)
+ fun registerListener(listener: DataListener<T>): Subscription
+}
+
+/** Represents a registration with a [DataSource]. */
+interface Subscription {
+ /** Removes the previously registered [DataListener] from the [DataSource] */
+ fun unsubscribe()
}
/** Transform all data coming out of this [DataSource] using the given [mapper]. */
fun <S, T> DataSource<S>.map(mapper: (S) -> T): DataSource<T> = object : DataSource<T> {
- override fun setListener(listener: DataListener<T>) = setListener(listener.contraMap(mapper))
+ override fun registerListener(listener: DataListener<T>) =
+ registerListener(listener.contraMap(mapper))
}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
index 5d5c09e..9bc0ca4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
@@ -28,6 +28,7 @@
import android.media.session.PlaybackState;
import android.metrics.LogMaker;
import android.os.Handler;
+import android.provider.Settings;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -41,9 +42,12 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.MediaNotificationView;
import com.android.systemui.Dependency;
+import com.android.systemui.qs.QSPanel;
+import com.android.systemui.qs.QuickQSPanel;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
+import com.android.systemui.statusbar.phone.StatusBarWindowController;
import java.util.Timer;
import java.util.TimerTask;
@@ -178,6 +182,26 @@
final MediaSession.Token token = mRow.getEntry().getSbn().getNotification().extras
.getParcelable(Notification.EXTRA_MEDIA_SESSION);
+ int flag = Settings.System.getInt(mContext.getContentResolver(), "qs_media_player", 0);
+ if (flag == 1) {
+ StatusBarWindowController ctrl = Dependency.get(StatusBarWindowController.class);
+ QuickQSPanel panel = ctrl.getStatusBarView().findViewById(
+ com.android.systemui.R.id.quick_qs_panel);
+ panel.getMediaPlayer().setMediaSession(token,
+ mRow.getStatusBarNotification().getNotification().getSmallIcon(),
+ getNotificationHeader().getOriginalIconColor(),
+ mRow.getCurrentBackgroundTint(),
+ mActions);
+ QSPanel bigPanel = ctrl.getStatusBarView().findViewById(
+ com.android.systemui.R.id.quick_settings_panel);
+ bigPanel.addMediaSession(token,
+ mRow.getStatusBarNotification().getNotification().getSmallIcon(),
+ getNotificationHeader().getOriginalIconColor(),
+ mRow.getCurrentBackgroundTint(),
+ mActions,
+ mRow.getStatusBarNotification());
+ }
+
boolean showCompactSeekbar = mMediaManager.getShowCompactMediaSeekbar();
if (token == null || (COMPACT_MEDIA_TAG.equals(mView.getTag()) && !showCompactSeekbar)) {
if (mSeekBarView != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
index bd87d77..54d4066 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
@@ -131,6 +131,7 @@
}
mInitialized = true;
reinflateViews(layoutInflater);
+ mPeopleHubViewAdapter.bindView(mPeopleHubViewBoundary);
mConfigurationController.addCallback(mConfigurationListener);
}
@@ -172,10 +173,6 @@
if (oldPeopleHubPos != -1) {
mParent.addView(mPeopleHubView, oldPeopleHubPos);
}
-
- if (!mInitialized) {
- mPeopleHubViewAdapter.bindView(mPeopleHubViewBoundary);
- }
}
/** Listener for when the "clear all" buttton is clciked on the gentle notification header. */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
index 008464e..f9b9367 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.content.Context;
import android.os.Handler;
import android.os.RemoteException;
@@ -25,10 +23,10 @@
import android.view.IWindowManager;
import android.view.MotionEvent;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import javax.inject.Inject;
-import javax.inject.Named;
/** A controller to control all auto-hide things. */
public class AutoHideController {
@@ -54,7 +52,7 @@
};
@Inject
- public AutoHideController(Context context, @Named(MAIN_HANDLER_NAME) Handler handler,
+ public AutoHideController(Context context, @MainHandler Handler handler,
NotificationRemoteInputManager notificationRemoteInputManager,
IWindowManager iWindowManager) {
mHandler = handler;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java
index 007c50c..837517e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java
@@ -21,7 +21,7 @@
import android.provider.Settings.Secure;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.Dependency;
+import com.android.systemui.dagger.qualifiers.BgHandler;
import com.android.systemui.qs.AutoAddTracker;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.qs.SecureSetting;
@@ -33,7 +33,6 @@
import com.android.systemui.statusbar.policy.HotspotController.Callback;
import javax.inject.Inject;
-import javax.inject.Named;
/**
* Manages which tiles should be automatically added to QS.
@@ -58,7 +57,7 @@
@Inject
public AutoTileManager(Context context, AutoAddTracker autoAddTracker, QSTileHost host,
- @Named(Dependency.BG_HANDLER_NAME) Handler handler,
+ @BgHandler Handler handler,
HotspotController hotspotController,
DataSaverController dataSaverController,
ManagedProfileController managedProfileController,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 548afd5..1e8e28f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -18,6 +18,7 @@
import android.annotation.IntDef;
import android.content.Context;
+import android.content.res.Resources;
import android.hardware.biometrics.BiometricSourceType;
import android.metrics.LogMaker;
import android.os.Handler;
@@ -34,6 +35,7 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.Dependency;
+import com.android.systemui.dagger.qualifiers.MainResources;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
@@ -44,15 +46,19 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/**
* Controller which coordinates all the biometric unlocking actions with the UI.
*/
+@Singleton
public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
- private static final String TAG = "BiometricUnlockController";
+ private static final String TAG = "BiometricUnlockCtrl";
private static final boolean DEBUG_BIO_WAKELOCK = KeyguardConstants.DEBUG_BIOMETRIC_WAKELOCK;
private static final long BIOMETRIC_WAKELOCK_TIMEOUT_MS = 15 * 1000;
- private static final String BIOMETRIC_WAKE_LOCK_NAME = "wake-and-unlock wakelock";
+ private static final String BIOMETRIC_WAKE_LOCK_NAME = "wake-and-unlock:wakelock";
@IntDef(prefix = { "MODE_" }, value = {
MODE_NONE,
@@ -145,31 +151,16 @@
private boolean mHasScreenTurnedOnSinceAuthenticating;
private boolean mFadedAwayAfterWakeAndUnlock;
- private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
+ private final MetricsLogger mMetricsLogger;
- public BiometricUnlockController(
- Context context,
- DozeScrimController dozeScrimController,
- KeyguardViewMediator keyguardViewMediator,
- ScrimController scrimController,
- StatusBar statusBar,
- KeyguardStateController keyguardStateController, Handler handler,
- KeyguardUpdateMonitor keyguardUpdateMonitor,
- KeyguardBypassController keyguardBypassController,
- DozeParameters dozeParameters) {
- this(context, dozeScrimController, keyguardViewMediator, scrimController, statusBar,
- keyguardStateController, handler, keyguardUpdateMonitor,
- context.getResources()
- .getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze),
- keyguardBypassController, dozeParameters);
- }
-
- @VisibleForTesting
- protected BiometricUnlockController(Context context, DozeScrimController dozeScrimController,
+ @Inject
+ public BiometricUnlockController(Context context, DozeScrimController dozeScrimController,
KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
StatusBar statusBar, KeyguardStateController keyguardStateController, Handler handler,
- KeyguardUpdateMonitor keyguardUpdateMonitor, int wakeUpDelay,
- KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters) {
+ KeyguardUpdateMonitor keyguardUpdateMonitor,
+ @MainResources Resources resources,
+ KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters,
+ MetricsLogger metricsLogger) {
mContext = context;
mPowerManager = context.getSystemService(PowerManager.class);
mUpdateMonitor = keyguardUpdateMonitor;
@@ -185,9 +176,10 @@
mStatusBar = statusBar;
mKeyguardStateController = keyguardStateController;
mHandler = handler;
- mWakeUpDelay = wakeUpDelay;
+ mWakeUpDelay = resources.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze);
mKeyguardBypassController = keyguardBypassController;
mKeyguardBypassController.setUnlockController(this);
+ mMetricsLogger = metricsLogger;
}
public void setStatusBarKeyguardViewManager(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
index 28dac87..bc48235 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
@@ -24,9 +24,8 @@
import android.provider.Settings;
import android.util.MathUtils;
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.DependencyProvider;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.MainResources;
import com.android.systemui.doze.AlwaysOnDisplayPolicy;
import com.android.systemui.doze.DozeScreenState;
import com.android.systemui.tuner.TunerService;
@@ -59,7 +58,7 @@
@Inject
protected DozeParameters(
- @DependencyProvider.MainResources Resources resources,
+ @MainResources Resources resources,
AmbientDisplayConfiguration ambientDisplayConfiguration,
AlwaysOnDisplayPolicy alwaysOnDisplayPolicy,
PowerManager powerManager,
@@ -188,12 +187,7 @@
return;
}
mControlScreenOffAnimation = controlScreenOffAnimation;
- getPowerManager().setDozeAfterScreenOff(!controlScreenOffAnimation);
- }
-
- @VisibleForTesting
- protected PowerManager getPowerManager() {
- return mPowerManager;
+ mPowerManager.setDozeAfterScreenOff(!controlScreenOffAnimation);
}
private boolean getBoolean(String propName, int resId) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
index fe3c04e..1ecc489 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
@@ -29,10 +29,12 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import javax.inject.Inject;
+import javax.inject.Singleton;
/**
* Controller which handles all the doze animations of the scrims.
*/
+@Singleton
public class DozeScrimController implements StateListener {
private static final String TAG = "DozeScrimController";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
new file mode 100644
index 0000000..2854355
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
@@ -0,0 +1,465 @@
+/*
+ * 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.systemui.statusbar.phone;
+
+import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE;
+import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_WAKING;
+
+import android.annotation.NonNull;
+import android.os.Bundle;
+import android.os.PowerManager;
+import android.os.SystemClock;
+import android.os.SystemProperties;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.systemui.assist.AssistManager;
+import com.android.systemui.doze.DozeEvent;
+import com.android.systemui.doze.DozeHost;
+import com.android.systemui.doze.DozeLog;
+import com.android.systemui.doze.DozeReceiver;
+import com.android.systemui.keyguard.KeyguardViewMediator;
+import com.android.systemui.keyguard.WakefulnessLifecycle;
+import com.android.systemui.statusbar.PulseExpansionHandler;
+import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.SysuiStatusBarStateController;
+import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
+import com.android.systemui.statusbar.notification.VisualStabilityManager;
+import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import com.android.systemui.statusbar.policy.BatteryController;
+import com.android.systemui.statusbar.policy.DeviceProvisionedController;
+
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import dagger.Lazy;
+
+/**
+ * Implementation of DozeHost for SystemUI.
+ */
+@Singleton
+public final class DozeServiceHost implements DozeHost {
+ private static final String TAG = "DozeServiceHost";
+ private final ArrayList<Callback> mCallbacks = new ArrayList<>();
+ private final DozeLog mDozeLog;
+ private final PowerManager mPowerManager;
+ private boolean mAnimateWakeup;
+ private boolean mAnimateScreenOff;
+ private boolean mIgnoreTouchWhilePulsing;
+ private Runnable mPendingScreenOffCallback;
+ @VisibleForTesting
+ boolean mWakeLockScreenPerformsAuth = SystemProperties.getBoolean(
+ "persist.sysui.wake_performs_auth", true);
+ private boolean mDozingRequested;
+ private boolean mDozing;
+ private boolean mPulsing;
+ private WakefulnessLifecycle mWakefulnessLifecycle;
+ private final SysuiStatusBarStateController mStatusBarStateController;
+ private final DeviceProvisionedController mDeviceProvisionedController;
+ private final HeadsUpManagerPhone mHeadsUpManagerPhone;
+ private final BatteryController mBatteryController;
+ private final ScrimController mScrimController;
+ private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
+ private BiometricUnlockController mBiometricUnlockController;
+ private final KeyguardViewMediator mKeyguardViewMediator;
+ private final AssistManager mAssistManager;
+ private final DozeScrimController mDozeScrimController;
+ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ private final VisualStabilityManager mVisualStabilityManager;
+ private final PulseExpansionHandler mPulseExpansionHandler;
+ private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationWakeUpCoordinator mNotificationWakeUpCoordinator;
+ private NotificationIconAreaController mNotificationIconAreaController;
+ private StatusBarWindowViewController mStatusBarWindowViewController;
+ private StatusBarWindowView mStatusBarWindow;
+ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private NotificationPanelView mNotificationPanel;
+ private View mAmbientIndicationContainer;
+ private StatusBar mStatusBar;
+
+ @Inject
+ public DozeServiceHost(DozeLog dozeLog, PowerManager powerManager,
+ WakefulnessLifecycle wakefulnessLifecycle,
+ SysuiStatusBarStateController statusBarStateController,
+ DeviceProvisionedController deviceProvisionedController,
+ HeadsUpManagerPhone headsUpManagerPhone, BatteryController batteryController,
+ ScrimController scrimController,
+ Lazy<BiometricUnlockController> biometricUnlockControllerLazy,
+ KeyguardViewMediator keyguardViewMediator,
+ AssistManager assistManager,
+ DozeScrimController dozeScrimController, KeyguardUpdateMonitor keyguardUpdateMonitor,
+ VisualStabilityManager visualStabilityManager,
+ PulseExpansionHandler pulseExpansionHandler,
+ StatusBarWindowController statusBarWindowController,
+ NotificationWakeUpCoordinator notificationWakeUpCoordinator) {
+ super();
+ mDozeLog = dozeLog;
+ mPowerManager = powerManager;
+ mWakefulnessLifecycle = wakefulnessLifecycle;
+ mStatusBarStateController = statusBarStateController;
+ mDeviceProvisionedController = deviceProvisionedController;
+ mHeadsUpManagerPhone = headsUpManagerPhone;
+ mBatteryController = batteryController;
+ mScrimController = scrimController;
+ mBiometricUnlockControllerLazy = biometricUnlockControllerLazy;
+ mKeyguardViewMediator = keyguardViewMediator;
+ mAssistManager = assistManager;
+ mDozeScrimController = dozeScrimController;
+ mKeyguardUpdateMonitor = keyguardUpdateMonitor;
+ mVisualStabilityManager = visualStabilityManager;
+ mPulseExpansionHandler = pulseExpansionHandler;
+ mStatusBarWindowController = statusBarWindowController;
+ mNotificationWakeUpCoordinator = notificationWakeUpCoordinator;
+ }
+
+ // TODO: we should try to not pass status bar in here if we can avoid it.
+
+ /**
+ * Initialize instance with objects only available later during execution.
+ */
+ public void initialize(StatusBar statusBar,
+ NotificationIconAreaController notificationIconAreaController,
+ StatusBarWindowViewController statusBarWindowViewController,
+ StatusBarWindowView statusBarWindow,
+ StatusBarKeyguardViewManager statusBarKeyguardViewManager,
+ NotificationPanelView notificationPanel, View ambientIndicationContainer) {
+ mStatusBar = statusBar;
+ mNotificationIconAreaController = notificationIconAreaController;
+ mStatusBarWindowViewController = statusBarWindowViewController;
+ mStatusBarWindow = statusBarWindow;
+ mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
+ mNotificationPanel = notificationPanel;
+ mAmbientIndicationContainer = ambientIndicationContainer;
+ mBiometricUnlockController = mBiometricUnlockControllerLazy.get();
+ }
+
+ @Override
+ public String toString() {
+ return "PSB.DozeServiceHost[mCallbacks=" + mCallbacks.size() + "]";
+ }
+
+ void firePowerSaveChanged(boolean active) {
+ for (Callback callback : mCallbacks) {
+ callback.onPowerSaveChanged(active);
+ }
+ }
+
+ void fireNotificationPulse(NotificationEntry entry) {
+ Runnable pulseSuppressedListener = () -> {
+ entry.setPulseSuppressed(true);
+ mNotificationIconAreaController.updateAodNotificationIcons();
+ };
+ for (Callback callback : mCallbacks) {
+ callback.onNotificationAlerted(pulseSuppressedListener);
+ }
+ }
+
+ boolean getDozingRequested() {
+ return mDozingRequested;
+ }
+
+ boolean isPulsing() {
+ return mPulsing;
+ }
+
+
+ @Override
+ public void addCallback(@NonNull Callback callback) {
+ mCallbacks.add(callback);
+ }
+
+ @Override
+ public void removeCallback(@NonNull Callback callback) {
+ mCallbacks.remove(callback);
+ }
+
+ @Override
+ public void startDozing() {
+ if (!mDozingRequested) {
+ mDozingRequested = true;
+ mDozeLog.traceDozing(mDozing);
+ updateDozing();
+ mStatusBar.updateIsKeyguard();
+ }
+ }
+
+ void updateDozing() {
+ // When in wake-and-unlock while pulsing, keep dozing state until fully unlocked.
+ boolean
+ dozing =
+ mDozingRequested && mStatusBarStateController.getState() == StatusBarState.KEYGUARD
+ || mBiometricUnlockController.getMode()
+ == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
+ // When in wake-and-unlock we may not have received a change to StatusBarState
+ // but we still should not be dozing, manually set to false.
+ if (mBiometricUnlockController.getMode()
+ == BiometricUnlockController.MODE_WAKE_AND_UNLOCK) {
+ dozing = false;
+ }
+
+
+ mStatusBarStateController.setIsDozing(dozing);
+ }
+
+ @Override
+ public void pulseWhileDozing(@NonNull PulseCallback callback, int reason) {
+ if (reason == DozeEvent.PULSE_REASON_SENSOR_LONG_PRESS) {
+ mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
+ "com.android.systemui:LONG_PRESS");
+ mAssistManager.startAssist(new Bundle());
+ return;
+ }
+
+ if (reason == DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN) {
+ mScrimController.setWakeLockScreenSensorActive(true);
+ }
+
+ if (reason == DozeEvent.PULSE_REASON_DOCKING && mStatusBarWindow != null) {
+ mStatusBarWindowViewController.suppressWakeUpGesture(true);
+ }
+
+ boolean passiveAuthInterrupt = reason == DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN
+ && mWakeLockScreenPerformsAuth;
+ // Set the state to pulsing, so ScrimController will know what to do once we ask it to
+ // execute the transition. The pulse callback will then be invoked when the scrims
+ // are black, indicating that StatusBar is ready to present the rest of the UI.
+ mPulsing = true;
+ mDozeScrimController.pulse(new PulseCallback() {
+ @Override
+ public void onPulseStarted() {
+ callback.onPulseStarted();
+ mStatusBar.updateNotificationPanelTouchState();
+ setPulsing(true);
+ }
+
+ @Override
+ public void onPulseFinished() {
+ mPulsing = false;
+ callback.onPulseFinished();
+ mStatusBar.updateNotificationPanelTouchState();
+ mScrimController.setWakeLockScreenSensorActive(false);
+ if (mStatusBarWindow != null) {
+ mStatusBarWindowViewController.suppressWakeUpGesture(false);
+ }
+ setPulsing(false);
+ }
+
+ private void setPulsing(boolean pulsing) {
+ mStatusBarStateController.setPulsing(pulsing);
+ mStatusBarKeyguardViewManager.setPulsing(pulsing);
+ mKeyguardViewMediator.setPulsing(pulsing);
+ mNotificationPanel.setPulsing(pulsing);
+ mVisualStabilityManager.setPulsing(pulsing);
+ mStatusBarWindowViewController.setPulsing(pulsing);
+ mIgnoreTouchWhilePulsing = false;
+ if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
+ mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
+ }
+ mStatusBar.updateScrimController();
+ mPulseExpansionHandler.setPulsing(pulsing);
+ mNotificationWakeUpCoordinator.setPulsing(pulsing);
+ }
+ }, reason);
+ // DozeScrimController is in pulse state, now let's ask ScrimController to start
+ // pulsing and draw the black frame, if necessary.
+ mStatusBar.updateScrimController();
+ }
+
+ @Override
+ public void stopDozing() {
+ if (mDozingRequested) {
+ mDozingRequested = false;
+ mDozeLog.traceDozing(mDozing);
+ updateDozing();
+ }
+ }
+
+ @Override
+ public void onIgnoreTouchWhilePulsing(boolean ignore) {
+ if (ignore != mIgnoreTouchWhilePulsing) {
+ mDozeLog.tracePulseTouchDisabledByProx(ignore);
+ }
+ mIgnoreTouchWhilePulsing = ignore;
+ if (mDozing && ignore) {
+ mStatusBarWindowViewController.cancelCurrentTouch();
+ }
+ }
+
+ @Override
+ public void dozeTimeTick() {
+ mNotificationPanel.dozeTimeTick();
+ if (mAmbientIndicationContainer instanceof DozeReceiver) {
+ ((DozeReceiver) mAmbientIndicationContainer).dozeTimeTick();
+ }
+ }
+
+ @Override
+ public boolean isPowerSaveActive() {
+ return mBatteryController.isAodPowerSave();
+ }
+
+ @Override
+ public boolean isPulsingBlocked() {
+ return mBiometricUnlockController.getMode()
+ == BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
+ }
+
+ @Override
+ public boolean isProvisioned() {
+ return mDeviceProvisionedController.isDeviceProvisioned()
+ && mDeviceProvisionedController.isCurrentUserSetup();
+ }
+
+ @Override
+ public boolean isBlockingDoze() {
+ if (mBiometricUnlockController.hasPendingAuthentication()) {
+ Log.i(StatusBar.TAG, "Blocking AOD because fingerprint has authenticated");
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void extendPulse(int reason) {
+ if (reason == DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN) {
+ mScrimController.setWakeLockScreenSensorActive(true);
+ }
+ if (mDozeScrimController.isPulsing() && mHeadsUpManagerPhone.hasNotifications()) {
+ mHeadsUpManagerPhone.extendHeadsUp();
+ } else {
+ mDozeScrimController.extendPulse();
+ }
+ }
+
+ @Override
+ public void stopPulsing() {
+ if (mDozeScrimController.isPulsing()) {
+ mDozeScrimController.pulseOutNow();
+ }
+ }
+
+ @Override
+ public void setAnimateWakeup(boolean animateWakeup) {
+ if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_AWAKE
+ || mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_WAKING) {
+ // Too late to change the wakeup animation.
+ return;
+ }
+ mAnimateWakeup = animateWakeup;
+ }
+
+ @Override
+ public void setAnimateScreenOff(boolean animateScreenOff) {
+ mAnimateScreenOff = animateScreenOff;
+ }
+
+ @Override
+ public void onSlpiTap(float screenX, float screenY) {
+ if (screenX > 0 && screenY > 0 && mAmbientIndicationContainer != null
+ && mAmbientIndicationContainer.getVisibility() == View.VISIBLE) {
+ int[] locationOnScreen = new int[2];
+ mAmbientIndicationContainer.getLocationOnScreen(locationOnScreen);
+ float viewX = screenX - locationOnScreen[0];
+ float viewY = screenY - locationOnScreen[1];
+ if (0 <= viewX && viewX <= mAmbientIndicationContainer.getWidth()
+ && 0 <= viewY && viewY <= mAmbientIndicationContainer.getHeight()) {
+
+ // Dispatch a tap
+ long now = SystemClock.elapsedRealtime();
+ MotionEvent ev = MotionEvent.obtain(
+ now, now, MotionEvent.ACTION_DOWN, screenX, screenY, 0);
+ mAmbientIndicationContainer.dispatchTouchEvent(ev);
+ ev.recycle();
+ ev = MotionEvent.obtain(
+ now, now, MotionEvent.ACTION_UP, screenX, screenY, 0);
+ mAmbientIndicationContainer.dispatchTouchEvent(ev);
+ ev.recycle();
+ }
+ }
+ }
+
+ @Override
+ public void setDozeScreenBrightness(int value) {
+ mStatusBarWindowController.setDozeScreenBrightness(value);
+ }
+
+ @Override
+ public void setAodDimmingScrim(float scrimOpacity) {
+ mScrimController.setAodFrontScrimAlpha(scrimOpacity);
+ }
+
+
+
+ @Override
+ public void prepareForGentleSleep(Runnable onDisplayOffCallback) {
+ if (mPendingScreenOffCallback != null) {
+ Log.w(TAG, "Overlapping onDisplayOffCallback. Ignoring previous one.");
+ }
+ mPendingScreenOffCallback = onDisplayOffCallback;
+ mStatusBar.updateScrimController();
+ }
+
+ @Override
+ public void cancelGentleSleep() {
+ mPendingScreenOffCallback = null;
+ if (mScrimController.getState() == ScrimState.OFF) {
+ mStatusBar.updateScrimController();
+ }
+ }
+
+ /**
+ * When the dozing host is waiting for scrims to fade out to change the display state.
+ */
+ boolean hasPendingScreenOffCallback() {
+ return mPendingScreenOffCallback != null;
+ }
+
+ /**
+ * Executes an nullifies the pending display state callback.
+ *
+ * @see #hasPendingScreenOffCallback()
+ * @see #prepareForGentleSleep(Runnable)
+ */
+ void executePendingScreenOffCallback() {
+ if (mPendingScreenOffCallback == null) {
+ return;
+ }
+ mPendingScreenOffCallback.run();
+ mPendingScreenOffCallback = null;
+ }
+
+ boolean shouldAnimateWakeup() {
+ return mAnimateWakeup;
+ }
+
+ boolean shouldAnimateScreenOff() {
+ return mAnimateScreenOff;
+ }
+
+ public void setDozing(boolean dozing) {
+ mDozing = dozing;
+ }
+
+ boolean getIgnoreTouchWhilePulsing() {
+ return mIgnoreTouchWhilePulsing;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
index c9c38a0..1c8e832 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
@@ -54,9 +54,7 @@
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.model.SysUiState;
import com.android.systemui.recents.OverviewProxyService;
-import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener;
import com.android.systemui.shared.system.QuickStepContract;
-import com.android.systemui.shared.system.WindowManagerWrapper;
import java.io.PrintWriter;
import java.util.concurrent.Executor;
@@ -70,15 +68,6 @@
private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt(
"gestures.back_timeout", 250);
- private final PinnedStackListener mImeChangedListener = new PinnedStackListener() {
- @Override
- public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
- // No need to thread jump, assignments are atomic
- mImeHeight = imeVisible ? imeHeight : 0;
- // TODO: Probably cancel any existing gesture
- }
- };
-
private ISystemGestureExclusionListener mGestureExclusionListener =
new ISystemGestureExclusionListener.Stub() {
@Override
@@ -126,8 +115,6 @@
private boolean mInRejectedExclusion = false;
private boolean mIsOnLeftEdge;
- private int mImeHeight = 0;
-
private boolean mIsAttached;
private boolean mIsGesturalModeEnabled;
private boolean mIsEnabled;
@@ -227,7 +214,6 @@
}
if (!mIsEnabled) {
- WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener);
mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this);
try {
@@ -244,7 +230,6 @@
mContext.getMainThreadHandler());
try {
- WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener);
WindowManagerGlobal.getWindowManagerService()
.registerSystemGestureExclusionListener(
mGestureExclusionListener, mDisplayId);
@@ -301,11 +286,6 @@
}
private boolean isWithinTouchRegion(int x, int y) {
- // Disallow if over the IME
- if (y > (mDisplaySize.y - Math.max(mImeHeight, mNavBarHeight))) {
- return false;
- }
-
// Disallow if too far from the edge
if (x > mEdgeWidth + mLeftInset && x < (mDisplaySize.x - mEdgeWidth - mRightInset)) {
return false;
@@ -483,7 +463,6 @@
pw.println(" mInRejectedExclusion" + mInRejectedExclusion);
pw.println(" mExcludeRegion=" + mExcludeRegion);
pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
- pw.println(" mImeHeight=" + mImeHeight);
pw.println(" mIsAttached=" + mIsAttached);
pw.println(" mEdgeWidth=" + mEdgeWidth);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java
index dd200da..7f31f3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java
@@ -77,9 +77,12 @@
ExpandableView child = mCallback.getChildAtRawPosition(x, y);
mTouchingHeadsUpView = false;
if (child instanceof ExpandableNotificationRow) {
- mPickedChild = (ExpandableNotificationRow) child;
+ ExpandableNotificationRow pickedChild = (ExpandableNotificationRow) child;
mTouchingHeadsUpView = !mCallback.isExpanded()
- && mPickedChild.isHeadsUp() && mPickedChild.isPinned();
+ && pickedChild.isHeadsUp() && pickedChild.isPinned();
+ if (mTouchingHeadsUpView) {
+ mPickedChild = pickedChild;
+ }
} else if (child == null && !mCallback.isExpanded()) {
// We might touch above the visible heads up child, but then we still would
// like to capture it.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt
index d9de59e..bf88704 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt
@@ -21,17 +21,16 @@
import android.hardware.TriggerEventListener
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
-import com.android.systemui.Dependency
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.util.Assert
import com.android.systemui.util.sensors.AsyncSensorManager
class KeyguardLiftController constructor(
private val statusBarStateController: StatusBarStateController,
- private val asyncSensorManager: AsyncSensorManager
+ private val asyncSensorManager: AsyncSensorManager,
+ private val keyguardUpdateMonitor: KeyguardUpdateMonitor
) : StatusBarStateController.StateListener, KeyguardUpdateMonitorCallback() {
- private val keyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor::class.java)
private val pickupSensor = asyncSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE)
private var isListening = false
private var bouncerVisible = false
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 89051cd..e00cfb1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -55,7 +55,6 @@
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityManager;
import android.widget.FrameLayout;
-import android.widget.LinearLayout;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
@@ -243,7 +242,7 @@
private View mQsNavbarScrim;
protected NotificationsQuickSettingsContainer mNotificationContainerParent;
protected NotificationStackScrollLayout mNotificationStackScroller;
- protected LinearLayout mHomeControlsLayout;
+ protected FrameLayout mHomeControlsLayout;
private boolean mAnimateNextPositionUpdate;
private int mTrackingPointer;
@@ -770,6 +769,11 @@
int sideMargin = res.getDimensionPixelOffset(R.dimen.notification_side_paddings);
int topMargin =
res.getDimensionPixelOffset(com.android.internal.R.dimen.quick_qs_total_height);
+ int flag = Settings.System.getInt(mContext.getContentResolver(), "qs_media_player", 0);
+ if (flag == 1) {
+ topMargin = res.getDimensionPixelOffset(
+ com.android.internal.R.dimen.quick_qs_total_height_with_media);
+ }
lp = (FrameLayout.LayoutParams) mPluginFrame.getLayoutParams();
if (lp.width != qsWidth || lp.gravity != panelGravity || lp.leftMargin != sideMargin
|| lp.rightMargin != sideMargin || lp.topMargin != topMargin) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index c50b1bf..35039a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -42,10 +42,10 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.DejankUtils;
-import com.android.systemui.DependencyProvider;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.colorextraction.SysuiColorExtractor;
+import com.android.systemui.dagger.qualifiers.MainResources;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.notification.stack.ViewState;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -60,11 +60,13 @@
import java.util.function.Consumer;
import javax.inject.Inject;
+import javax.inject.Singleton;
/**
* Controls both the scrim behind the notifications and in front of the notifications (when a
* security method gets shown).
*/
+@Singleton
public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnColorsChangedListener,
Dumpable {
@@ -188,7 +190,7 @@
@Inject
public ScrimController(LightBarController lightBarController, DozeParameters dozeParameters,
AlarmManager alarmManager, KeyguardStateController keyguardStateController,
- @DependencyProvider.MainResources Resources resources,
+ @MainResources Resources resources,
DelayedWakeLock.Builder delayedWakeLockBuilder, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor, SysuiColorExtractor sysuiColorExtractor) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
index e0597159..13055ff 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -39,15 +39,20 @@
@Override
public void prepare(ScrimState previousState) {
mFrontTint = Color.BLACK;
- mBehindTint = previousState.mBehindTint;
+ mBehindTint = Color.BLACK;
mBubbleTint = previousState.mBubbleTint;
mFrontAlpha = 1f;
- mBehindAlpha = previousState.mBehindAlpha;
+ mBehindAlpha = 1f;
mBubbleAlpha = previousState.mBubbleAlpha;
mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG;
}
+
+ @Override
+ public boolean isLowPowerState() {
+ return true;
+ }
},
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 2963c94..afc147a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -50,7 +50,6 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -157,10 +156,8 @@
import com.android.systemui.charging.WirelessChargingAnimation;
import com.android.systemui.classifier.FalsingLog;
import com.android.systemui.colorextraction.SysuiColorExtractor;
-import com.android.systemui.doze.DozeEvent;
import com.android.systemui.doze.DozeHost;
import com.android.systemui.doze.DozeLog;
-import com.android.systemui.doze.DozeReceiver;
import com.android.systemui.fragments.ExtensionFragmentListener;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.keyguard.KeyguardSliceProvider;
@@ -347,7 +344,7 @@
/**
* The {@link StatusBarState} of the status bar.
*/
- protected int mState;
+ protected int mState; // TODO: remove this. Just use StatusBarStateController
protected boolean mBouncerShowing;
private PhoneStatusBarPolicy mIconPolicy;
@@ -356,7 +353,7 @@
private VolumeComponent mVolumeComponent;
private BrightnessMirrorController mBrightnessMirrorController;
private boolean mBrightnessMirrorVisible;
- protected BiometricUnlockController mBiometricUnlockController;
+ private BiometricUnlockController mBiometricUnlockController;
private final LightBarController mLightBarController;
private final Lazy<LockscreenWallpaper> mLockscreenWallpaperLazy;
protected LockscreenWallpaper mLockscreenWallpaper;
@@ -373,7 +370,7 @@
protected StatusBarWindowController mStatusBarWindowController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@VisibleForTesting
- DozeServiceHost mDozeServiceHost = new DozeServiceHost();
+ DozeServiceHost mDozeServiceHost;
private boolean mWakeUpComingFromTouch;
private PointF mWakeUpTouchLocation;
@@ -398,6 +395,7 @@
private final StatusBarWindowViewController.Builder mStatusBarWindowViewControllerBuilder;
private final NotifLog mNotifLog;
private final DozeParameters mDozeParameters;
+ private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
// expanded notifications
protected NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window
@@ -492,7 +490,6 @@
private final UiOffloadThread mUiOffloadThread;
protected boolean mDozing;
- private boolean mDozingRequested;
private final NotificationMediaManager mMediaManager;
private final NotificationLockscreenUserManager mLockscreenUserManager;
@@ -611,7 +608,6 @@
private ActivityLaunchAnimator mActivityLaunchAnimator;
protected StatusBarNotificationPresenter mPresenter;
private NotificationActivityStarter mNotificationActivityStarter;
- private boolean mPulsing;
private final BubbleController mBubbleController;
private final BubbleController.BubbleExpandListener mBubbleExpandListener;
@@ -621,7 +617,6 @@
public void onActiveStateChanged(int code, int uid, String packageName, boolean active) {
Dependency.get(MAIN_HANDLER).post(() -> {
mForegroundServiceController.onAppOpChanged(code, uid, packageName, active);
- mNotificationListController.updateNotificationsForAppOp(code, uid, packageName, active);
});
}
@@ -691,7 +686,11 @@
NotifLog notifLog,
DozeParameters dozeParameters,
ScrimController scrimController,
- Lazy<LockscreenWallpaper> lockscreenWallpaperLazy) {
+ Lazy<LockscreenWallpaper> lockscreenWallpaperLazy,
+ Lazy<BiometricUnlockController> biometricUnlockControllerLazy,
+ DozeServiceHost dozeServiceHost,
+ PowerManager powerManager,
+ DozeScrimController dozeScrimController) {
super(context);
mFeatureFlags = featureFlags;
mLightBarController = lightBarController;
@@ -748,9 +747,13 @@
mStatusBarWindowController = statusBarWindowController;
mStatusBarWindowViewControllerBuilder = statusBarWindowViewControllerBuilder;
mNotifLog = notifLog;
+ mDozeServiceHost = dozeServiceHost;
+ mPowerManager = powerManager;
mDozeParameters = dozeParameters;
mScrimController = scrimController;
mLockscreenWallpaperLazy = lockscreenWallpaperLazy;
+ mDozeScrimController = dozeScrimController;
+ mBiometricUnlockControllerLazy = biometricUnlockControllerLazy;
mBubbleExpandListener =
(isExpanding, key) -> {
@@ -802,7 +805,6 @@
mAccessibilityManager = (AccessibilityManager)
mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
- mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mKeyguardUpdateMonitor.setKeyguardBypassController(mKeyguardBypassController);
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
@@ -902,6 +904,9 @@
startKeyguard();
mKeyguardUpdateMonitor.registerCallback(mUpdateCallback);
+ mDozeServiceHost.initialize(this, mNotificationIconAreaController,
+ mStatusBarWindowViewController, mStatusBarWindow, mStatusBarKeyguardViewManager,
+ mNotificationPanel, mAmbientIndicationContainer);
putComponent(DozeHost.class, mDozeServiceHost);
mScreenPinningRequest = new ScreenPinningRequest(mContext);
@@ -1066,7 +1071,6 @@
mNotificationPanel.initDependencies(this, mGroupManager, mNotificationShelf,
mHeadsUpManager, mNotificationIconAreaController, mScrimController);
- mDozeScrimController = new DozeScrimController(mDozeParameters, mDozeLog);
BackDropView backdrop = mStatusBarWindow.findViewById(R.id.backdrop);
mMediaManager.setup(backdrop, backdrop.findViewById(R.id.backdrop_front),
@@ -1370,11 +1374,7 @@
protected void startKeyguard() {
Trace.beginSection("StatusBar#startKeyguard");
- mBiometricUnlockController = new BiometricUnlockController(mContext,
- mDozeScrimController, mKeyguardViewMediator,
- mScrimController, this, mKeyguardStateController, new Handler(),
- mKeyguardUpdateMonitor, mKeyguardBypassController, mDozeParameters);
- putComponent(BiometricUnlockController.class, mBiometricUnlockController);
+ mBiometricUnlockController = mBiometricUnlockControllerLazy.get();
mStatusBarKeyguardViewManager = mKeyguardViewMediator.registerStatusBar(this,
getBouncerContainer(), mNotificationPanel, mBiometricUnlockController,
mStatusBarWindow.findViewById(R.id.lock_icon_container), mStackScroller,
@@ -1528,7 +1528,6 @@
.start();
}
}
- mMediaManager.findAndUpdateMediaNotifications();
}
private void updateReportRejectedTouchVisibility() {
@@ -1731,7 +1730,7 @@
if (isDozing() && isHeadsUp) {
entry.setPulseSuppressed(false);
mDozeServiceHost.fireNotificationPulse(entry);
- if (mPulsing) {
+ if (mDozeServiceHost.isPulsing()) {
mDozeScrimController.cancelPendingPulseTimeout();
}
}
@@ -1763,7 +1762,7 @@
}
public boolean isPulsing() {
- return mPulsing;
+ return mDozeServiceHost.isPulsing();
}
public boolean hideStatusBarIconsWhenExpanded() {
@@ -2826,7 +2825,7 @@
if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP
&& mKeyguardStateController.canDismissLockScreen()
&& !mStatusBarStateController.leaveOpenOnKeyguardHide()
- && isPulsing()) {
+ && mDozeServiceHost.isPulsing()) {
// Reuse the biometric wake-and-unlock transition if we dismiss keyguard from a pulse.
// TODO: Factor this transition out of BiometricUnlockController.
mBiometricUnlockController.startWakeAndUnlock(
@@ -3157,7 +3156,7 @@
return mState == StatusBarState.FULLSCREEN_USER_SWITCHER;
}
- private boolean updateIsKeyguard() {
+ boolean updateIsKeyguard() {
boolean wakeAndUnlocking = mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
@@ -3165,8 +3164,8 @@
// there's no surface we can show to the user. Note that the device goes fully interactive
// late in the transition, so we also allow the device to start dozing once the screen has
// turned off fully.
- boolean keyguardForDozing = mDozingRequested &&
- (!mDeviceInteractive || isGoingToSleep() && (isScreenFullyOff() || mIsKeyguard));
+ boolean keyguardForDozing = mDozeServiceHost.getDozingRequested()
+ && (!mDeviceInteractive || isGoingToSleep() && (isScreenFullyOff() || mIsKeyguard));
boolean shouldBeKeyguard = (mStatusBarStateController.isKeyguardRequested()
|| keyguardForDozing) && !wakeAndUnlocking;
if (keyguardForDozing) {
@@ -3582,7 +3581,7 @@
public void onStateChanged(int newState) {
mState = newState;
updateReportRejectedTouchVisibility();
- updateDozing();
+ mDozeServiceHost.updateDozing();
updateTheme();
mNavigationBarController.touchAutoDim(mDisplayId);
Trace.beginSection("StatusBar#updateKeyguardState");
@@ -3620,9 +3619,11 @@
public void onDozingChanged(boolean isDozing) {
Trace.beginSection("StatusBar#updateDozing");
mDozing = isDozing;
+ mDozeServiceHost.setDozing(mDozing);
// Collapse the notification panel if open
- boolean dozingAnimated = mDozingRequested && mDozeParameters.shouldControlScreenOff();
+ boolean dozingAnimated = mDozeServiceHost.getDozingRequested()
+ && mDozeParameters.shouldControlScreenOff();
mNotificationPanel.resetViews(dozingAnimated);
updateQsExpansionEnabled();
@@ -3630,26 +3631,12 @@
mEntryManager.updateNotifications("onDozingChanged");
updateDozingState();
+ mDozeServiceHost.updateDozing();
updateScrimController();
updateReportRejectedTouchVisibility();
Trace.endSection();
}
- private void updateDozing() {
- // When in wake-and-unlock while pulsing, keep dozing state until fully unlocked.
- boolean dozing = mDozingRequested && mState == StatusBarState.KEYGUARD
- || mBiometricUnlockController.getMode()
- == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
- // When in wake-and-unlock we may not have received a change to mState
- // but we still should not be dozing, manually set to false.
- if (mBiometricUnlockController.getMode() ==
- BiometricUnlockController.MODE_WAKE_AND_UNLOCK) {
- dozing = false;
- }
-
- mStatusBarStateController.setIsDozing(dozing);
- }
-
private void updateKeyguardState() {
mKeyguardStateController.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
mStatusBarKeyguardViewManager.isOccluded());
@@ -3874,10 +3861,11 @@
* collapse the panel after we expanded it, and thus we would end up with a blank
* Keyguard.
*/
- private void updateNotificationPanelTouchState() {
+ void updateNotificationPanelTouchState() {
boolean goingToSleepWithoutAnimation = isGoingToSleep()
&& !mDozeParameters.shouldControlScreenOff();
- boolean disabled = (!mDeviceInteractive && !mPulsing) || goingToSleepWithoutAnimation;
+ boolean disabled = (!mDeviceInteractive && !mDozeServiceHost.isPulsing())
+ || goingToSleepWithoutAnimation;
mNotificationPanel.setTouchAndAnimationDisabled(disabled);
mNotificationIconAreaController.setAnimationsEnabled(!disabled);
}
@@ -4027,7 +4015,7 @@
}
public void notifyBiometricAuthModeChanged() {
- updateDozing();
+ mDozeServiceHost.updateDozing();
updateScrimController();
mStatusBarWindowViewController.onBiometricAuthModeChanged(
mBiometricUnlockController.isWakeAndUnlock(),
@@ -4063,7 +4051,7 @@
mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
} else if (mBrightnessMirrorVisible) {
mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR);
- } else if (isPulsing()) {
+ } else if (mDozeServiceHost.isPulsing()) {
mScrimController.transitionTo(ScrimState.PULSING,
mDozeScrimController.getScrimCallback());
} else if (mDozeServiceHost.hasPendingScreenOffCallback()) {
@@ -4093,287 +4081,8 @@
return mStatusBarKeyguardViewManager.isShowing();
}
- @VisibleForTesting
- final class DozeServiceHost implements DozeHost {
- private final ArrayList<Callback> mCallbacks = new ArrayList<>();
- private boolean mAnimateWakeup;
- private boolean mAnimateScreenOff;
- private boolean mIgnoreTouchWhilePulsing;
- private Runnable mPendingScreenOffCallback;
- @VisibleForTesting
- boolean mWakeLockScreenPerformsAuth = SystemProperties.getBoolean(
- "persist.sysui.wake_performs_auth", true);
-
- @Override
- public String toString() {
- return "PSB.DozeServiceHost[mCallbacks=" + mCallbacks.size() + "]";
- }
-
- public void firePowerSaveChanged(boolean active) {
- for (Callback callback : mCallbacks) {
- callback.onPowerSaveChanged(active);
- }
- }
-
- public void fireNotificationPulse(NotificationEntry entry) {
- Runnable pulseSupressedListener = () -> {
- entry.setPulseSuppressed(true);
- mNotificationIconAreaController.updateAodNotificationIcons();
- };
- for (Callback callback : mCallbacks) {
- callback.onNotificationAlerted(pulseSupressedListener);
- }
- }
-
- @Override
- public void addCallback(@NonNull Callback callback) {
- mCallbacks.add(callback);
- }
-
- @Override
- public void removeCallback(@NonNull Callback callback) {
- mCallbacks.remove(callback);
- }
-
- @Override
- public void startDozing() {
- if (!mDozingRequested) {
- mDozingRequested = true;
- mDozeLog.traceDozing(mDozing);
- updateDozing();
- updateIsKeyguard();
- }
- }
-
- @Override
- public void pulseWhileDozing(@NonNull PulseCallback callback, int reason) {
- if (reason == DozeEvent.PULSE_REASON_SENSOR_LONG_PRESS) {
- mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
- "com.android.systemui:LONG_PRESS");
- startAssist(new Bundle());
- return;
- }
-
- if (reason == DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN) {
- mScrimController.setWakeLockScreenSensorActive(true);
- }
-
- if (reason == DozeEvent.PULSE_REASON_DOCKING && mStatusBarWindow != null) {
- mStatusBarWindowViewController.suppressWakeUpGesture(true);
- }
-
- boolean passiveAuthInterrupt = reason == DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN
- && mWakeLockScreenPerformsAuth;
- // Set the state to pulsing, so ScrimController will know what to do once we ask it to
- // execute the transition. The pulse callback will then be invoked when the scrims
- // are black, indicating that StatusBar is ready to present the rest of the UI.
- mPulsing = true;
- mDozeScrimController.pulse(new PulseCallback() {
- @Override
- public void onPulseStarted() {
- callback.onPulseStarted();
- updateNotificationPanelTouchState();
- setPulsing(true);
- }
-
- @Override
- public void onPulseFinished() {
- mPulsing = false;
- callback.onPulseFinished();
- updateNotificationPanelTouchState();
- mScrimController.setWakeLockScreenSensorActive(false);
- if (mStatusBarWindow != null) {
- mStatusBarWindowViewController.suppressWakeUpGesture(false);
- }
- setPulsing(false);
- }
-
- private void setPulsing(boolean pulsing) {
- mStatusBarStateController.setPulsing(pulsing);
- mStatusBarKeyguardViewManager.setPulsing(pulsing);
- mKeyguardViewMediator.setPulsing(pulsing);
- mNotificationPanel.setPulsing(pulsing);
- mVisualStabilityManager.setPulsing(pulsing);
- mStatusBarWindowViewController.setPulsing(pulsing);
- mIgnoreTouchWhilePulsing = false;
- if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
- mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
- }
- updateScrimController();
- mPulseExpansionHandler.setPulsing(pulsing);
- mWakeUpCoordinator.setPulsing(pulsing);
- }
- }, reason);
- // DozeScrimController is in pulse state, now let's ask ScrimController to start
- // pulsing and draw the black frame, if necessary.
- updateScrimController();
- }
-
- @Override
- public void stopDozing() {
- if (mDozingRequested) {
- mDozingRequested = false;
- mDozeLog.traceDozing(mDozing);
- updateDozing();
- }
- }
-
- @Override
- public void onIgnoreTouchWhilePulsing(boolean ignore) {
- if (ignore != mIgnoreTouchWhilePulsing) {
- mDozeLog.tracePulseTouchDisabledByProx(ignore);
- }
- mIgnoreTouchWhilePulsing = ignore;
- if (isDozing() && ignore) {
- mStatusBarWindowViewController.cancelCurrentTouch();
- }
- }
-
- @Override
- public void dozeTimeTick() {
- mNotificationPanel.dozeTimeTick();
- if (mAmbientIndicationContainer instanceof DozeReceiver) {
- ((DozeReceiver) mAmbientIndicationContainer).dozeTimeTick();
- }
- }
-
- @Override
- public boolean isPowerSaveActive() {
- return mBatteryController.isAodPowerSave();
- }
-
- @Override
- public boolean isPulsingBlocked() {
- return mBiometricUnlockController.getMode()
- == BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
- }
-
- @Override
- public boolean isProvisioned() {
- return mDeviceProvisionedController.isDeviceProvisioned()
- && mDeviceProvisionedController.isCurrentUserSetup();
- }
-
- @Override
- public boolean isBlockingDoze() {
- if (mBiometricUnlockController.hasPendingAuthentication()) {
- Log.i(TAG, "Blocking AOD because fingerprint has authenticated");
- return true;
- }
- return false;
- }
-
- @Override
- public void extendPulse(int reason) {
- if (reason == DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN) {
- mScrimController.setWakeLockScreenSensorActive(true);
- }
- if (mDozeScrimController.isPulsing() && mHeadsUpManager.hasNotifications()) {
- mHeadsUpManager.extendHeadsUp();
- } else {
- mDozeScrimController.extendPulse();
- }
- }
-
- @Override
- public void stopPulsing() {
- if (mDozeScrimController.isPulsing()) {
- mDozeScrimController.pulseOutNow();
- }
- }
-
- @Override
- public void setAnimateWakeup(boolean animateWakeup) {
- if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_AWAKE
- || mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_WAKING) {
- // Too late to change the wakeup animation.
- return;
- }
- mAnimateWakeup = animateWakeup;
- }
-
- @Override
- public void setAnimateScreenOff(boolean animateScreenOff) {
- mAnimateScreenOff = animateScreenOff;
- }
-
- @Override
- public void onSlpiTap(float screenX, float screenY) {
- if (screenX > 0 && screenY > 0 && mAmbientIndicationContainer != null
- && mAmbientIndicationContainer.getVisibility() == View.VISIBLE) {
- mAmbientIndicationContainer.getLocationOnScreen(mTmpInt2);
- float viewX = screenX - mTmpInt2[0];
- float viewY = screenY - mTmpInt2[1];
- if (0 <= viewX && viewX <= mAmbientIndicationContainer.getWidth()
- && 0 <= viewY && viewY <= mAmbientIndicationContainer.getHeight()) {
- dispatchTap(mAmbientIndicationContainer, viewX, viewY);
- }
- }
- }
-
- @Override
- public void setDozeScreenBrightness(int value) {
- mStatusBarWindowController.setDozeScreenBrightness(value);
- }
-
- @Override
- public void setAodDimmingScrim(float scrimOpacity) {
- mScrimController.setAodFrontScrimAlpha(scrimOpacity);
- }
-
- @Override
- public void prepareForGentleSleep(Runnable onDisplayOffCallback) {
- if (onDisplayOffCallback != null) {
- Log.w(TAG, "Overlapping onDisplayOffCallback. Ignoring previous one.");
- }
- mPendingScreenOffCallback = onDisplayOffCallback;
- updateScrimController();
- }
-
- /**
- * When the dozing host is waiting for scrims to fade out to change the display state.
- */
- boolean hasPendingScreenOffCallback() {
- return mPendingScreenOffCallback != null;
- }
-
- /**
- * Executes an nullifies the pending display state callback.
- *
- * @see #hasPendingScreenOffCallback()
- * @see #prepareForGentleSleep(Runnable)
- */
- void executePendingScreenOffCallback() {
- if (mPendingScreenOffCallback == null) {
- return;
- }
- mPendingScreenOffCallback.run();
- mPendingScreenOffCallback = null;
- }
-
- private void dispatchTap(View view, float x, float y) {
- long now = SystemClock.elapsedRealtime();
- dispatchTouchEvent(view, x, y, now, MotionEvent.ACTION_DOWN);
- dispatchTouchEvent(view, x, y, now, MotionEvent.ACTION_UP);
- }
-
- private void dispatchTouchEvent(View view, float x, float y, long now, int action) {
- MotionEvent ev = MotionEvent.obtain(now, now, action, x, y, 0 /* meta */);
- view.dispatchTouchEvent(ev);
- ev.recycle();
- }
-
- private boolean shouldAnimateWakeup() {
- return mAnimateWakeup;
- }
-
- public boolean shouldAnimateScreenOff() {
- return mAnimateScreenOff;
- }
- }
-
public boolean shouldIgnoreTouch() {
- return isDozing() && mDozeServiceHost.mIgnoreTouchWhilePulsing;
+ return isDozing() && mDozeServiceHost.getIgnoreTouchWhilePulsing();
}
// Begin Extra BaseStatusBar methods.
@@ -4400,7 +4109,7 @@
private boolean mVisibleToUser;
protected DevicePolicyManager mDevicePolicyManager;
- protected PowerManager mPowerManager;
+ private final PowerManager mPowerManager;
protected StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
protected KeyguardManager mKeyguardManager;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
index 0a2fb2e..76683b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
@@ -16,9 +16,6 @@
package com.android.systemui.statusbar.policy;
-import static com.android.systemui.Dependency.BG_LOOPER_NAME;
-import static com.android.systemui.Dependency.MAIN_LOOPER_NAME;
-
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.bluetooth.BluetoothAdapter;
@@ -36,6 +33,8 @@
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
+import com.android.systemui.dagger.qualifiers.BgLooper;
+import com.android.systemui.dagger.qualifiers.MainLooper;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -46,7 +45,6 @@
import java.util.WeakHashMap;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -74,9 +72,8 @@
/**
*/
@Inject
- public BluetoothControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper,
- @Named(MAIN_LOOPER_NAME) Looper mainLooper,
- @Nullable LocalBluetoothManager localBluetoothManager) {
+ public BluetoothControllerImpl(Context context, @BgLooper Looper bgLooper,
+ @MainLooper Looper mainLooper, @Nullable LocalBluetoothManager localBluetoothManager) {
mLocalBluetoothManager = localBluetoothManager;
mBgHandler = new Handler(bgLooper);
mHandler = new H(mainLooper);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java
index 089d5c9..0a40b3c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java
@@ -14,8 +14,6 @@
package com.android.systemui.statusbar.policy;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.Context;
@@ -26,12 +24,12 @@
import android.provider.Settings.Secure;
import android.util.Log;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.settings.CurrentUserTracker;
import java.util.ArrayList;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -51,8 +49,7 @@
/**
*/
@Inject
- public DeviceProvisionedControllerImpl(Context context,
- @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
+ public DeviceProvisionedControllerImpl(Context context, @MainHandler Handler mainHandler) {
super(context);
mContext = context;
mContentResolver = context.getContentResolver();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionController.java
index cade5dc..3ce6239 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionController.java
@@ -57,7 +57,7 @@
ExtensionBuilder<T> withCallback(Consumer<T> callback);
ExtensionBuilder<T> withUiMode(int mode, Supplier<T> def);
ExtensionBuilder<T> withFeature(String feature, Supplier<T> def);
- Extension build();
+ Extension<T> build();
}
public interface PluginConverter<T, P> {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java
index fd030d1..eeef726 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java
@@ -135,7 +135,7 @@
}
@Override
- public ExtensionController.Extension build() {
+ public ExtensionController.Extension<T> build() {
// Sort items in ascending order
Collections.sort(mExtension.mProducers, Comparator.comparingInt(Item::sortOrder));
mExtension.notifyChanged();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index 1c6d12f..a3a9322 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -16,25 +16,27 @@
package com.android.systemui.statusbar.policy;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.app.ActivityManager;
import android.content.Context;
import android.net.ConnectivityManager;
+import android.net.wifi.WifiClient;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.UserManager;
import android.util.Log;
+import com.android.systemui.dagger.qualifiers.MainHandler;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.List;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
+ * Controller used to retrieve information related to a hotspot.
*/
@Singleton
public class HotspotControllerImpl implements HotspotController, WifiManager.SoftApCallback {
@@ -49,14 +51,15 @@
private final Context mContext;
private int mHotspotState;
- private int mNumConnectedDevices;
+ private volatile int mNumConnectedDevices;
private boolean mWaitingForTerminalState;
private boolean mListening;
/**
+ * Controller used to retrieve information related to a hotspot.
*/
@Inject
- public HotspotControllerImpl(Context context, @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
+ public HotspotControllerImpl(Context context, @MainHandler Handler mainHandler) {
mContext = context;
mConnectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -97,7 +100,6 @@
/**
* Adds {@code callback} to the controller. The controller will update the callback on state
* changes. It will immediately trigger the callback added to notify current state.
- * @param callback
*/
@Override
public void addCallback(Callback callback) {
@@ -111,8 +113,8 @@
mWifiManager.registerSoftApCallback(this, mMainHandler);
} else {
// mWifiManager#registerSoftApCallback triggers a call to
- // onNumClientsChanged on the Main Handler. In order to always update the
- // callback on added, we make this call when adding callbacks after the
+ // onConnectedClientsChanged on the Main Handler. In order to always update
+ // the callback on added, we make this call when adding callbacks after the
// first.
mMainHandler.post(() ->
callback.onHotspotChanged(isHotspotEnabled(),
@@ -233,8 +235,8 @@
}
@Override
- public void onNumClientsChanged(int numConnectedDevices) {
- mNumConnectedDevices = numConnectedDevices;
+ public void onConnectedClientsChanged(List<WifiClient> clients) {
+ mNumConnectedDevices = clients.size();
fireHotspotChangedCallback();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
index 683cdbb..5a97eed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.policy;
import static com.android.settingslib.Utils.updateLocationEnabled;
-import static com.android.systemui.Dependency.BG_LOOPER_NAME;
import android.app.ActivityManager;
import android.app.AppOpsManager;
@@ -36,13 +35,13 @@
import androidx.annotation.VisibleForTesting;
+import com.android.systemui.dagger.qualifiers.BgLooper;
import com.android.systemui.util.Utils;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -66,7 +65,7 @@
private final H mHandler = new H();
@Inject
- public LocationControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper) {
+ public LocationControllerImpl(Context context, @BgLooper Looper bgLooper) {
mContext = context;
// Register to listen for changes in location settings.
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 7b5d489..60784c9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -24,7 +24,6 @@
import static android.telephony.PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE;
import static com.android.internal.telephony.PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM;
-import static com.android.systemui.Dependency.BG_LOOPER_NAME;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -65,6 +64,7 @@
import com.android.systemui.DemoMode;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.BgLooper;
import com.android.systemui.settings.CurrentUserTracker;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGroup;
@@ -81,7 +81,6 @@
import java.util.Map;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/** Platform implementation of the network controller. **/
@@ -170,7 +169,7 @@
* Construct this controller object and register for updates.
*/
@Inject
- public NetworkControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper,
+ public NetworkControllerImpl(Context context, @BgLooper Looper bgLooper,
DeviceProvisionedController deviceProvisionedController) {
this(context, (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE),
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
index 7b4a7d2..502a9bd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -679,8 +679,8 @@
}
};
- InputConnection ic = InputConnectionCompat.createWrapper(
- inputConnection, outAttrs, callback);
+ InputConnection ic = inputConnection == null ? null :
+ InputConnectionCompat.createWrapper(inputConnection, outAttrs, callback);
Context userContext = null;
try {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
index d88ae78..0c68383 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
@@ -15,8 +15,6 @@
*/
package com.android.systemui.statusbar.policy;
-import static com.android.systemui.Dependency.BG_HANDLER_NAME;
-
import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
@@ -50,6 +48,7 @@
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.VpnConfig;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.BgHandler;
import com.android.systemui.settings.CurrentUserTracker;
import java.io.FileDescriptor;
@@ -57,7 +56,6 @@
import java.util.ArrayList;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -102,7 +100,7 @@
/**
*/
@Inject
- public SecurityControllerImpl(Context context, @Named(BG_HANDLER_NAME) Handler bgHandler) {
+ public SecurityControllerImpl(Context context, @BgHandler Handler bgHandler) {
this(context, bgHandler, null);
}
@@ -125,6 +123,7 @@
IntentFilter filter = new IntentFilter();
filter.addAction(KeyChain.ACTION_TRUST_STORE_CHANGED);
+ filter.addAction(Intent.ACTION_USER_UNLOCKED);
context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null,
bgHandler);
@@ -300,14 +299,11 @@
} else {
mVpnUserId = mCurrentUserId;
}
- refreshCACerts();
fireCallbacks();
}
- private void refreshCACerts() {
- new CACertLoader().execute(mCurrentUserId);
- int workProfileId = getWorkProfileUserId(mCurrentUserId);
- if (workProfileId != UserHandle.USER_NULL) new CACertLoader().execute(workProfileId);
+ private void refreshCACerts(int userId) {
+ new CACertLoader().execute(userId);
}
private String getNameForVpnConfig(VpnConfig cfg, UserHandle user) {
@@ -403,7 +399,10 @@
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) {
if (KeyChain.ACTION_TRUST_STORE_CHANGED.equals(intent.getAction())) {
- refreshCACerts();
+ refreshCACerts(getSendingUserId());
+ } else if (Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) {
+ int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
+ if (userId != UserHandle.USER_NULL) refreshCACerts(userId);
}
}
};
@@ -418,9 +417,6 @@
return new Pair<Integer, Boolean>(userId[0], hasCACerts);
} catch (RemoteException | InterruptedException | AssertionError e) {
Log.i(TAG, "failed to get CA certs", e);
- mBgHandler.postDelayed(
- () -> new CACertLoader().execute(userId[0]),
- CA_CERT_LOADING_RETRY_TIME_IN_MS);
return new Pair<Integer, Boolean>(userId[0], null);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
index 655c29c..347d300 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.policy;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.app.RemoteInput;
import android.content.Context;
import android.content.res.Resources;
@@ -30,9 +28,9 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
@Singleton
@@ -67,7 +65,7 @@
private final KeyValueListParser mParser = new KeyValueListParser(',');
@Inject
- public SmartReplyConstants(@Named(MAIN_HANDLER_NAME) Handler handler, Context context) {
+ public SmartReplyConstants(@MainHandler Handler handler, Context context) {
mHandler = handler;
mContext = context;
final Resources resources = mContext.getResources();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index bcfbdac..2c99668 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -16,9 +16,10 @@
package com.android.systemui.statusbar.policy;
+import static android.os.UserManager.SWITCHABILITY_STATUS_OK;
+
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import static com.android.systemui.DejankUtils.whitelistIpcs;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
import android.app.ActivityManager;
import android.app.Dialog;
@@ -58,6 +59,7 @@
import com.android.systemui.Prefs.Key;
import com.android.systemui.R;
import com.android.systemui.SystemUISecondaryUserService;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.qs.tiles.UserDetailView;
@@ -70,7 +72,6 @@
import java.util.List;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -110,7 +111,7 @@
@Inject
public UserSwitcherController(Context context, KeyguardStateController keyguardStateController,
- @Named(MAIN_HANDLER_NAME) Handler handler, ActivityStarter activityStarter) {
+ @MainHandler Handler handler, ActivityStarter activityStarter) {
mContext = context;
if (!UserManager.isGuestUserEphemeral()) {
mGuestResumeSessionReceiver.register(context);
@@ -197,7 +198,10 @@
}
ArrayList<UserRecord> records = new ArrayList<>(infos.size());
int currentId = ActivityManager.getCurrentUser();
- boolean canSwitchUsers = mUserManager.canSwitchUsers();
+ // Check user switchability of the foreground user since SystemUI is running in
+ // User 0
+ boolean canSwitchUsers = mUserManager.getUserSwitchability(
+ UserHandle.of(ActivityManager.getCurrentUser())) == SWITCHABILITY_STATUS_OK;
UserInfo currentUserInfo = null;
UserRecord guestRecord = null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java
index 29c42d2..1c7a195 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.policy;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.NotificationManager;
@@ -41,6 +39,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dumpable;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.qs.GlobalSetting;
import com.android.systemui.settings.CurrentUserTracker;
import com.android.systemui.util.Utils;
@@ -51,7 +50,6 @@
import java.util.Objects;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/** Platform implementation of the zen mode controller. **/
@@ -79,7 +77,7 @@
private NotificationManager.Policy mConsolidatedNotificationPolicy;
@Inject
- public ZenModeControllerImpl(Context context, @Named(MAIN_HANDLER_NAME) Handler handler) {
+ public ZenModeControllerImpl(Context context, @MainHandler Handler handler) {
super(context);
mContext = context;
mModeSetting = new GlobalSetting(mContext, handler, Global.ZEN_MODE) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java
index d6d0a36..9b685f0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java
@@ -30,6 +30,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewPropertyAnimator;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.ImageView;
@@ -45,7 +46,10 @@
private static final String TAG = "AudioRecordingDisclosureBar";
private static final boolean DEBUG = false;
- private static final String LAYOUT_PARAMS_TITLE = "AudioRecordingDisclosureBar";
+ // This title is used to test the microphone disclosure indicator in
+ // CtsSystemUiHostTestCases:TvMicrophoneCaptureIndicatorTest
+ private static final String LAYOUT_PARAMS_TITLE = "MicrophoneCaptureIndicator";
+
private static final int ANIM_DURATION_MS = 150;
private final Context mContext;
@@ -70,6 +74,7 @@
}
private void createView() {
+ //TODO(b/142228704): this is to be re-implemented once proper design is completed
mView = View.inflate(mContext,
R.layout.tv_status_bar_audio_recording, null);
mAppsInfoContainer = mView.findViewById(R.id.container);
@@ -88,7 +93,7 @@
Context.WINDOW_SERVICE);
windowManager.addView(mView, layoutParams);
- // Set invisible first util it gains its actual size and we are able to hide it by moving
+ // Set invisible first until it gains its actual size and we are able to hide it by moving
// off the screen
mView.setVisibility(View.INVISIBLE);
mView.getViewTreeObserver().addOnGlobalLayoutListener(
@@ -98,16 +103,18 @@
// Now that we get the height, we can move the bar off ("below") the screen
final int height = mView.getHeight();
mView.setTranslationY(height);
- // ... and make it visible
- mView.setVisibility(View.VISIBLE);
// Remove the observer
mView.getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
+ // Now, that the view has been measured, and the translation was set to
+ // move it off the screen, we change the visibility to GONE
+ mView.setVisibility(View.GONE);
}
});
}
private void showAudioRecordingDisclosureBar() {
+ mView.setVisibility(View.VISIBLE);
mView.animate()
.translationY(0f)
.setDuration(ANIM_DURATION_MS)
@@ -138,9 +145,10 @@
}
private void hideAudioRecordingDisclosureBar() {
- mView.animate()
- .translationY(mView.getHeight())
+ final ViewPropertyAnimator animator = mView.animate();
+ animator.translationY(mView.getHeight())
.setDuration(ANIM_DURATION_MS)
+ .withEndAction(() -> mView.setVisibility(View.GONE))
.start();
}
@@ -156,7 +164,7 @@
public void onOpActiveChanged(String op, int uid, String packageName, boolean active) {
if (DEBUG) {
Log.d(TAG,
- "OP_RECORD_AUDIO active change, active" + active + ", app=" + packageName);
+ "OP_RECORD_AUDIO active change, active=" + active + ", app=" + packageName);
}
if (mExemptApps.contains(packageName)) {
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java
index a55e2cf..2d6027c 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java
@@ -15,8 +15,6 @@
*/
package com.android.systemui.tuner;
-import static com.android.systemui.Dependency.MAIN_HANDLER_NAME;
-
import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.Context;
@@ -36,6 +34,7 @@
import com.android.internal.util.ArrayUtils;
import com.android.systemui.DejankUtils;
import com.android.systemui.DemoMode;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.settings.CurrentUserTracker;
import com.android.systemui.statusbar.phone.StatusBarIconController;
@@ -46,7 +45,6 @@
import java.util.Set;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
@@ -83,7 +81,7 @@
/**
*/
@Inject
- public TunerServiceImpl(Context context, @Named(MAIN_HANDLER_NAME) Handler mainHandler,
+ public TunerServiceImpl(Context context, @MainHandler Handler mainHandler,
LeakDetector leakDetector) {
mContext = context;
mContentResolver = mContext.getContentResolver();
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
index fa3ff64e..0b27327 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
@@ -35,6 +35,7 @@
import android.widget.CheckBox;
import com.android.internal.app.ResolverActivity;
+import com.android.internal.app.chooser.TargetInfo;
import com.android.systemui.R;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
index 7e801da..5ed027d 100644
--- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
+++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
@@ -26,7 +26,7 @@
import com.android.keyguard.KeyguardClockSwitch;
import com.android.keyguard.KeyguardMessageArea;
import com.android.keyguard.KeyguardSliceView;
-import com.android.systemui.SystemUIRootComponent;
+import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.qs.QSCarrierGroup;
import com.android.systemui.qs.QSFooterImpl;
import com.android.systemui.qs.QSPanel;
diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java
index 63db755..bff405c 100644
--- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java
@@ -20,7 +20,6 @@
import static android.telephony.ims.feature.ImsFeature.STATE_UNAVAILABLE;
import static com.android.internal.logging.MetricsLogger.VIEW_UNKNOWN;
-import static com.android.systemui.Dependency.BG_LOOPER_NAME;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -48,6 +47,7 @@
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
+import com.android.systemui.dagger.qualifiers.BgLooper;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.qs.QSHost;
@@ -59,7 +59,6 @@
import java.util.List;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
/**
@@ -110,7 +109,7 @@
@Inject
public GarbageMonitor(
Context context,
- @Named(BG_LOOPER_NAME) Looper bgLooper,
+ @BgLooper Looper bgLooper,
LeakDetector leakDetector,
LeakReporter leakReporter) {
mContext = context.getApplicationContext();
diff --git a/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java b/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java
index fdffc43..a96977a 100644
--- a/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java
+++ b/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java
@@ -25,8 +25,8 @@
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.DependencyProvider;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.MainResources;
import java.util.ArrayList;
import java.util.List;
@@ -65,7 +65,7 @@
};
@Inject
- public ProximitySensor(@DependencyProvider.MainResources Resources resources,
+ public ProximitySensor(@MainResources Resources resources,
AsyncSensorManager sensorManager) {
mSensorManager = sensorManager;
Sensor sensor = findBrightnessSensor(resources);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
index 5c4ef18..768bd13 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
@@ -21,11 +21,15 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.annotation.UserIdInt;
+import android.app.AppOpsManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.os.Bundle;
@@ -42,6 +46,8 @@
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import junit.framework.Assert;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -50,27 +56,104 @@
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ForegroundServiceControllerTest extends SysuiTestCase {
- @UserIdInt private static final int USERID_ONE = 10; // UserManagerService.MIN_USER_ID;
- @UserIdInt private static final int USERID_TWO = USERID_ONE + 1;
-
private ForegroundServiceController mFsc;
private ForegroundServiceNotificationListener mListener;
private NotificationEntryListener mEntryListener;
+ private NotificationEntryManager mEntryManager;
@Before
public void setUp() throws Exception {
- mFsc = new ForegroundServiceController();
- NotificationEntryManager notificationEntryManager = mock(NotificationEntryManager.class);
+ mEntryManager = mock(NotificationEntryManager.class);
+ mFsc = new ForegroundServiceController(mEntryManager);
mListener = new ForegroundServiceNotificationListener(
- mContext, mFsc, notificationEntryManager);
+ mContext, mFsc, mEntryManager);
ArgumentCaptor<NotificationEntryListener> entryListenerCaptor =
ArgumentCaptor.forClass(NotificationEntryListener.class);
- verify(notificationEntryManager).addNotificationEntryListener(
+ verify(mEntryManager).addNotificationEntryListener(
entryListenerCaptor.capture());
mEntryListener = entryListenerCaptor.getValue();
}
@Test
+ public void testAppOps_appOpChangedBeforeNotificationExists() {
+ // GIVEN app op exists, but notification doesn't exist in NEM yet
+ NotificationEntry entry = createFgEntry();
+ mFsc.onAppOpChanged(
+ AppOpsManager.OP_CAMERA,
+ entry.getSbn().getUid(),
+ entry.getSbn().getPackageName(),
+ true);
+ assertFalse(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA));
+
+ // WHEN the notification is added
+ mEntryListener.onPendingEntryAdded(entry);
+
+ // THEN the app op is added to the entry
+ Assert.assertTrue(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA));
+ }
+
+ @Test
+ public void testAppOps_appOpAddedToForegroundNotif() {
+ // GIVEN a notification associated with a foreground service
+ NotificationEntry entry = addFgEntry();
+ when(mEntryManager.getPendingOrCurrentNotif(entry.getKey())).thenReturn(entry);
+
+ // WHEN we are notified of a new app op for this notification
+ mFsc.onAppOpChanged(
+ AppOpsManager.OP_CAMERA,
+ entry.getSbn().getUid(),
+ entry.getSbn().getPackageName(),
+ true);
+
+ // THEN the app op is added to the entry
+ Assert.assertTrue(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA));
+
+ // THEN notification views are updated since the notification is visible
+ verify(mEntryManager, times(1)).updateNotifications(anyString());
+ }
+
+ @Test
+ public void testAppOpsAlreadyAdded() {
+ // GIVEN a foreground service associated notification that already has the correct app op
+ NotificationEntry entry = addFgEntry();
+ entry.mActiveAppOps.add(AppOpsManager.OP_CAMERA);
+ when(mEntryManager.getPendingOrCurrentNotif(entry.getKey())).thenReturn(entry);
+
+ // WHEN we are notified of the same app op for this notification
+ mFsc.onAppOpChanged(
+ AppOpsManager.OP_CAMERA,
+ entry.getSbn().getUid(),
+ entry.getSbn().getPackageName(),
+ true);
+
+ // THEN the app op still exists in the notification entry
+ Assert.assertTrue(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA));
+
+ // THEN notification views aren't updated since nothing changed
+ verify(mEntryManager, never()).updateNotifications(anyString());
+ }
+
+ @Test
+ public void testAppOps_appOpNotAddedToUnrelatedNotif() {
+ // GIVEN no notification entries correspond to the newly updated appOp
+ NotificationEntry entry = addFgEntry();
+ when(mEntryManager.getPendingOrCurrentNotif(entry.getKey())).thenReturn(null);
+
+ // WHEN a new app op is detected
+ mFsc.onAppOpChanged(
+ AppOpsManager.OP_CAMERA,
+ entry.getSbn().getUid(),
+ entry.getSbn().getPackageName(),
+ true);
+
+ // THEN we won't see appOps on the entry
+ Assert.assertFalse(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA));
+
+ // THEN notification views aren't updated since nothing changed
+ verify(mEntryManager, never()).updateNotifications(anyString());
+ }
+
+ @Test
public void testAppOpsCRUD() {
// no crash on remove that doesn't exist
mFsc.onAppOpChanged(9, 1000, "pkg1", false);
@@ -339,12 +422,12 @@
assertTrue(mFsc.isSystemAlertWarningNeeded(USERID_ONE, PKG1));
}
- private StatusBarNotification makeMockSBN(int userid, String pkg, int id, String tag,
+ private StatusBarNotification makeMockSBN(int userId, String pkg, int id, String tag,
int flags) {
final Notification n = mock(Notification.class);
n.extras = new Bundle();
n.flags = flags;
- return makeMockSBN(userid, pkg, id, tag, n);
+ return makeMockSBN(userId, pkg, id, tag, n);
}
private StatusBarNotification makeMockSBN(int userid, String pkg, int id, String tag,
@@ -360,10 +443,10 @@
return sbn;
}
- private StatusBarNotification makeMockFgSBN(int userid, String pkg, int id,
+ private StatusBarNotification makeMockFgSBN(int uid, String pkg, int id,
boolean usesStdLayout) {
StatusBarNotification sbn =
- makeMockSBN(userid, pkg, id, "foo", Notification.FLAG_FOREGROUND_SERVICE);
+ makeMockSBN(uid, pkg, id, "foo", Notification.FLAG_FOREGROUND_SERVICE);
if (usesStdLayout) {
sbn.getNotification().contentView = null;
sbn.getNotification().headsUpContentView = null;
@@ -374,8 +457,8 @@
return sbn;
}
- private StatusBarNotification makeMockFgSBN(int userid, String pkg) {
- return makeMockSBN(userid, pkg, 1000, "foo", Notification.FLAG_FOREGROUND_SERVICE);
+ private StatusBarNotification makeMockFgSBN(int uid, String pkg) {
+ return makeMockSBN(uid, pkg, 1000, "foo", Notification.FLAG_FOREGROUND_SERVICE);
}
private StatusBarNotification makeMockDisclosure(int userid, String[] pkgs) {
@@ -392,6 +475,19 @@
return sbn;
}
+ private NotificationEntry addFgEntry() {
+ NotificationEntry entry = createFgEntry();
+ mEntryListener.onPendingEntryAdded(entry);
+ return entry;
+ }
+
+ private NotificationEntry createFgEntry() {
+ return new NotificationEntryBuilder()
+ .setSbn(makeMockFgSBN(0, TEST_PACKAGE_NAME, 1000, true))
+ .setImportance(NotificationManager.IMPORTANCE_DEFAULT)
+ .build();
+ }
+
private void entryRemoved(StatusBarNotification notification) {
mEntryListener.onEntryRemoved(
new NotificationEntryBuilder()
@@ -414,6 +510,10 @@
.setSbn(notification)
.setImportance(importance)
.build();
- mEntryListener.onPostEntryUpdated(entry);
+ mEntryListener.onPreEntryUpdated(entry);
}
+
+ @UserIdInt private static final int USERID_ONE = 10; // UserManagerService.MIN_USER_ID;
+ @UserIdInt private static final int USERID_TWO = USERID_ONE + 1;
+ private static final String TEST_PACKAGE_NAME = "test";
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
index c338d70..7359fdce 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
@@ -61,9 +61,13 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import java.util.Collections;
+import dagger.Lazy;
+
@RunWithLooper
@RunWith(AndroidTestingRunner.class)
@SmallTest
@@ -71,16 +75,19 @@
private TestableLooper mTestableLooper;
private ScreenDecorations mScreenDecorations;
- private StatusBar mStatusBar;
+ @Mock private StatusBar mStatusBar;
private WindowManager mWindowManager;
private FragmentService mFragmentService;
private FragmentHostManager mFragmentHostManager;
private TunerService mTunerService;
private StatusBarWindowView mView;
private TunablePaddingService mTunablePaddingService;
+ @Mock private Lazy<StatusBar> mStatusBarLazy;
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
+
mTestableLooper = TestableLooper.get(this);
mDependency.injectTestDependency(Dependency.MAIN_HANDLER,
new Handler(mTestableLooper.getLooper()));
@@ -88,11 +95,10 @@
mTunerService = mDependency.injectMockDependency(TunerService.class);
mFragmentService = mDependency.injectMockDependency(FragmentService.class);
- mStatusBar = mock(StatusBar.class);
mWindowManager = mock(WindowManager.class);
mView = spy(new StatusBarWindowView(mContext, null));
+ when(mStatusBarLazy.get()).thenReturn(mStatusBar);
when(mStatusBar.getStatusBarWindow()).thenReturn(mView);
- mContext.putComponent(StatusBar.class, mStatusBar);
Display display = mContext.getSystemService(WindowManager.class).getDefaultDisplay();
when(mWindowManager.getDefaultDisplay()).thenReturn(display);
@@ -102,7 +108,7 @@
when(mFragmentService.getFragmentHostManager(any())).thenReturn(mFragmentHostManager);
- mScreenDecorations = new ScreenDecorations(mContext) {
+ mScreenDecorations = new ScreenDecorations(mContext, mStatusBarLazy) {
@Override
public void start() {
super.start();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java
index 2c85424..df67637 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java
@@ -370,11 +370,6 @@
public int getMediumToLargeAnimationDurationMs() {
return 0;
}
-
- @Override
- public int getAnimateCredentialStartDelayMs() {
- return 0;
- }
}
private class TestableBiometricView extends AuthBiometricView {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java
index 990f74a..6e438e8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java
@@ -16,7 +16,6 @@
package com.android.systemui.biometrics;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -206,5 +205,10 @@
public View getPanelView(FrameLayout parent) {
return mock(View.class);
}
+
+ @Override
+ public int getAnimateCredentialStartDelayMs() {
+ return 0;
+ }
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
index e1eb3b0..85d818a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
@@ -38,15 +38,18 @@
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.hardware.biometrics.Authenticator;
+import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.IBiometricServiceReceiverInternal;
+import android.hardware.face.FaceManager;
import android.os.Bundle;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableContext;
import android.testing.TestableLooper.RunWithLooper;
+import com.android.internal.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -89,9 +92,9 @@
when(context.getPackageManager()).thenReturn(mPackageManager);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE))
- .thenReturn(true);
+ .thenReturn(true);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
- .thenReturn(true);
+ .thenReturn(true);
when(mDialog1.getOpPackageName()).thenReturn("Dialog1");
when(mDialog2.getOpPackageName()).thenReturn("Dialog2");
@@ -170,20 +173,34 @@
@Test
public void testOnAuthenticationSucceededInvoked_whenSystemRequested() {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
- mAuthController.onBiometricAuthenticated(true, null /* failureReason */);
+ mAuthController.onBiometricAuthenticated();
verify(mDialog1).onAuthenticationSucceeded();
}
@Test
- public void testOnAuthenticationFailedInvoked_whenSystemRequested() {
+ public void testOnAuthenticationFailedInvoked_whenBiometricRejected() {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
- final String failureReason = "failure reason";
- mAuthController.onBiometricAuthenticated(false, failureReason);
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_NONE,
+ BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
+ 0 /* vendorCode */);
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
verify(mDialog1).onAuthenticationFailed(captor.capture());
- assertEquals(captor.getValue(), failureReason);
+ assertEquals(captor.getValue(), mContext.getString(R.string.biometric_not_recognized));
+ }
+
+ @Test
+ public void testOnAuthenticationFailedInvoked_whenBiometricTimedOut() {
+ showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
+ final int error = BiometricConstants.BIOMETRIC_ERROR_TIMEOUT;
+ final int vendorCode = 0;
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_FACE, error, vendorCode);
+
+ ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+ verify(mDialog1).onAuthenticationFailed(captor.capture());
+
+ assertEquals(captor.getValue(), FaceManager.getErrorString(mContext, error, vendorCode));
}
@Test
@@ -199,27 +216,27 @@
}
@Test
- public void testOnErrorInvoked_whenSystemRequested() {
+ public void testOnErrorInvoked_whenSystemRequested() throws Exception {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
final int error = 1;
- final String errMessage = "error message";
- mAuthController.onBiometricError(error, errMessage);
+ final int vendorCode = 0;
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_FACE, error, vendorCode);
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
verify(mDialog1).onError(captor.capture());
- assertEquals(captor.getValue(), errMessage);
+ assertEquals(captor.getValue(), FaceManager.getErrorString(mContext, error, vendorCode));
}
@Test
public void testErrorLockout_whenCredentialAllowed_AnimatesToCredentialUI() {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
final int error = BiometricConstants.BIOMETRIC_ERROR_LOCKOUT;
- final String errorString = "lockout";
+ final int vendorCode = 0;
when(mDialog1.isAllowDeviceCredentials()).thenReturn(true);
- mAuthController.onBiometricError(error, errorString);
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_FACE, error, vendorCode);
verify(mDialog1, never()).onError(anyString());
verify(mDialog1).animateToCredentialUI();
}
@@ -228,11 +245,11 @@
public void testErrorLockoutPermanent_whenCredentialAllowed_AnimatesToCredentialUI() {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
final int error = BiometricConstants.BIOMETRIC_ERROR_LOCKOUT_PERMANENT;
- final String errorString = "lockout_permanent";
+ final int vendorCode = 0;
when(mDialog1.isAllowDeviceCredentials()).thenReturn(true);
- mAuthController.onBiometricError(error, errorString);
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_FACE, error, vendorCode);
verify(mDialog1, never()).onError(anyString());
verify(mDialog1).animateToCredentialUI();
}
@@ -241,12 +258,12 @@
public void testErrorLockout_whenCredentialNotAllowed_sendsOnError() {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
final int error = BiometricConstants.BIOMETRIC_ERROR_LOCKOUT;
- final String errorString = "lockout";
+ final int vendorCode = 0;
when(mDialog1.isAllowDeviceCredentials()).thenReturn(false);
- mAuthController.onBiometricError(error, errorString);
- verify(mDialog1).onError(eq(errorString));
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_FACE, error, vendorCode);
+ verify(mDialog1).onError(eq(FaceManager.getErrorString(mContext, error, vendorCode)));
verify(mDialog1, never()).animateToCredentialUI();
}
@@ -254,12 +271,12 @@
public void testErrorLockoutPermanent_whenCredentialNotAllowed_sendsOnError() {
showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
final int error = BiometricConstants.BIOMETRIC_ERROR_LOCKOUT_PERMANENT;
- final String errorString = "lockout_permanent";
+ final int vendorCode = 0;
when(mDialog1.isAllowDeviceCredentials()).thenReturn(false);
- mAuthController.onBiometricError(error, errorString);
- verify(mDialog1).onError(eq(errorString));
+ mAuthController.onBiometricError(BiometricAuthenticator.TYPE_FACE, error, vendorCode);
+ verify(mDialog1).onError(eq(FaceManager.getErrorString(mContext, error, vendorCode)));
verify(mDialog1, never()).animateToCredentialUI();
}
@@ -372,6 +389,20 @@
verify(mReceiver).onDialogDismissed(eq(BiometricPrompt.DISMISSED_REASON_USER_CANCEL));
}
+ @Test
+ public void testDoesNotCrash_whenTryAgainPressedAfterDismissal() {
+ showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
+ mAuthController.onDismissed(AuthDialogCallback.DISMISSED_USER_CANCELED);
+ mAuthController.onTryAgainPressed();
+ }
+
+ @Test
+ public void testDoesNotCrash_whenDeviceCredentialPressedAfterDismissal() {
+ showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE);
+ mAuthController.onDismissed(AuthDialogCallback.DISMISSED_USER_CANCELED);
+ mAuthController.onDeviceCredentialPressed();
+ }
+
// Helpers
private void showDialog(int authenticators, int biometricModality) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java b/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
index 8f4de3f..47b35fd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
@@ -22,7 +22,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.anyObject;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -60,6 +59,8 @@
import java.time.Duration;
import java.util.concurrent.TimeUnit;
+import dagger.Lazy;
+
@RunWith(AndroidTestingRunner.class)
@RunWithLooper
@SmallTest
@@ -86,6 +87,8 @@
private IThermalEventListener mUsbThermalEventListener;
private IThermalEventListener mSkinThermalEventListener;
@Mock private BroadcastDispatcher mBroadcastDispatcher;
+ @Mock private Lazy<StatusBar> mStatusBarLazy;
+ @Mock private StatusBar mStatusBar;
@Before
public void setup() {
@@ -93,7 +96,8 @@
mMockWarnings = mDependency.injectMockDependency(WarningsUI.class);
mEnhancedEstimates = mDependency.injectMockDependency(EnhancedEstimates.class);
- mContext.putComponent(StatusBar.class, mock(StatusBar.class));
+ when(mStatusBarLazy.get()).thenReturn(mStatusBar);
+
mContext.addMockSystemService(Context.POWER_SERVICE, mPowerManager);
createPowerUi();
@@ -682,7 +686,7 @@
}
private void createPowerUi() {
- mPowerUI = new PowerUI(mContext, mBroadcastDispatcher);
+ mPowerUI = new PowerUI(mContext, mBroadcastDispatcher, mStatusBarLazy);
mPowerUI.mComponents = mContext.getComponents();
mPowerUI.mThermalService = mThermalServiceMock;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
index eb198c6..8c9ae71 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
@@ -418,10 +418,9 @@
@Test
public void testOnBiometricAuthenticated() {
- String failureReason = "test_failure_reason";
- mCommandQueue.onBiometricAuthenticated(true /* authenticated */, failureReason);
+ mCommandQueue.onBiometricAuthenticated();
waitForIdleSync();
- verify(mCallbacks).onBiometricAuthenticated(eq(true), eq(failureReason));
+ verify(mCallbacks).onBiometricAuthenticated();
}
@Test
@@ -434,11 +433,12 @@
@Test
public void testOnBiometricError() {
- final int errorCode = 1;
- String errorMessage = "test_error_message";
- mCommandQueue.onBiometricError(errorCode, errorMessage);
+ final int modality = 1;
+ final int error = 2;
+ final int vendorCode = 3;
+ mCommandQueue.onBiometricError(modality, error, vendorCode);
waitForIdleSync();
- verify(mCallbacks).onBiometricError(eq(errorCode), eq(errorMessage));
+ verify(mCallbacks).onBiometricError(eq(modality), eq(error), eq(vendorCode));
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
index ebdf851..b2a5109 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
@@ -82,6 +82,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationRowBinder;
import com.android.systemui.statusbar.notification.collection.NotificationRowBinderImpl;
import com.android.systemui.statusbar.notification.logging.NotifLog;
+import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
@@ -139,6 +140,7 @@
@Mock private RowInflaterTask mAsyncInflationTask;
@Mock private NotificationRowBinder mMockedRowBinder;
+ private int mId;
private NotificationEntry mEntry;
private StatusBarNotification mSbn;
private TestableNotificationEntryManager mEntryManager;
@@ -148,8 +150,12 @@
private final CountDownLatch mCountDownLatch;
TestableNotificationEntryManager() {
- super(new NotificationData(mock(NotificationSectionsFeatureManager.class),
- mock(NotifLog.class)), mock(NotifLog.class));
+ super(
+ new NotificationData(
+ mock(NotificationSectionsFeatureManager.class),
+ mock(NotifLog.class),
+ mock(PeopleNotificationIdentifier.class)),
+ mock(NotifLog.class));
mCountDownLatch = new CountDownLatch(1);
}
@@ -238,18 +244,7 @@
when(mListContainer.getViewParentForNotification(any())).thenReturn(
new FrameLayout(mContext));
- Notification.Builder n = new Notification.Builder(mContext, "")
- .setSmallIcon(R.drawable.ic_person)
- .setContentTitle("Title")
- .setContentText("Text");
-
- mEntry = new NotificationEntryBuilder()
- .setPkg(TEST_PACKAGE_NAME)
- .setOpPkg(TEST_PACKAGE_NAME)
- .setUid(TEST_UID)
- .setNotification(n.build())
- .setUser(new UserHandle(ActivityManager.getCurrentUser()))
- .build();
+ mEntry = createNotification();
mSbn = mEntry.getSbn();
mEntry.expandedIcon = mock(StatusBarIconView.class);
@@ -602,6 +597,22 @@
any(NotificationVisibility.class), anyBoolean());
}
+ private NotificationEntry createNotification() {
+ Notification.Builder n = new Notification.Builder(mContext, "")
+ .setSmallIcon(R.drawable.ic_person)
+ .setContentTitle("Title")
+ .setContentText("Text");
+
+ return new NotificationEntryBuilder()
+ .setPkg(TEST_PACKAGE_NAME)
+ .setOpPkg(TEST_PACKAGE_NAME)
+ .setUid(TEST_UID)
+ .setId(mId++)
+ .setNotification(n.build())
+ .setUser(new UserHandle(ActivityManager.getCurrentUser()))
+ .build();
+ }
+
private Notification.Action createAction() {
return new Notification.Action.Builder(
Icon.createWithResource(getContext(), android.R.drawable.sym_def_app_icon),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
index 9202c51..c2d2e31 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
@@ -16,24 +16,16 @@
package com.android.systemui.statusbar.notification;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-
-import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.ActivityManager;
-import android.app.AppOpsManager;
import android.app.Notification;
import android.os.UserHandle;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
-import android.util.ArraySet;
import androidx.test.filters.SmallTest;
@@ -46,6 +38,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.logging.NotifLog;
+import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
@@ -78,8 +71,10 @@
// TODO: Remove this once EntryManager no longer needs to be mocked
private NotificationData mNotificationData =
- new NotificationData(new NotificationSectionsFeatureManager(
- new DeviceConfigProxyFake(), mContext), mock(NotifLog.class));
+ new NotificationData(
+ new NotificationSectionsFeatureManager(new DeviceConfigProxyFake(), mContext),
+ mock(NotifLog.class),
+ mock(PeopleNotificationIdentifier.class));
private int mNextNotifId = 0;
@@ -120,107 +115,6 @@
verify(mEntryManager).updateNotifications(anyString());
}
- @Test
- public void testAppOps_appOpAddedToForegroundNotif() {
- // GIVEN a notification associated with a foreground service
- final NotificationEntry entry = buildEntry();
- mNotificationData.add(entry);
- when(mForegroundServiceController.getStandardLayoutKey(anyInt(), anyString()))
- .thenReturn(entry.getKey());
-
- // WHEN we are notified of a new app op
- mController.updateNotificationsForAppOp(
- AppOpsManager.OP_CAMERA,
- entry.getSbn().getUid(),
- entry.getSbn().getPackageName(),
- true);
-
- // THEN the app op is added to the entry
- assertTrue(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA));
- // THEN updateNotifications(TEST) is called
- verify(mEntryManager, times(1)).updateNotifications(anyString());
- }
-
- @Test
- public void testAppOps_appOpAddedToUnrelatedNotif() {
- // GIVEN No current foreground notifs
- when(mForegroundServiceController.getStandardLayoutKey(anyInt(), anyString()))
- .thenReturn(null);
-
- // WHEN An unrelated notification gets a new app op
- mController.updateNotificationsForAppOp(AppOpsManager.OP_CAMERA, 1000, "pkg", true);
-
- // THEN We never call updateNotifications(TEST)
- verify(mEntryManager, never()).updateNotifications(anyString());
- }
-
- @Test
- public void testAppOps_addNotificationWithExistingAppOps() {
- // GIVEN a notification with three associated app ops that is associated with a foreground
- // service
- final NotificationEntry entry = buildEntry();
- mNotificationData.add(entry);
- ArraySet<Integer> expected = new ArraySet<>();
- expected.add(3);
- expected.add(235);
- expected.add(1);
- when(mForegroundServiceController.getStandardLayoutKey(
- entry.getSbn().getUserId(),
- entry.getSbn().getPackageName())).thenReturn(entry.getKey());
- when(mForegroundServiceController.getAppOps(entry.getSbn().getUserId(),
- entry.getSbn().getPackageName())).thenReturn(expected);
-
- // WHEN the notification is added
- mEntryListener.onBeforeNotificationAdded(entry);
-
- // THEN the entry is tagged with all three app ops
- assertEquals(expected.size(), entry.mActiveAppOps.size());
- for (int op : expected) {
- assertTrue("Entry missing op " + op, entry.mActiveAppOps.contains(op));
- }
- }
-
- @Test
- public void testAdd_addNotificationWithNoExistingAppOps() {
- // GIVEN a notification with NO associated app ops
- final NotificationEntry entry = buildEntry();
-
- mNotificationData.add(entry);
- when(mForegroundServiceController.getStandardLayoutKey(
- entry.getSbn().getUserId(),
- entry.getSbn().getPackageName())).thenReturn(entry.getKey());
- when(mForegroundServiceController.getAppOps(entry.getSbn().getUserId(),
- entry.getSbn().getPackageName())).thenReturn(null);
-
- // WHEN the notification is added
- mEntryListener.onBeforeNotificationAdded(entry);
-
- // THEN the entry doesn't have any app ops associated with it
- assertEquals(0, entry.mActiveAppOps.size());
- }
-
- @Test
- public void testAdd_addNonForegroundNotificationWithExistingAppOps() {
- // GIVEN a notification with app ops that isn't associated with a foreground service
- final NotificationEntry entry = buildEntry();
- mNotificationData.add(entry);
- ArraySet<Integer> ops = new ArraySet<>();
- ops.add(3);
- ops.add(235);
- ops.add(1);
- when(mForegroundServiceController.getAppOps(entry.getSbn().getUserId(),
- entry.getSbn().getPackageName())).thenReturn(ops);
- when(mForegroundServiceController.getStandardLayoutKey(
- entry.getSbn().getUserId(),
- entry.getSbn().getPackageName())).thenReturn("something else");
-
- // WHEN the notification is added
- mEntryListener.onBeforeNotificationAdded(entry);
-
- // THEN the entry doesn't have any app ops associated with it
- assertEquals(0, entry.mActiveAppOps.size());
- }
-
private NotificationEntry buildEntry() {
mNextNotifId++;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
index 640984b..1a469d8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.notification.collection;
-import static android.app.AppOpsManager.OP_ACCEPT_HANDOVER;
-import static android.app.AppOpsManager.OP_CAMERA;
import static android.app.Notification.CATEGORY_ALARM;
import static android.app.Notification.CATEGORY_CALL;
import static android.app.Notification.CATEGORY_EVENT;
@@ -56,7 +54,6 @@
import android.graphics.drawable.Icon;
import android.media.session.MediaSession;
import android.os.Bundle;
-import android.os.Process;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.Ranking;
import android.service.notification.SnoozeCriterion;
@@ -64,7 +61,6 @@
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
-import android.util.ArraySet;
import androidx.test.filters.SmallTest;
@@ -81,6 +77,7 @@
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment;
import com.android.systemui.statusbar.notification.logging.NotifLog;
+import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.ShadeController;
@@ -159,69 +156,6 @@
}
@Test
- public void testAllRelevantNotisTaggedWithAppOps() throws Exception {
- mNotificationData.add(mRow.getEntry());
- ExpandableNotificationRow row2 = new NotificationTestHelper(getContext(), mDependency)
- .createRow();
- mNotificationData.add(row2.getEntry());
- ExpandableNotificationRow diffPkg =
- new NotificationTestHelper(getContext(), mDependency).createRow("pkg", 4000,
- Process.myUserHandle());
- mNotificationData.add(diffPkg.getEntry());
-
- ArraySet<Integer> expectedOps = new ArraySet<>();
- expectedOps.add(OP_CAMERA);
- expectedOps.add(OP_ACCEPT_HANDOVER);
-
- for (int op : expectedOps) {
- mNotificationData.updateAppOp(op, NotificationTestHelper.UID,
- NotificationTestHelper.PKG, mRow.getEntry().getKey(), true);
- mNotificationData.updateAppOp(op, NotificationTestHelper.UID,
- NotificationTestHelper.PKG, row2.getEntry().getKey(), true);
- }
- for (int op : expectedOps) {
- assertTrue(mRow.getEntry().getKey() + " doesn't have op " + op,
- mNotificationData.get(mRow.getEntry().getKey()).mActiveAppOps.contains(op));
- assertTrue(row2.getEntry().getKey() + " doesn't have op " + op,
- mNotificationData.get(row2.getEntry().getKey()).mActiveAppOps.contains(op));
- assertFalse(diffPkg.getEntry().getKey() + " has op " + op,
- mNotificationData.get(diffPkg.getEntry().getKey()).mActiveAppOps.contains(op));
- }
- }
-
- @Test
- public void testAppOpsRemoval() throws Exception {
- mNotificationData.add(mRow.getEntry());
- ExpandableNotificationRow row2 = new NotificationTestHelper(getContext(), mDependency)
- .createRow();
- mNotificationData.add(row2.getEntry());
-
- ArraySet<Integer> expectedOps = new ArraySet<>();
- expectedOps.add(OP_CAMERA);
- expectedOps.add(OP_ACCEPT_HANDOVER);
-
- for (int op : expectedOps) {
- mNotificationData.updateAppOp(op, NotificationTestHelper.UID,
- NotificationTestHelper.PKG, row2.getEntry().getKey(), true);
- }
-
- expectedOps.remove(OP_ACCEPT_HANDOVER);
- mNotificationData.updateAppOp(OP_ACCEPT_HANDOVER, NotificationTestHelper.UID,
- NotificationTestHelper.PKG, row2.getEntry().getKey(), false);
-
- assertTrue(mRow.getEntry().getKey() + " doesn't have op " + OP_CAMERA,
- mNotificationData.get(mRow.getEntry().getKey()).mActiveAppOps.contains(OP_CAMERA));
- assertTrue(row2.getEntry().getKey() + " doesn't have op " + OP_CAMERA,
- mNotificationData.get(row2.getEntry().getKey()).mActiveAppOps.contains(OP_CAMERA));
- assertFalse(mRow.getEntry().getKey() + " has op " + OP_ACCEPT_HANDOVER,
- mNotificationData.get(mRow.getEntry().getKey())
- .mActiveAppOps.contains(OP_ACCEPT_HANDOVER));
- assertFalse(row2.getEntry().getKey() + " has op " + OP_ACCEPT_HANDOVER,
- mNotificationData.get(row2.getEntry().getKey())
- .mActiveAppOps.contains(OP_ACCEPT_HANDOVER));
- }
-
- @Test
public void testGetNotificationsForCurrentUser_shouldFilterNonCurrentUserNotifications()
throws Exception {
mNotificationData.add(mRow.getEntry());
@@ -639,7 +573,10 @@
public static class TestableNotificationData extends NotificationData {
public TestableNotificationData(NotificationSectionsFeatureManager sectionsFeatureManager) {
- super(sectionsFeatureManager, mock(NotifLog.class));
+ super(
+ sectionsFeatureManager,
+ mock(NotifLog.class),
+ mock(PeopleNotificationIdentifier.class));
}
public static final String OVERRIDE_RANK = "r";
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/people/PeopleHubViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/people/PeopleHubViewControllerTest.kt
new file mode 100644
index 0000000..a1822c7
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/people/PeopleHubViewControllerTest.kt
@@ -0,0 +1,165 @@
+/*
+ * 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.systemui.statusbar.notification.people
+
+import android.app.PendingIntent
+import android.content.Intent
+import android.graphics.drawable.Drawable
+import android.testing.AndroidTestingRunner
+import android.view.View
+import androidx.test.filters.SmallTest
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.plugins.ActivityStarter
+import com.google.common.truth.Truth.assertThat
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mock
+import org.mockito.Mockito
+import org.mockito.Mockito.`when`
+import org.mockito.Mockito.mock
+import org.mockito.Mockito.verify
+import org.mockito.junit.MockitoJUnit
+import org.mockito.junit.MockitoRule
+import kotlin.reflect.KClass
+
+@SmallTest
+@RunWith(AndroidTestingRunner::class)
+class PeopleHubViewControllerTest : SysuiTestCase() {
+
+ @JvmField @Rule val mockito: MockitoRule = MockitoJUnit.rule()
+
+ @Mock private lateinit var mockViewBoundary: PeopleHubSectionFooterViewBoundary
+ @Mock private lateinit var mockActivityStarter: ActivityStarter
+
+ @Test
+ fun testBindViewModelToViewBoundary() {
+ val fakePerson1 = fakePersonViewModel("name")
+ val fakeViewModel = PeopleHubViewModel(sequenceOf(fakePerson1), true)
+
+ val fakePersonViewAdapter1 = FakeDataListener<PersonViewModel?>()
+ val fakePersonViewAdapter2 = FakeDataListener<PersonViewModel?>()
+
+ val mockClickView = mock(View::class.java)
+
+ `when`(mockViewBoundary.associatedViewForClickAnimation).thenReturn(mockClickView)
+ `when`(mockViewBoundary.personViewAdapters)
+ .thenReturn(sequenceOf(fakePersonViewAdapter1, fakePersonViewAdapter2))
+
+ val mockFactory = mock(PeopleHubViewModelFactory::class.java)
+ `when`(mockFactory.createWithAssociatedClickView(any())).thenReturn(fakeViewModel)
+
+ val mockSubscription = mock(Subscription::class.java)
+ val fakeFactoryDataSource = object : DataSource<PeopleHubViewModelFactory> {
+ override fun registerListener(
+ listener: DataListener<PeopleHubViewModelFactory>
+ ): Subscription {
+ listener.onDataChanged(mockFactory)
+ return mockSubscription
+ }
+ }
+ val adapter = PeopleHubSectionFooterViewAdapterImpl(fakeFactoryDataSource)
+
+ adapter.bindView(mockViewBoundary)
+
+ assertThat(fakePersonViewAdapter1.lastSeen).isEqualTo(Maybe.Just(fakePerson1))
+ assertThat(fakePersonViewAdapter2.lastSeen).isEqualTo(Maybe.Just<PersonViewModel?>(null))
+ verify(mockViewBoundary).setVisible(true)
+ verify(mockFactory).createWithAssociatedClickView(mockClickView)
+ }
+
+ fun testViewModelDataSourceTransformsModel() {
+ val fakeClickIntent = PendingIntent.getActivity(context, 0, Intent("action"), 0)
+ val fakePerson = fakePersonModel("id", "name", fakeClickIntent)
+ val fakeModel = PeopleHubModel(listOf(fakePerson))
+ val mockSubscription = mock(Subscription::class.java)
+ val fakeModelDataSource = object : DataSource<PeopleHubModel> {
+ override fun registerListener(listener: DataListener<PeopleHubModel>): Subscription {
+ listener.onDataChanged(fakeModel)
+ return mockSubscription
+ }
+ }
+ val factoryDataSource = PeopleHubViewModelFactoryDataSourceImpl(
+ mockActivityStarter, fakeModelDataSource)
+ val fakeListener = FakeDataListener<PeopleHubViewModelFactory>()
+ val mockClickView = mock(View::class.java)
+
+ factoryDataSource.registerListener(fakeListener)
+ val viewModel = (fakeListener.lastSeen as Maybe.Just).value
+ .createWithAssociatedClickView(mockClickView)
+ assertThat(viewModel.isVisible).isTrue()
+
+ val people = viewModel.people.toList()
+ assertThat(people.size).isEqualTo(1)
+ assertThat(people[0].name).isEqualTo("name")
+ assertThat(people[0].icon).isSameAs(fakePerson.avatar)
+
+ people[0].onClick()
+ verify(mockActivityStarter).startPendingIntentDismissingKeyguard(
+ same(fakeClickIntent),
+ any(),
+ same(mockClickView)
+ )
+ }
+}
+
+private inline fun <reified T : Any> any(): T {
+ return Mockito.any() ?: createInstance(T::class)
+}
+
+private inline fun <reified T : Any> same(value: T): T {
+ return Mockito.same(value) ?: createInstance(T::class)
+}
+
+private fun <T : Any> createInstance(clazz: KClass<T>): T = castNull()
+
+@Suppress("UNCHECKED_CAST")
+private fun <T> castNull(): T = null as T
+
+private fun fakePersonModel(
+ id: String,
+ name: CharSequence,
+ clickIntent: PendingIntent
+): PersonModel =
+ PersonModel(id, name, mock(Drawable::class.java), clickIntent)
+
+private fun fakePersonViewModel(name: CharSequence): PersonViewModel =
+ PersonViewModel(name, mock(Drawable::class.java), mock({}.javaClass))
+
+sealed class Maybe<T> {
+ data class Just<T>(val value: T) : Maybe<T>()
+ class Nothing<T> : Maybe<T>() {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (javaClass != other?.javaClass) return false
+ return true
+ }
+
+ override fun hashCode(): Int {
+ return javaClass.hashCode()
+ }
+ }
+}
+
+class FakeDataListener<T> : DataListener<T> {
+
+ var lastSeen: Maybe<T> = Maybe.Nothing()
+
+ override fun onDataChanged(data: T) {
+ lastSeen = Maybe.Just(data)
+ }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index 72bea56..4a0b371 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -34,7 +34,9 @@
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
+import android.testing.TestableResources;
+import com.android.internal.logging.MetricsLogger;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.keyguard.KeyguardViewMediator;
@@ -78,11 +80,14 @@
private KeyguardBypassController mKeyguardBypassController;
@Mock
private DozeParameters mDozeParameters;
+ @Mock
+ private MetricsLogger mMetricsLogger;
private BiometricUnlockController mBiometricUnlockController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
+ TestableResources res = getContext().getOrCreateTestableResources();
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
@@ -92,10 +97,11 @@
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
mDependency.injectTestDependency(StatusBarWindowController.class,
mStatusBarWindowController);
+ res.addOverride(com.android.internal.R.integer.config_wakeUpDelayDoze, 0);
mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController,
mKeyguardViewMediator, mScrimController, mStatusBar, mKeyguardStateController,
- mHandler, mUpdateMonitor, 0 /* wakeUpDelay */, mKeyguardBypassController,
- mDozeParameters);
+ mHandler, mUpdateMonitor, res.getResources(), mKeyguardBypassController,
+ mDozeParameters, mMetricsLogger);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
new file mode 100644
index 0000000..b05172c
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
@@ -0,0 +1,224 @@
+/*
+ * 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.systemui.statusbar.phone;
+
+import static org.junit.Assert.assertFalse;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.os.PowerManager;
+import android.testing.AndroidTestingRunner;
+import android.view.View;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.assist.AssistManager;
+import com.android.systemui.doze.DozeEvent;
+import com.android.systemui.doze.DozeHost;
+import com.android.systemui.doze.DozeLog;
+import com.android.systemui.keyguard.KeyguardViewMediator;
+import com.android.systemui.keyguard.WakefulnessLifecycle;
+import com.android.systemui.statusbar.PulseExpansionHandler;
+import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.StatusBarStateControllerImpl;
+import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
+import com.android.systemui.statusbar.notification.VisualStabilityManager;
+import com.android.systemui.statusbar.policy.BatteryController;
+import com.android.systemui.statusbar.policy.DeviceProvisionedController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+
+import dagger.Lazy;
+
+@SmallTest
+@RunWith(AndroidTestingRunner.class)
+public class DozeServiceHostTest extends SysuiTestCase {
+
+ private DozeServiceHost mDozeServiceHost;
+
+ @Mock private HeadsUpManagerPhone mHeadsUpManager;
+ @Mock private ScrimController mScrimController;
+ @Mock private DozeScrimController mDozeScrimController;
+ @Mock private Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
+ @Mock private VisualStabilityManager mVisualStabilityManager;
+ @Mock private KeyguardViewMediator mKeyguardViewMediator;
+ @Mock private StatusBarStateControllerImpl mStatusBarStateController;
+ @Mock private BatteryController mBatteryController;
+ @Mock private DeviceProvisionedController mDeviceProvisionedController;
+ @Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ @Mock private AssistManager mAssistManager;
+ @Mock private DozeLog mDozeLog;
+ @Mock private PulseExpansionHandler mPulseExpansionHandler;
+ @Mock private NotificationWakeUpCoordinator mNotificationWakeUpCoordinator;
+ @Mock private StatusBarWindowController mStatusBarWindowController;
+ @Mock private PowerManager mPowerManager;
+ @Mock private WakefulnessLifecycle mWakefullnessLifecycle;
+ @Mock private StatusBar mStatusBar;
+ @Mock private NotificationIconAreaController mNotificationIconAreaController;
+ @Mock private StatusBarWindowViewController mStatusBarWindowViewController;
+ @Mock private StatusBarWindowView mStatusBarWindow;
+ @Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ @Mock private NotificationPanelView mNotificationPanel;
+ @Mock private View mAmbientIndicationContainer;
+ @Mock private BiometricUnlockController mBiometricUnlockController;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController);
+ mDozeServiceHost = new DozeServiceHost(mDozeLog, mPowerManager, mWakefullnessLifecycle,
+ mStatusBarStateController, mDeviceProvisionedController, mHeadsUpManager,
+ mBatteryController, mScrimController, mBiometricUnlockControllerLazy,
+ mKeyguardViewMediator, mAssistManager, mDozeScrimController, mKeyguardUpdateMonitor,
+ mVisualStabilityManager, mPulseExpansionHandler, mStatusBarWindowController,
+ mNotificationWakeUpCoordinator);
+
+ mDozeServiceHost.initialize(mStatusBar, mNotificationIconAreaController,
+ mStatusBarWindowViewController, mStatusBarWindow, mStatusBarKeyguardViewManager,
+ mNotificationPanel, mAmbientIndicationContainer);
+ }
+
+ @Test
+ public void testStartStopDozing() {
+ when(mStatusBarStateController.getState()).thenReturn(StatusBarState.KEYGUARD);
+ when(mStatusBarStateController.isKeyguardRequested()).thenReturn(true);
+
+ assertFalse(mDozeServiceHost.getDozingRequested());
+
+ mDozeServiceHost.startDozing();
+ verify(mStatusBarStateController).setIsDozing(eq(true));
+ verify(mStatusBar).updateIsKeyguard();
+
+ mDozeServiceHost.stopDozing();
+ verify(mStatusBarStateController).setIsDozing(eq(false));
+ }
+
+
+ @Test
+ public void testPulseWhileDozing_updatesScrimController() {
+ mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
+ mStatusBar.showKeyguardImpl();
+
+ // Keep track of callback to be able to stop the pulse
+// DozeHost.PulseCallback[] pulseCallback = new DozeHost.PulseCallback[1];
+// doAnswer(invocation -> {
+// pulseCallback[0] = invocation.getArgument(0);
+// return null;
+// }).when(mDozeScrimController).pulse(any(), anyInt());
+
+ // Starting a pulse should change the scrim controller to the pulsing state
+ mDozeServiceHost.pulseWhileDozing(new DozeHost.PulseCallback() {
+ @Override
+ public void onPulseStarted() {
+ }
+
+ @Override
+ public void onPulseFinished() {
+ }
+ }, DozeEvent.PULSE_REASON_NOTIFICATION);
+
+ ArgumentCaptor<DozeHost.PulseCallback> pulseCallbackArgumentCaptor =
+ ArgumentCaptor.forClass(DozeHost.PulseCallback.class);
+
+ verify(mDozeScrimController).pulse(
+ pulseCallbackArgumentCaptor.capture(), eq(DozeEvent.PULSE_REASON_NOTIFICATION));
+ verify(mStatusBar).updateScrimController();
+ reset(mStatusBar);
+
+ pulseCallbackArgumentCaptor.getValue().onPulseFinished();
+ assertFalse(mDozeScrimController.isPulsing());
+ verify(mStatusBar).updateScrimController();
+ }
+
+
+ @Test
+ public void testPulseWhileDozingWithDockingReason_suppressWakeUpGesture() {
+ // Keep track of callback to be able to stop the pulse
+ final DozeHost.PulseCallback[] pulseCallback = new DozeHost.PulseCallback[1];
+ doAnswer(invocation -> {
+ pulseCallback[0] = invocation.getArgument(0);
+ return null;
+ }).when(mDozeScrimController).pulse(any(), anyInt());
+
+ // Starting a pulse while docking should suppress wakeup gesture
+ mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class),
+ DozeEvent.PULSE_REASON_DOCKING);
+ verify(mStatusBarWindowViewController).suppressWakeUpGesture(eq(true));
+
+ // Ending a pulse should restore wakeup gesture
+ pulseCallback[0].onPulseFinished();
+ verify(mStatusBarWindowViewController).suppressWakeUpGesture(eq(false));
+ }
+
+ @Test
+ public void testPulseWhileDozing_notifyAuthInterrupt() {
+ HashSet<Integer> reasonsWantingAuth = new HashSet<>(
+ Collections.singletonList(DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN));
+ HashSet<Integer> reasonsSkippingAuth = new HashSet<>(
+ Arrays.asList(DozeEvent.PULSE_REASON_INTENT,
+ DozeEvent.PULSE_REASON_NOTIFICATION,
+ DozeEvent.PULSE_REASON_SENSOR_SIGMOTION,
+ DozeEvent.REASON_SENSOR_PICKUP,
+ DozeEvent.REASON_SENSOR_DOUBLE_TAP,
+ DozeEvent.PULSE_REASON_SENSOR_LONG_PRESS,
+ DozeEvent.PULSE_REASON_DOCKING,
+ DozeEvent.REASON_SENSOR_WAKE_UP,
+ DozeEvent.REASON_SENSOR_TAP));
+ HashSet<Integer> reasonsThatDontPulse = new HashSet<>(
+ Arrays.asList(DozeEvent.REASON_SENSOR_PICKUP,
+ DozeEvent.REASON_SENSOR_DOUBLE_TAP,
+ DozeEvent.REASON_SENSOR_TAP));
+
+ doAnswer(invocation -> {
+ DozeHost.PulseCallback callback = invocation.getArgument(0);
+ callback.onPulseStarted();
+ return null;
+ }).when(mDozeScrimController).pulse(any(), anyInt());
+
+ mDozeServiceHost.mWakeLockScreenPerformsAuth = true;
+ for (int i = 0; i < DozeEvent.TOTAL_REASONS; i++) {
+ reset(mKeyguardUpdateMonitor);
+ mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class), i);
+ if (reasonsWantingAuth.contains(i)) {
+ verify(mKeyguardUpdateMonitor).onAuthInterruptDetected(eq(true));
+ } else if (reasonsSkippingAuth.contains(i) || reasonsThatDontPulse.contains(i)) {
+ verify(mKeyguardUpdateMonitor, never()).onAuthInterruptDetected(eq(true));
+ } else {
+ throw new AssertionError("Reason " + i + " isn't specified as wanting or skipping"
+ + " passive auth. Please consider how this pulse reason should behave.");
+ }
+ }
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index cff6635..4853f20 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -57,6 +57,7 @@
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.logging.NotifLog;
+import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.notification.stack.NotificationRoundnessManager;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -236,8 +237,11 @@
mock(PluginManager.class),
mock(ShadeController.class),
mock(NotificationLockscreenUserManager.class),
- new NotificationEntryManager(new NotificationData(mock(
- NotificationSectionsFeatureManager.class), mock(NotifLog.class)),
+ new NotificationEntryManager(
+ new NotificationData(
+ mock(NotificationSectionsFeatureManager.class),
+ mock(NotifLog.class),
+ mock(PeopleNotificationIdentifier.class)),
mock(NotifLog.class)),
mock(KeyguardStateController.class),
statusBarStateController,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 1b132b9..85c247e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -64,6 +64,7 @@
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
@@ -249,7 +250,7 @@
finishAnimationsImmediately();
assertScrimAlpha(OPAQUE /* front */,
- SEMI_TRANSPARENT /* back */,
+ OPAQUE /* back */,
TRANSPARENT /* bubble */);
assertScrimTint(true /* front */,
@@ -858,6 +859,22 @@
mScrimForBubble.getDefaultFocusHighlightEnabled());
}
+ @Test
+ public void testIsLowPowerMode() {
+ HashSet<ScrimState> lowPowerModeStates = new HashSet<>(Arrays.asList(
+ ScrimState.OFF, ScrimState.AOD, ScrimState.PULSING));
+ HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
+ ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
+ ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR, ScrimState.UNLOCKED,
+ ScrimState.BUBBLE_EXPANDED));
+
+ for (ScrimState state : ScrimState.values()) {
+ if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {
+ Assert.fail("Scrim state not whitelisted nor blacklisted as low power mode");
+ }
+ }
+ }
+
private void assertScrimTint(boolean front, boolean behind, boolean bubble) {
Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
+ " with scrim: " + getScrimName(mScrimInFront) + " and tint: "
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index 03d0cea..66c01ca 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -61,7 +61,9 @@
import android.testing.TestableLooper.RunWithLooper;
import android.util.DisplayMetrics;
import android.util.SparseArray;
+import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
+import android.widget.LinearLayout;
import androidx.test.filters.SmallTest;
@@ -70,6 +72,7 @@
import com.android.internal.logging.testing.FakeMetricsLogger;
import com.android.internal.statusbar.IStatusBarService;
import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.Dependency;
import com.android.systemui.ForegroundServiceController;
import com.android.systemui.InitController;
@@ -82,8 +85,6 @@
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.colorextraction.SysuiColorExtractor;
-import com.android.systemui.doze.DozeEvent;
-import com.android.systemui.doze.DozeHost;
import com.android.systemui.doze.DozeLog;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
@@ -142,9 +143,6 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
import dagger.Lazy;
@@ -173,6 +171,7 @@
@Mock private ScrimController mScrimController;
@Mock private DozeScrimController mDozeScrimController;
@Mock private ArrayList<NotificationEntry> mNotificationList;
+ @Mock private Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
@Mock private BiometricUnlockController mBiometricUnlockController;
@Mock private NotificationData mNotificationData;
@Mock private NotificationInterruptionStateProvider.HeadsUpSuppressor mHeadsUpSuppressor;
@@ -227,11 +226,15 @@
@Mock private DozeParameters mDozeParameters;
@Mock private Lazy<LockscreenWallpaper> mLockscreenWallpaperLazy;
@Mock private LockscreenWallpaper mLockscreenWallpaper;
+ @Mock private DozeServiceHost mDozeServiceHost;
+ @Mock private LinearLayout mLockIconContainer;
+ @Mock private ViewMediatorCallback mKeyguardVieMediatorCallback;
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
mDependency.injectTestDependency(NotificationFilter.class, mNotificationFilter);
+ mDependency.injectMockDependency(KeyguardDismissUtil.class);
IPowerManager powerManagerService = mock(IPowerManager.class);
mPowerManager = new PowerManager(mContext, powerManagerService,
@@ -293,6 +296,7 @@
.thenReturn(mStatusBarWindowViewController);
when(mLockscreenWallpaperLazy.get()).thenReturn(mLockscreenWallpaper);
+ when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController);
mStatusBar = new StatusBar(
mContext,
@@ -356,23 +360,37 @@
mNotifLog,
mDozeParameters,
mScrimController,
- mLockscreenWallpaperLazy);
+ mLockscreenWallpaperLazy,
+ mBiometricUnlockControllerLazy,
+ mDozeServiceHost,
+ mPowerManager,
+ mDozeScrimController);
+
+ when(mStatusBarWindowView.findViewById(R.id.lock_icon_container)).thenReturn(
+ mLockIconContainer);
+
+ when(mKeyguardViewMediator.registerStatusBar(any(StatusBar.class), any(ViewGroup.class),
+ any(NotificationPanelView.class), any(BiometricUnlockController.class),
+ any(ViewGroup.class), any(ViewGroup.class), any(KeyguardBypassController.class)))
+ .thenReturn(mStatusBarKeyguardViewManager);
+
+ when(mKeyguardViewMediator.getViewMediatorCallback()).thenReturn(
+ mKeyguardVieMediatorCallback);
+
// TODO: we should be able to call mStatusBar.start() and have all the below values
// initialized automatically.
mStatusBar.mComponents = mContext.getComponents();
- mStatusBar.mStatusBarKeyguardViewManager = mStatusBarKeyguardViewManager;
mStatusBar.mStatusBarWindow = mStatusBarWindowView;
- mStatusBar.mBiometricUnlockController = mBiometricUnlockController;
mStatusBar.mNotificationPanel = mNotificationPanelView;
mStatusBar.mCommandQueue = mCommandQueue;
mStatusBar.mDozeScrimController = mDozeScrimController;
mStatusBar.mNotificationIconAreaController = mNotificationIconAreaController;
mStatusBar.mPresenter = mNotificationPresenter;
mStatusBar.mKeyguardIndicationController = mKeyguardIndicationController;
- mStatusBar.mPowerManager = mPowerManager;
mStatusBar.mBarService = mBarService;
mStatusBar.mStackScroller = mStackScroller;
mStatusBar.mStatusBarWindowViewController = mStatusBarWindowViewController;
+ mStatusBar.startKeyguard();
mStatusBar.putComponent(StatusBar.class, mStatusBar);
Dependency.get(InitController.class).executePostInitTasks();
entryManager.setUpForTest(mock(NotificationPresenter.class), mStackScroller,
@@ -737,83 +755,18 @@
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
mStatusBar.showKeyguardImpl();
- // Keep track of callback to be able to stop the pulse
- DozeHost.PulseCallback[] pulseCallback = new DozeHost.PulseCallback[1];
- doAnswer(invocation -> {
- pulseCallback[0] = invocation.getArgument(0);
- return null;
- }).when(mDozeScrimController).pulse(any(), anyInt());
-
// Starting a pulse should change the scrim controller to the pulsing state
- mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class),
- DozeEvent.PULSE_REASON_NOTIFICATION);
+ when(mDozeServiceHost.isPulsing()).thenReturn(true);
+ mStatusBar.updateScrimController();
verify(mScrimController).transitionTo(eq(ScrimState.PULSING), any());
// Ending a pulse should take it back to keyguard state
- pulseCallback[0].onPulseFinished();
+ when(mDozeServiceHost.isPulsing()).thenReturn(false);
+ mStatusBar.updateScrimController();
verify(mScrimController).transitionTo(eq(ScrimState.KEYGUARD));
}
@Test
- public void testPulseWhileDozing_notifyAuthInterrupt() {
- HashSet<Integer> reasonsWantingAuth = new HashSet<>(
- Collections.singletonList(DozeEvent.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN));
- HashSet<Integer> reasonsSkippingAuth = new HashSet<>(
- Arrays.asList(DozeEvent.PULSE_REASON_INTENT,
- DozeEvent.PULSE_REASON_NOTIFICATION,
- DozeEvent.PULSE_REASON_SENSOR_SIGMOTION,
- DozeEvent.REASON_SENSOR_PICKUP,
- DozeEvent.REASON_SENSOR_DOUBLE_TAP,
- DozeEvent.PULSE_REASON_SENSOR_LONG_PRESS,
- DozeEvent.PULSE_REASON_DOCKING,
- DozeEvent.REASON_SENSOR_WAKE_UP,
- DozeEvent.REASON_SENSOR_TAP));
- HashSet<Integer> reasonsThatDontPulse = new HashSet<>(
- Arrays.asList(DozeEvent.REASON_SENSOR_PICKUP,
- DozeEvent.REASON_SENSOR_DOUBLE_TAP,
- DozeEvent.REASON_SENSOR_TAP));
-
- doAnswer(invocation -> {
- DozeHost.PulseCallback callback = invocation.getArgument(0);
- callback.onPulseStarted();
- return null;
- }).when(mDozeScrimController).pulse(any(), anyInt());
-
- mStatusBar.mDozeServiceHost.mWakeLockScreenPerformsAuth = true;
- for (int i = 0; i < DozeEvent.TOTAL_REASONS; i++) {
- reset(mKeyguardUpdateMonitor);
- mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class), i);
- if (reasonsWantingAuth.contains(i)) {
- verify(mKeyguardUpdateMonitor).onAuthInterruptDetected(eq(true));
- } else if (reasonsSkippingAuth.contains(i) || reasonsThatDontPulse.contains(i)) {
- verify(mKeyguardUpdateMonitor, never()).onAuthInterruptDetected(eq(true));
- } else {
- throw new AssertionError("Reason " + i + " isn't specified as wanting or skipping"
- + " passive auth. Please consider how this pulse reason should behave.");
- }
- }
- }
-
- @Test
- public void testPulseWhileDozingWithDockingReason_suppressWakeUpGesture() {
- // Keep track of callback to be able to stop the pulse
- final DozeHost.PulseCallback[] pulseCallback = new DozeHost.PulseCallback[1];
- doAnswer(invocation -> {
- pulseCallback[0] = invocation.getArgument(0);
- return null;
- }).when(mDozeScrimController).pulse(any(), anyInt());
-
- // Starting a pulse while docking should suppress wakeup gesture
- mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class),
- DozeEvent.PULSE_REASON_DOCKING);
- verify(mStatusBarWindowViewController).suppressWakeUpGesture(eq(true));
-
- // Ending a pulse should restore wakeup gesture
- pulseCallback[0].onPulseFinished();
- verify(mStatusBarWindowViewController).suppressWakeUpGesture(eq(false));
- }
-
- @Test
public void testSetState_changesIsFullScreenUserSwitcherState() {
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
assertFalse(mStatusBar.isFullScreenUserSwitcherState());
@@ -839,27 +792,17 @@
}
@Test
- public void testStartStopDozing() {
- mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
- when(mStatusBarStateController.isKeyguardRequested()).thenReturn(true);
-
- mStatusBar.mDozeServiceHost.startDozing();
- verify(mStatusBarStateController).setIsDozing(eq(true));
-
- mStatusBar.mDozeServiceHost.stopDozing();
- verify(mStatusBarStateController).setIsDozing(eq(false));
- }
-
- @Test
public void testOnStartedWakingUp_isNotDozing() {
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
when(mStatusBarStateController.isKeyguardRequested()).thenReturn(true);
- mStatusBar.mDozeServiceHost.startDozing();
- verify(mStatusBarStateController).setIsDozing(eq(true));
+ when(mDozeServiceHost.getDozingRequested()).thenReturn(true);
+ mStatusBar.updateIsKeyguard();
+ // TODO: mNotificationPanelView.expand(false) gets called twice. Should be once.
+ verify(mNotificationPanelView, times(2)).expand(eq(false));
clearInvocations(mNotificationPanelView);
mStatusBar.mWakefulnessObserver.onStartedWakingUp();
- verify(mStatusBarStateController).setIsDozing(eq(false));
+ verify(mDozeServiceHost).stopDozing();
verify(mNotificationPanelView).expand(eq(false));
}
@@ -867,7 +810,8 @@
public void testOnStartedWakingUp_doesNotDismissBouncer_whenPulsing() {
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
when(mStatusBarStateController.isKeyguardRequested()).thenReturn(true);
- mStatusBar.mDozeServiceHost.startDozing();
+ when(mDozeServiceHost.getDozingRequested()).thenReturn(true);
+ mStatusBar.updateIsKeyguard();
clearInvocations(mNotificationPanelView);
mStatusBar.setBouncerShowing(true);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
index 556ed5c..4ccf8a4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
@@ -42,6 +42,8 @@
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
+import java.util.ArrayList;
+
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@@ -67,7 +69,8 @@
mContext.addMockSystemService(WifiManager.class, mWifiManager);
doAnswer((InvocationOnMock invocation) -> {
- ((WifiManager.SoftApCallback) invocation.getArgument(0)).onNumClientsChanged(1);
+ ((WifiManager.SoftApCallback) invocation.getArgument(0))
+ .onConnectedClientsChanged(new ArrayList<>());
return null;
}).when(mWifiManager).registerSoftApCallback(any(WifiManager.SoftApCallback.class),
any(Handler.class));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java
index 854cc2f..97542a9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java
@@ -93,9 +93,9 @@
when(mKeyChainService.queryLocalInterface("android.security.IKeyChainService"))
.thenReturn(mKeyChainService);
- // Wait for callbacks from 1) the CACertLoader and 2) the onUserSwitched() function in the
+ // Wait for callbacks from the onUserSwitched() function in the
// constructor of mSecurityController
- mStateChangedLatch = new CountDownLatch(2);
+ mStateChangedLatch = new CountDownLatch(1);
// TODO: Migrate this test to TestableLooper and use a handler attached
// to that.
mSecurityController = new SecurityControllerImpl(mContext,
@@ -169,7 +169,6 @@
assertTrue(mSecurityController.hasCACertInCurrentUser());
// Exception
-
mStateChangedLatch = new CountDownLatch(1);
when(mKeyChainService.getUserCaAliases())
@@ -181,9 +180,12 @@
assertFalse(mStateChangedLatch.await(1, TimeUnit.SECONDS));
assertTrue(mSecurityController.hasCACertInCurrentUser());
- // The retry takes 30s
- //assertTrue(mStateChangedLatch.await(31, TimeUnit.SECONDS));
- //assertFalse(mSecurityController.hasCACertInCurrentUser());
+
+ mSecurityController.new CACertLoader()
+ .execute(0);
+
+ assertTrue(mStateChangedLatch.await(1, TimeUnit.SECONDS));
+ assertFalse(mSecurityController.hasCACertInCurrentUser());
}
@Test
diff --git a/packages/Tethering/Android.bp b/packages/Tethering/Android.bp
new file mode 100644
index 0000000..ca69c18
--- /dev/null
+++ b/packages/Tethering/Android.bp
@@ -0,0 +1,79 @@
+//
+// 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.
+//
+
+java_defaults {
+ name: "TetheringAndroidLibraryDefaults",
+ platform_apis: true,
+ srcs: [
+ "src/**/*.java",
+ ":framework-tethering-shared-srcs",
+ ":services-tethering-shared-srcs",
+ ],
+ static_libs: [
+ "androidx.annotation_annotation",
+ "netd_aidl_interface-java",
+ "networkstack-aidl-interfaces-java",
+ "tethering-client",
+ ],
+ manifest: "AndroidManifestBase.xml",
+}
+
+// Build tethering static library, used to compile both variants of the tethering.
+android_library {
+ name: "TetheringApiCurrentLib",
+ defaults: ["TetheringAndroidLibraryDefaults"],
+}
+
+// Common defaults for compiling the actual APK.
+java_defaults {
+ name: "TetheringAppDefaults",
+ platform_apis: true,
+ privileged: true,
+ resource_dirs: [
+ "res",
+ ],
+ optimize: {
+ proguard_flags_files: ["proguard.flags"],
+ },
+}
+
+// Non-updatable tethering running in the system server process for devices not using the module
+// TODO: build in-process tethering APK here.
+
+// Updatable tethering packaged as an application
+android_app {
+ name: "Tethering",
+ defaults: ["TetheringAppDefaults"],
+ static_libs: ["TetheringApiCurrentLib"],
+ certificate: "networkstack",
+ manifest: "AndroidManifest.xml",
+ use_embedded_native_libs: true,
+ // The permission configuration *must* be included to ensure security of the device
+ required: ["NetworkPermissionConfig"],
+}
+
+// This group will be removed when tethering migration is done.
+filegroup {
+ name: "tethering-services-srcs",
+ srcs: [
+ "src/com/android/server/connectivity/tethering/TetheringConfiguration.java",
+ "src/android/net/dhcp/DhcpServerCallbacks.java",
+ "src/android/net/dhcp/DhcpServingParamsParcelExt.java",
+ "src/android/net/ip/IpServer.java",
+ "src/android/net/ip/RouterAdvertisementDaemon.java",
+ "src/android/net/util/InterfaceSet.java",
+ ],
+}
diff --git a/packages/Tethering/AndroidManifest.xml b/packages/Tethering/AndroidManifest.xml
new file mode 100644
index 0000000..eb51593
--- /dev/null
+++ b/packages/Tethering/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tethering"
+ android:sharedUserId="android.uid.networkstack">
+ <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
+
+ <application
+ android:process="com.android.networkstack.process"
+ android:extractNativeLibs="false"
+ android:persistent="true">
+ </application>
+</manifest>
diff --git a/packages/Tethering/AndroidManifestBase.xml b/packages/Tethering/AndroidManifestBase.xml
new file mode 100644
index 0000000..b9cac19
--- /dev/null
+++ b/packages/Tethering/AndroidManifestBase.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tethering"
+ android:versionCode="1"
+ android:versionName="R-initial">
+ <application
+ android:label="Tethering"
+ android:defaultToDeviceProtectedStorage="true"
+ android:directBootAware="true"
+ android:usesCleartextTraffic="true">
+ </application>
+</manifest>
diff --git a/packages/Tethering/common/TetheringLib/Android.bp b/packages/Tethering/common/TetheringLib/Android.bp
new file mode 100644
index 0000000..5b01b1e
--- /dev/null
+++ b/packages/Tethering/common/TetheringLib/Android.bp
@@ -0,0 +1,40 @@
+//
+// 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.
+//
+
+// AIDL interfaces between the core system and the tethering mainline module.
+aidl_interface {
+ name: "tethering-aidl-interfaces",
+ local_include_dir: "src",
+ srcs: [
+ "src/android/net/ITetheringConnector.aidl",
+ ],
+ backend: {
+ ndk: {
+ enabled: false,
+ },
+ cpp: {
+ enabled: false,
+ },
+ },
+}
+
+java_library {
+ name: "tethering-client",
+ platform_apis: true,
+ static_libs: [
+ "tethering-aidl-interfaces-java",
+ ],
+}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
similarity index 62%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
index d2ec357..443481e 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
@@ -1,19 +1,20 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
+/**
+ * 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
+ * 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
+ * See the License for the specific language governing perNmissions and
* limitations under the License.
*/
+package android.net;
-package android.app.timedetector;
-
-parcelable TimeSignal;
\ No newline at end of file
+/** @hide */
+oneway interface ITetheringConnector {
+}
diff --git a/packages/Tethering/proguard.flags b/packages/Tethering/proguard.flags
new file mode 100644
index 0000000..77fc024
--- /dev/null
+++ b/packages/Tethering/proguard.flags
@@ -0,0 +1 @@
+#TBD
diff --git a/packages/Tethering/res/values/config.xml b/packages/Tethering/res/values/config.xml
new file mode 100644
index 0000000..37e679d
--- /dev/null
+++ b/packages/Tethering/res/values/config.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!--
+ OEMs that wish to change the below settings must do so via a runtime resource overlay package
+ and *NOT* by changing this file. This file is part of the tethering mainline module.
+ -->
+</resources>
diff --git a/services/net/java/android/net/dhcp/DhcpServerCallbacks.java b/packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java
similarity index 100%
rename from services/net/java/android/net/dhcp/DhcpServerCallbacks.java
rename to packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java
diff --git a/services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java b/packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java
similarity index 100%
rename from services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java
rename to packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java
diff --git a/services/net/java/android/net/ip/IpServer.java b/packages/Tethering/src/android/net/ip/IpServer.java
similarity index 94%
rename from services/net/java/android/net/ip/IpServer.java
rename to packages/Tethering/src/android/net/ip/IpServer.java
index 3d79bba..ff3d7bc 100644
--- a/services/net/java/android/net/ip/IpServer.java
+++ b/packages/Tethering/src/android/net/ip/IpServer.java
@@ -16,7 +16,7 @@
package android.net.ip;
-import static android.net.NetworkUtils.numericToInetAddress;
+import static android.net.InetAddresses.parseNumericAddress;
import static android.net.dhcp.IDhcpServer.STATUS_SUCCESS;
import static android.net.util.NetworkConstants.FF;
import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH;
@@ -77,6 +77,7 @@
public static final int STATE_TETHERED = 2;
public static final int STATE_LOCAL_ONLY = 3;
+ /** Get string name of |state|.*/
public static String getStateString(int state) {
switch (state) {
case STATE_UNAVAILABLE: return "UNAVAILABLE";
@@ -103,15 +104,16 @@
// TODO: have this configurable
private static final int DHCP_LEASE_TIME_SECS = 3600;
- private final static String TAG = "IpServer";
- private final static boolean DBG = false;
- private final static boolean VDBG = false;
- private static final Class[] messageClasses = {
+ private static final String TAG = "IpServer";
+ private static final boolean DBG = false;
+ private static final boolean VDBG = false;
+ private static final Class[] sMessageClasses = {
IpServer.class
};
private static final SparseArray<String> sMagicDecoderRing =
- MessageUtils.findMessageNames(messageClasses);
+ MessageUtils.findMessageNames(sMessageClasses);
+ /** IpServer callback. */
public static class Callback {
/**
* Notify that |who| has changed its tethering state.
@@ -131,11 +133,14 @@
public void updateLinkProperties(IpServer who, LinkProperties newLp) {}
}
+ /** Capture IpServer dependencies, for injection. */
public static class Dependencies {
+ /** Create a RouterAdvertisementDaemon instance to be used by IpServer.*/
public RouterAdvertisementDaemon getRouterAdvertisementDaemon(InterfaceParams ifParams) {
return new RouterAdvertisementDaemon(ifParams);
}
+ /** Get |ifName|'s interface information.*/
public InterfaceParams getInterfaceParams(String ifName) {
return InterfaceParams.getByName(ifName);
}
@@ -244,25 +249,51 @@
setInitialState(mInitialState);
}
- public String interfaceName() { return mIfaceName; }
-
- public int interfaceType() { return mInterfaceType; }
-
- public int lastError() { return mLastError; }
-
- public int servingMode() { return mServingMode; }
-
- public LinkProperties linkProperties() { return new LinkProperties(mLinkProperties); }
-
- public void stop() { sendMessage(CMD_INTERFACE_DOWN); }
-
- public void unwanted() { sendMessage(CMD_TETHER_UNREQUESTED); }
+ /** Interface name which IpServer served.*/
+ public String interfaceName() {
+ return mIfaceName;
+ }
/**
- * Internals.
+ * Tethering downstream type. It would be one of ConnectivityManager#TETHERING_*.
*/
+ public int interfaceType() {
+ return mInterfaceType;
+ }
- private boolean startIPv4() { return configureIPv4(true); }
+ /** Last error from this IpServer. */
+ public int lastError() {
+ return mLastError;
+ }
+
+ /** Serving mode is the current state of IpServer state machine. */
+ public int servingMode() {
+ return mServingMode;
+ }
+
+ /** The properties of the network link which IpServer is serving. */
+ public LinkProperties linkProperties() {
+ return new LinkProperties(mLinkProperties);
+ }
+
+ /** Stop this IpServer. After this is called this IpServer should not be used any more. */
+ public void stop() {
+ sendMessage(CMD_INTERFACE_DOWN);
+ }
+
+ /**
+ * Tethering is canceled. IpServer state machine will be available and wait for
+ * next tethering request.
+ */
+ public void unwanted() {
+ sendMessage(CMD_TETHER_UNREQUESTED);
+ }
+
+ /** Internals. */
+
+ private boolean startIPv4() {
+ return configureIPv4(true);
+ }
/**
* Convenience wrapper around INetworkStackStatusCallback to run callbacks on the IpServer
@@ -410,7 +441,7 @@
prefixLen = WIFI_P2P_IFACE_PREFIX_LENGTH;
} else {
// BT configures the interface elsewhere: only start DHCP.
- final Inet4Address srvAddr = (Inet4Address) numericToInetAddress(BLUETOOTH_IFACE_ADDR);
+ final Inet4Address srvAddr = (Inet4Address) parseNumericAddress(BLUETOOTH_IFACE_ADDR);
return configureDhcp(enabled, srvAddr, BLUETOOTH_DHCP_PREFIX_LENGTH);
}
@@ -422,7 +453,7 @@
return false;
}
- InetAddress addr = numericToInetAddress(ipAsString);
+ InetAddress addr = parseNumericAddress(ipAsString);
linkAddr = new LinkAddress(addr, prefixLen);
ifcg.setLinkAddress(linkAddr);
if (mInterfaceType == ConnectivityManager.TETHERING_WIFI) {
@@ -473,7 +504,7 @@
private String getRandomWifiIPv4Address() {
try {
- byte[] bytes = numericToInetAddress(WIFI_HOST_IFACE_ADDR).getAddress();
+ byte[] bytes = parseNumericAddress(WIFI_HOST_IFACE_ADDR).getAddress();
bytes[3] = getRandomSanitizedByte(DOUG_ADAMS, asByte(0), asByte(1), FF);
return InetAddress.getByAddress(bytes).getHostAddress();
} catch (Exception e) {
diff --git a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java b/packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
similarity index 88%
rename from services/net/java/android/net/ip/RouterAdvertisementDaemon.java
rename to packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
index 59aea21..4147413 100644
--- a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java
+++ b/packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
@@ -119,6 +119,7 @@
private volatile MulticastTransmitter mMulticastTransmitter;
private volatile UnicastResponder mUnicastResponder;
+ /** Encapsulate the RA parameters for RouterAdvertisementDaemon.*/
public static class RaParams {
// Tethered traffic will have the hop limit properly decremented.
// Consequently, set the hoplimit greater by one than the upstream
@@ -150,10 +151,12 @@
dnses = (HashSet) other.dnses.clone();
}
- // Returns the subset of RA parameters that become deprecated when
- // moving from announcing oldRa to announcing newRa.
- //
- // Currently only tracks differences in |prefixes| and |dnses|.
+ /**
+ * Returns the subset of RA parameters that become deprecated when
+ * moving from announcing oldRa to announcing newRa.
+ *
+ * Currently only tracks differences in |prefixes| and |dnses|.
+ */
public static RaParams getDeprecatedRaParams(RaParams oldRa, RaParams newRa) {
RaParams newlyDeprecated = new RaParams();
@@ -179,7 +182,9 @@
private final HashMap<IpPrefix, Integer> mPrefixes = new HashMap<>();
private final HashMap<Inet6Address, Integer> mDnses = new HashMap<>();
- Set<IpPrefix> getPrefixes() { return mPrefixes.keySet(); }
+ Set<IpPrefix> getPrefixes() {
+ return mPrefixes.keySet();
+ }
void putPrefixes(Set<IpPrefix> prefixes) {
for (IpPrefix ipp : prefixes) {
@@ -193,7 +198,9 @@
}
}
- Set<Inet6Address> getDnses() { return mDnses.keySet(); }
+ Set<Inet6Address> getDnses() {
+ return mDnses.keySet();
+ }
void putDnses(Set<Inet6Address> dnses) {
for (Inet6Address dns : dnses) {
@@ -207,7 +214,9 @@
}
}
- boolean isEmpty() { return mPrefixes.isEmpty() && mDnses.isEmpty(); }
+ boolean isEmpty() {
+ return mPrefixes.isEmpty() && mDnses.isEmpty();
+ }
private boolean decrementCounters() {
boolean removed = decrementCounter(mPrefixes);
@@ -219,7 +228,7 @@
boolean removed = false;
for (Iterator<Map.Entry<T, Integer>> it = map.entrySet().iterator();
- it.hasNext();) {
+ it.hasNext();) {
Map.Entry<T, Integer> kv = it.next();
if (kv.getValue() == 0) {
it.remove();
@@ -240,6 +249,7 @@
mDeprecatedInfoTracker = new DeprecatedInfoTracker();
}
+ /** Build new RA.*/
public void buildNewRa(RaParams deprecatedParams, RaParams newParams) {
synchronized (mLock) {
if (deprecatedParams != null) {
@@ -260,6 +270,7 @@
maybeNotifyMulticastTransmitter();
}
+ /** Start router advertisement daemon. */
public boolean start() {
if (!createSocket()) {
return false;
@@ -274,6 +285,7 @@
return true;
}
+ /** Stop router advertisement daemon. */
public void stop() {
closeSocket();
// Wake up mMulticastTransmitter thread to interrupt a potential 1 day sleep before
@@ -362,8 +374,12 @@
}
}
- private static byte asByte(int value) { return (byte) value; }
- private static short asShort(int value) { return (short) value; }
+ private static byte asByte(int value) {
+ return (byte) value;
+ }
+ private static short asShort(int value) {
+ return (short) value;
+ }
private static void putHeader(ByteBuffer ra, boolean hasDefaultRoute, byte hopLimit) {
/**
@@ -384,14 +400,14 @@
+-+-+-+-+-+-+-+-+-+-+-+-
*/
ra.put(ICMPV6_ND_ROUTER_ADVERT)
- .put(asByte(0))
- .putShort(asShort(0))
- .put(hopLimit)
- // RFC 4191 "high" preference, iff. advertising a default route.
- .put(hasDefaultRoute ? asByte(0x08) : asByte(0))
- .putShort(hasDefaultRoute ? asShort(DEFAULT_LIFETIME) : asShort(0))
- .putInt(0)
- .putInt(0);
+ .put(asByte(0))
+ .putShort(asShort(0))
+ .put(hopLimit)
+ // RFC 4191 "high" preference, iff. advertising a default route.
+ .put(hasDefaultRoute ? asByte(0x08) : asByte(0))
+ .putShort(hasDefaultRoute ? asShort(DEFAULT_LIFETIME) : asShort(0))
+ .putInt(0)
+ .putInt(0);
}
private static void putSlla(ByteBuffer ra, byte[] slla) {
@@ -408,11 +424,12 @@
// Only IEEE 802.3 6-byte addresses are supported.
return;
}
- final byte ND_OPTION_SLLA = 1;
- final byte SLLA_NUM_8OCTETS = 1;
- ra.put(ND_OPTION_SLLA)
- .put(SLLA_NUM_8OCTETS)
- .put(slla);
+
+ final byte nd_option_slla = 1;
+ final byte slla_num_8octets = 1;
+ ra.put(nd_option_slla)
+ .put(slla_num_8octets)
+ .put(slla);
}
private static void putExpandedFlagsOption(ByteBuffer ra) {
@@ -428,13 +445,13 @@
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- final byte ND_OPTION_EFO = 26;
- final byte EFO_NUM_8OCTETS = 1;
+ final byte nd_option__efo = 26;
+ final byte efo_num_8octets = 1;
- ra.put(ND_OPTION_EFO)
- .put(EFO_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt(0);
+ ra.put(nd_option__efo)
+ .put(efo_num_8octets)
+ .putShort(asShort(0))
+ .putInt(0);
}
private static void putMtu(ByteBuffer ra, int mtu) {
@@ -449,12 +466,12 @@
| MTU |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- final byte ND_OPTION_MTU = 5;
- final byte MTU_NUM_8OCTETS = 1;
- ra.put(ND_OPTION_MTU)
- .put(MTU_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt((mtu < IPV6_MIN_MTU) ? IPV6_MIN_MTU : mtu);
+ final byte nd_option_mtu = 5;
+ final byte mtu_num_8octs = 1;
+ ra.put(nd_option_mtu)
+ .put(mtu_num_8octs)
+ .putShort(asShort(0))
+ .putInt((mtu < IPV6_MIN_MTU) ? IPV6_MIN_MTU : mtu);
}
private static void putPio(ByteBuffer ra, IpPrefix ipp,
@@ -486,22 +503,22 @@
if (prefixLength != 64) {
return;
}
- final byte ND_OPTION_PIO = 3;
- final byte PIO_NUM_8OCTETS = 4;
+ final byte nd_option_pio = 3;
+ final byte pio_num_8octets = 4;
if (validTime < 0) validTime = 0;
if (preferredTime < 0) preferredTime = 0;
if (preferredTime > validTime) preferredTime = validTime;
final byte[] addr = ipp.getAddress().getAddress();
- ra.put(ND_OPTION_PIO)
- .put(PIO_NUM_8OCTETS)
- .put(asByte(prefixLength))
- .put(asByte(0xc0)) /* L & A set */
- .putInt(validTime)
- .putInt(preferredTime)
- .putInt(0)
- .put(addr);
+ ra.put(nd_option_pio)
+ .put(pio_num_8octets)
+ .put(asByte(prefixLength))
+ .put(asByte(0xc0)) /* L & A set */
+ .putInt(validTime)
+ .putInt(preferredTime)
+ .putInt(0)
+ .put(addr);
}
private static void putRio(ByteBuffer ra, IpPrefix ipp) {
@@ -524,16 +541,16 @@
if (prefixLength > 64) {
return;
}
- final byte ND_OPTION_RIO = 24;
- final byte RIO_NUM_8OCTETS = asByte(
+ final byte nd_option_rio = 24;
+ final byte rio_num_8octets = asByte(
(prefixLength == 0) ? 1 : (prefixLength <= 8) ? 2 : 3);
final byte[] addr = ipp.getAddress().getAddress();
- ra.put(ND_OPTION_RIO)
- .put(RIO_NUM_8OCTETS)
- .put(asByte(prefixLength))
- .put(asByte(0x18))
- .putInt(DEFAULT_LIFETIME);
+ ra.put(nd_option_rio)
+ .put(rio_num_8octets)
+ .put(asByte(prefixLength))
+ .put(asByte(0x18))
+ .putInt(DEFAULT_LIFETIME);
// Rely upon an IpPrefix's address being properly zeroed.
if (prefixLength > 0) {
@@ -566,12 +583,12 @@
}
if (filteredDnses.isEmpty()) return;
- final byte ND_OPTION_RDNSS = 25;
- final byte RDNSS_NUM_8OCTETS = asByte(dnses.size() * 2 + 1);
- ra.put(ND_OPTION_RDNSS)
- .put(RDNSS_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt(lifetime);
+ final byte nd_option_rdnss = 25;
+ final byte rdnss_num_8octets = asByte(dnses.size() * 2 + 1);
+ ra.put(nd_option_rdnss)
+ .put(rdnss_num_8octets)
+ .putShort(asShort(0))
+ .putInt(lifetime);
for (Inet6Address dns : filteredDnses) {
// NOTE: If the full of list DNS servers doesn't fit in the packet,
@@ -585,7 +602,7 @@
}
private boolean createSocket() {
- final int SEND_TIMEOUT_MS = 300;
+ final int send_timout_ms = 300;
final int oldTag = TrafficStats.getAndSetThreadStatsTag(
TrafficStatsConstants.TAG_SYSTEM_NEIGHBOR);
@@ -593,7 +610,7 @@
mSocket = Os.socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
// Setting SNDTIMEO is purely for defensive purposes.
Os.setsockoptTimeval(
- mSocket, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(SEND_TIMEOUT_MS));
+ mSocket, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(send_timout_ms));
Os.setsockoptIfreq(mSocket, SOL_SOCKET, SO_BINDTODEVICE, mInterface.name);
NetworkUtils.protectFromVpn(mSocket);
NetworkUtils.setupRaSocket(mSocket, mInterface.index);
@@ -611,7 +628,7 @@
if (mSocket != null) {
try {
IoBridge.closeAndSignalBlockedThreads(mSocket);
- } catch (IOException ignored) {}
+ } catch (IOException ignored) { }
}
mSocket = null;
}
@@ -627,9 +644,9 @@
}
final InetAddress destip = dest.getAddress();
- return (destip instanceof Inet6Address) &&
- destip.isLinkLocalAddress() &&
- (((Inet6Address) destip).getScopeId() == mInterface.index);
+ return (destip instanceof Inet6Address)
+ && destip.isLinkLocalAddress()
+ && (((Inet6Address) destip).getScopeId() == mInterface.index);
}
private void maybeSendRA(InetSocketAddress dest) {
@@ -654,11 +671,11 @@
}
private final class UnicastResponder extends Thread {
- private final InetSocketAddress solicitor = new InetSocketAddress();
+ private final InetSocketAddress mSolicitor = new InetSocketAddress();
// The recycled buffer for receiving Router Solicitations from clients.
// If the RS is larger than IPV6_MIN_MTU the packets are truncated.
// This is fine since currently only byte 0 is examined anyway.
- private final byte mSolication[] = new byte[IPV6_MIN_MTU];
+ private final byte[] mSolicitation = new byte[IPV6_MIN_MTU];
@Override
public void run() {
@@ -666,9 +683,9 @@
try {
// Blocking receive.
final int rval = Os.recvfrom(
- mSocket, mSolication, 0, mSolication.length, 0, solicitor);
+ mSocket, mSolicitation, 0, mSolicitation.length, 0, mSolicitor);
// Do the least possible amount of validation.
- if (rval < 1 || mSolication[0] != ICMPV6_ND_ROUTER_SOLICIT) {
+ if (rval < 1 || mSolicitation[0] != ICMPV6_ND_ROUTER_SOLICIT) {
continue;
}
} catch (ErrnoException | SocketException e) {
@@ -678,7 +695,7 @@
continue;
}
- maybeSendRA(solicitor);
+ maybeSendRA(mSolicitor);
}
}
}
diff --git a/services/net/java/android/net/util/InterfaceSet.java b/packages/Tethering/src/android/net/util/InterfaceSet.java
similarity index 95%
rename from services/net/java/android/net/util/InterfaceSet.java
rename to packages/Tethering/src/android/net/util/InterfaceSet.java
index 9f26fa1..7589787 100644
--- a/services/net/java/android/net/util/InterfaceSet.java
+++ b/packages/Tethering/src/android/net/util/InterfaceSet.java
@@ -47,6 +47,6 @@
public boolean equals(Object obj) {
return obj != null
&& obj instanceof InterfaceSet
- && ifnames.equals(((InterfaceSet)obj).ifnames);
+ && ifnames.equals(((InterfaceSet) obj).ifnames);
}
}
diff --git a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java b/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
similarity index 96%
rename from services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
rename to packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
index a1b94ca..7709727 100644
--- a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
@@ -82,7 +82,7 @@
"192.168.48.2", "192.168.48.254", "192.168.49.2", "192.168.49.254",
};
- private final String[] DEFAULT_IPV4_DNS = {"8.8.4.4", "8.8.8.8"};
+ private static final String[] DEFAULT_IPV4_DNS = {"8.8.4.4", "8.8.8.8"};
public final String[] tetherableUsbRegexs;
public final String[] tetherableWifiRegexs;
@@ -133,10 +133,12 @@
configLog.log(toString());
}
+ /** Check whether input interface belong to usb.*/
public boolean isUsb(String iface) {
return matchesDownstreamRegexs(iface, tetherableUsbRegexs);
}
+ /** Check whether input interface belong to wifi.*/
public boolean isWifi(String iface) {
return matchesDownstreamRegexs(iface, tetherableWifiRegexs);
}
@@ -146,18 +148,22 @@
return matchesDownstreamRegexs(iface, tetherableWifiP2pRegexs);
}
+ /** Check whether using legacy mode for wifi P2P. */
public boolean isWifiP2pLegacyTetheringMode() {
return (tetherableWifiP2pRegexs == null || tetherableWifiP2pRegexs.length == 0);
}
+ /** Check whether input interface belong to bluetooth.*/
public boolean isBluetooth(String iface) {
return matchesDownstreamRegexs(iface, tetherableBluetoothRegexs);
}
+ /** Check whether no ui entitlement application is available.*/
public boolean hasMobileHotspotProvisionApp() {
return !TextUtils.isEmpty(provisioningAppNoUi);
}
+ /** Does the dumping.*/
public void dump(PrintWriter pw) {
pw.print("subId: ");
pw.println(subId);
@@ -186,6 +192,7 @@
pw.println(enableLegacyDhcpServer);
}
+ /** Returns the string representation of this object.*/
public String toString() {
final StringJoiner sj = new StringJoiner(" ");
sj.add(String.format("subId:%d", subId));
@@ -210,7 +217,7 @@
if (values != null) {
final StringJoiner sj = new StringJoiner(", ", "[", "]");
- for (String value : values) { sj.add(value); }
+ for (String value : values) sj.add(value);
pw.print(sj.toString());
} else {
pw.print("null");
diff --git a/packages/Tethering/tests/unit/Android.bp b/packages/Tethering/tests/unit/Android.bp
new file mode 100644
index 0000000..da62107
--- /dev/null
+++ b/packages/Tethering/tests/unit/Android.bp
@@ -0,0 +1,50 @@
+//
+// 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.
+//
+
+android_test {
+ name: "TetheringTests",
+ certificate: "platform",
+ srcs: ["src/**/*.java"],
+ test_suites: ["device-tests"],
+ static_libs: [
+ "androidx.test.rules",
+ "frameworks-base-testutils",
+ "mockito-target-extended-minus-junit4",
+ "TetheringApiCurrentLib",
+ "testables",
+ ],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ "android.test.mock",
+ ],
+ jni_libs: [
+ // For mockito extended
+ "libdexmakerjvmtiagent",
+ "libstaticjvmtiagent",
+ ],
+}
+
+// This group would be removed when tethering migration is done.
+filegroup {
+ name: "tethering-tests-src",
+ srcs: [
+ "src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java",
+ "src/android/net/dhcp/DhcpServingParamsParcelExtTest.java",
+ "src/android/net/ip/IpServerTest.java",
+ "src/android/net/util/InterfaceSetTest.java",
+ ],
+}
diff --git a/packages/Tethering/tests/unit/AndroidManifest.xml b/packages/Tethering/tests/unit/AndroidManifest.xml
new file mode 100644
index 0000000..049ff6d
--- /dev/null
+++ b/packages/Tethering/tests/unit/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tethering.tests.unit">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ </application>
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.tethering.tests.unit"
+ android:label="Tethering service tests">
+ </instrumentation>
+</manifest>
diff --git a/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java b/packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java
similarity index 100%
rename from tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java
rename to packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java
diff --git a/tests/net/java/android/net/ip/IpServerTest.java b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
similarity index 99%
rename from tests/net/java/android/net/ip/IpServerTest.java
rename to packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
index b6ccebb..4358cd6 100644
--- a/tests/net/java/android/net/ip/IpServerTest.java
+++ b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
@@ -183,7 +183,7 @@
@Test
public void shouldDoNothingUntilRequested() throws Exception {
initStateMachine(TETHERING_BLUETOOTH);
- final int [] NOOP_COMMANDS = {
+ final int [] noOp_commands = {
IpServer.CMD_TETHER_UNREQUESTED,
IpServer.CMD_IP_FORWARDING_ENABLE_ERROR,
IpServer.CMD_IP_FORWARDING_DISABLE_ERROR,
@@ -192,7 +192,7 @@
IpServer.CMD_SET_DNS_FORWARDERS_ERROR,
IpServer.CMD_TETHER_CONNECTION_CHANGED
};
- for (int command : NOOP_COMMANDS) {
+ for (int command : noOp_commands) {
// None of these commands should trigger us to request action from
// the rest of the system.
dispatchCommand(command);
diff --git a/tests/net/java/android/net/util/InterfaceSetTest.java b/packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java
similarity index 100%
rename from tests/net/java/android/net/util/InterfaceSetTest.java
rename to packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java
diff --git a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
similarity index 91%
rename from tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
rename to packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
index e282963..9f9221f 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
@@ -24,7 +24,12 @@
import static android.provider.Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+import static com.android.internal.R.array.config_mobile_hotspot_provision_app;
+import static com.android.internal.R.array.config_tether_bluetooth_regexs;
+import static com.android.internal.R.array.config_tether_dhcp_range;
import static com.android.internal.R.array.config_tether_upstream_types;
+import static com.android.internal.R.array.config_tether_usb_regexs;
+import static com.android.internal.R.array.config_tether_wifi_regexs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -86,7 +91,9 @@
}
@Override
- public Resources getResources() { return mResources; }
+ public Resources getResources() {
+ return mResources;
+ }
@Override
public Object getSystemService(String name) {
@@ -105,17 +112,13 @@
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_dhcp_range))
- .thenReturn(new String[0]);
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_usb_regexs))
- .thenReturn(new String[0]);
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_wifi_regexs))
+ when(mResources.getStringArray(config_tether_dhcp_range)).thenReturn(new String[0]);
+ when(mResources.getStringArray(config_tether_usb_regexs)).thenReturn(new String[0]);
+ when(mResources.getStringArray(config_tether_wifi_regexs))
.thenReturn(new String[]{ "test_wlan\\d" });
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_bluetooth_regexs))
- .thenReturn(new String[0]);
+ when(mResources.getStringArray(config_tether_bluetooth_regexs)).thenReturn(new String[0]);
when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
- when(mResources.getStringArray(
- com.android.internal.R.array.config_mobile_hotspot_provision_app))
+ when(mResources.getStringArray(config_mobile_hotspot_provision_app))
.thenReturn(new String[0]);
mContentResolver = new MockContentResolver();
mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
@@ -297,19 +300,16 @@
private void setUpResourceForSubId() {
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_dhcp_range)).thenReturn(new String[0]);
+ config_tether_dhcp_range)).thenReturn(new String[0]);
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_usb_regexs)).thenReturn(new String[0]);
+ config_tether_usb_regexs)).thenReturn(new String[0]);
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_wifi_regexs))
- .thenReturn(new String[]{ "test_wlan\\d" });
+ config_tether_wifi_regexs)).thenReturn(new String[]{ "test_wlan\\d" });
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_bluetooth_regexs))
- .thenReturn(new String[0]);
+ config_tether_bluetooth_regexs)).thenReturn(new String[0]);
when(mResourcesForSubId.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_mobile_hotspot_provision_app))
- .thenReturn(PROVISIONING_APP_NAME);
+ config_mobile_hotspot_provision_app)).thenReturn(PROVISIONING_APP_NAME);
}
}
diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto
index 5d6d1c9..5712566 100644
--- a/proto/src/system_messages.proto
+++ b/proto/src/system_messages.proto
@@ -253,6 +253,8 @@
NOTE_NETWORK_LOGGED_IN = 744;
// A partial connectivity network was detected during network validation
NOTE_NETWORK_PARTIAL_CONNECTIVITY = 745;
+ // Private DNS is broken in strict mode
+ NOTE_NETWORK_PRIVATE_DNS_BROKEN = 746;
// Notify the user that their work profile has been deleted
// Package: android
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
deleted file mode 100644
index fbf6ca5..0000000
--- a/proto/src/wifi.proto
+++ /dev/null
@@ -1,2704 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-syntax = "proto2";
-
-package clearcut.connectivity;
-
-option java_package = "com.android.server.wifi";
-option java_outer_classname = "WifiMetricsProto";
-
-// The information about the Wifi events.
-message WifiLog {
-
- // Session information that gets logged for every Wifi connection.
- repeated ConnectionEvent connection_event = 1;
-
- // Number of saved networks in the user profile.
- optional int32 num_saved_networks = 2;
-
- // Number of open networks in the saved networks.
- optional int32 num_open_networks = 3;
-
- // Number of legacy personal networks.
- optional int32 num_legacy_personal_networks = 4;
-
- // Number of legacy enterprise networks.
- optional int32 num_legacy_enterprise_networks = 5;
-
- // Does the user have location setting enabled.
- optional bool is_location_enabled = 6;
-
- // Does the user have scanning enabled.
- optional bool is_scanning_always_enabled = 7;
-
- // Number of times user toggled wifi using the settings menu.
- optional int32 num_wifi_toggled_via_settings = 8;
-
- // Number of times user toggled wifi using the airplane menu.
- optional int32 num_wifi_toggled_via_airplane = 9;
-
- // Number of networks added by the user.
- optional int32 num_networks_added_by_user = 10;
-
- // Number of networks added by applications.
- optional int32 num_networks_added_by_apps = 11;
-
- // Number scans that returned empty results.
- optional int32 num_empty_scan_results = 12;
-
- // Number scans that returned at least one result.
- optional int32 num_non_empty_scan_results = 13;
-
- // Number of single scans requests.
- optional int32 num_oneshot_scans = 14;
-
- // Number of repeated background scans that were scheduled to the chip.
- optional int32 num_background_scans = 15;
-
- // Error codes that a scan can result in.
- enum ScanReturnCode {
-
- // Return Code is unknown.
- SCAN_UNKNOWN = 0;
-
- // Scan was successful.
- SCAN_SUCCESS = 1;
-
- // Scan was successfully started, but was interrupted.
- SCAN_FAILURE_INTERRUPTED = 2;
-
- // Scan failed to start because of invalid configuration
- // (bad channel, etc).
- SCAN_FAILURE_INVALID_CONFIGURATION = 3;
-
- // Could not start a scan because wifi is disabled.
- FAILURE_WIFI_DISABLED = 4;
-
- }
-
- // Mapping of error codes to the number of times that scans resulted
- // in that error.
- repeated ScanReturnEntry scan_return_entries = 16;
-
- message ScanReturnEntry {
-
- // Return code of the scan.
- optional ScanReturnCode scan_return_code = 1;
-
- // Number of entries that were found in the scan.
- optional int32 scan_results_count = 2;
- }
-
- // State of the Wifi.
- enum WifiState {
-
- // State is unknown.
- WIFI_UNKNOWN = 0;
-
- // Wifi is disabled.
- WIFI_DISABLED = 1;
-
- // Wifi is enabled.
- WIFI_DISCONNECTED = 2;
-
- // Wifi is enabled and associated with an AP.
- WIFI_ASSOCIATED = 3;
- }
-
- // Mapping of system state to the number of times that scans were requested in
- // that state
- repeated WifiSystemStateEntry wifi_system_state_entries = 17;
-
- message WifiSystemStateEntry {
-
- // Current WiFi state.
- optional WifiState wifi_state = 1;
-
- // Count of scans in state.
- optional int32 wifi_state_count = 2;
-
- // Is screen on.
- optional bool is_screen_on = 3;
- }
-
- // Mapping of Error/Success codes to the number of background scans that resulted in it
- repeated ScanReturnEntry background_scan_return_entries = 18;
-
- // Mapping of system state to the number of times that Background scans were requested in that
- // state
- repeated WifiSystemStateEntry background_scan_request_state = 19;
-
- // Total number of times the Watchdog of Last Resort triggered, resetting the wifi stack
- optional int32 num_last_resort_watchdog_triggers = 20;
-
- // Total number of networks over bad association threshold when watchdog triggered
- optional int32 num_last_resort_watchdog_bad_association_networks_total = 21;
-
- // Total number of networks over bad authentication threshold when watchdog triggered
- optional int32 num_last_resort_watchdog_bad_authentication_networks_total = 22;
-
- // Total number of networks over bad dhcp threshold when watchdog triggered
- optional int32 num_last_resort_watchdog_bad_dhcp_networks_total = 23;
-
- // Total number of networks over bad other threshold when watchdog triggered
- optional int32 num_last_resort_watchdog_bad_other_networks_total = 24;
-
- // Total count of networks seen when watchdog triggered
- optional int32 num_last_resort_watchdog_available_networks_total = 25;
-
- // Total count of triggers with atleast one bad association network
- optional int32 num_last_resort_watchdog_triggers_with_bad_association = 26;
-
- // Total count of triggers with atleast one bad authentication network
- optional int32 num_last_resort_watchdog_triggers_with_bad_authentication = 27;
-
- // Total count of triggers with atleast one bad dhcp network
- optional int32 num_last_resort_watchdog_triggers_with_bad_dhcp = 28;
-
- // Total count of triggers with atleast one bad other network
- optional int32 num_last_resort_watchdog_triggers_with_bad_other = 29;
-
- // Count of times connectivity watchdog confirmed pno is working
- optional int32 num_connectivity_watchdog_pno_good = 30;
-
- // Count of times connectivity watchdog found pno not working
- optional int32 num_connectivity_watchdog_pno_bad = 31;
-
- // Count of times connectivity watchdog confirmed background scan is working
- optional int32 num_connectivity_watchdog_background_good = 32;
-
- // Count of times connectivity watchdog found background scan not working
- optional int32 num_connectivity_watchdog_background_bad = 33;
-
- // The time duration represented by this wifi log, from start to end of capture
- optional int32 record_duration_sec = 34;
-
- // Counts the occurrences of each individual RSSI poll level
- repeated RssiPollCount rssi_poll_rssi_count = 35;
-
- // Total number of times WiFi connected immediately after a Last Resort Watchdog trigger,
- // without new networks becoming available.
- optional int32 num_last_resort_watchdog_successes = 36;
-
- // Total number of saved hidden networks
- optional int32 num_hidden_networks = 37;
-
- // Total number of saved passpoint / hotspot 2.0 networks
- optional int32 num_passpoint_networks = 38;
-
- // Total number of scan results
- optional int32 num_total_scan_results = 39;
-
- // Total number of scan results for open networks
- optional int32 num_open_network_scan_results = 40;
-
- // Total number of scan results for legacy personal networks
- optional int32 num_legacy_personal_network_scan_results = 41;
-
- // Total number of scan results for legacy enterprise networks
- optional int32 num_legacy_enterprise_network_scan_results = 42;
-
- // Total number of scan results for hidden networks
- optional int32 num_hidden_network_scan_results = 43;
-
- // Total number of scan results for hotspot 2.0 r1 networks
- optional int32 num_hotspot2_r1_network_scan_results = 44;
-
- // Total number of scan results for hotspot 2.0 r2 networks
- optional int32 num_hotspot2_r2_network_scan_results = 45;
-
- // Total number of scans handled by framework (oneshot or otherwise)
- optional int32 num_scans = 46;
-
- // Counts the occurrences of each alert reason.
- repeated AlertReasonCount alert_reason_count = 47;
-
- // Counts the occurrences of each Wifi score
- repeated WifiScoreCount wifi_score_count = 48;
-
- // Histogram of Soft AP Durations
- repeated SoftApDurationBucket soft_ap_duration = 49;
-
- // Histogram of Soft AP ReturnCode
- repeated SoftApReturnCodeCount soft_ap_return_code = 50;
-
- // Histogram of the delta between scan result RSSI and RSSI polls
- repeated RssiPollCount rssi_poll_delta_count = 51;
-
- // List of events
- repeated StaEvent sta_event_list = 52;
-
- // Total number of times WiFi HAL crashed.
- optional int32 num_hal_crashes = 53;
-
- // Total number of times WiFicond crashed.
- optional int32 num_wificond_crashes = 54;
-
- // Indicates the number of times an error was encountered in
- // Wifi HAL on |WifiNative.setupInterfaceForClientMode|.
- optional int32 num_setup_client_interface_failure_due_to_hal = 55;
-
- // Indicates the number of times an error was encountered in
- // Wificond on |WifiNative.setupInterfaceForClientMode|.
- optional int32 num_setup_client_interface_failure_due_to_wificond = 56;
-
- // Wi-Fi Aware metrics
- optional WifiAwareLog wifi_aware_log = 57;
-
- // Number of saved Passpoint providers in user profile.
- optional int32 num_passpoint_providers = 58;
-
- // Count of times Passpoint provider being installed.
- optional int32 num_passpoint_provider_installation = 59;
-
- // Count of times Passpoint provivider is installed successfully.
- optional int32 num_passpoint_provider_install_success = 60;
-
- // Count of times Passpoint provider is being uninstalled.
- optional int32 num_passpoint_provider_uninstallation = 61;
-
- // Count of times Passpoint provider is uninstalled successfully.
- optional int32 num_passpoint_provider_uninstall_success = 62;
-
- // Count of saved Passpoint providers device has ever connected to.
- optional int32 num_passpoint_providers_successfully_connected = 63;
-
- // Histogram counting instances of scans with N many ScanResults with unique ssids
- repeated NumConnectableNetworksBucket total_ssids_in_scan_histogram = 64;
-
- // Histogram counting instances of scans with N many ScanResults/bssids
- repeated NumConnectableNetworksBucket total_bssids_in_scan_histogram = 65;
-
- // Histogram counting instances of scans with N many unique open ssids
- repeated NumConnectableNetworksBucket available_open_ssids_in_scan_histogram = 66;
-
- // Histogram counting instances of scans with N many bssids for open networks
- repeated NumConnectableNetworksBucket available_open_bssids_in_scan_histogram = 67;
-
- // Histogram counting instances of scans with N many unique ssids for saved networks
- repeated NumConnectableNetworksBucket available_saved_ssids_in_scan_histogram = 68;
-
- // Histogram counting instances of scans with N many bssids for saved networks
- repeated NumConnectableNetworksBucket available_saved_bssids_in_scan_histogram = 69;
-
- // Histogram counting instances of scans with N many unique SSIDs for open or saved networks
- repeated NumConnectableNetworksBucket available_open_or_saved_ssids_in_scan_histogram = 70;
-
- // Histogram counting instances of scans with N many BSSIDs for open or saved networks
- repeated NumConnectableNetworksBucket available_open_or_saved_bssids_in_scan_histogram = 71;
-
- // Histogram counting instances of scans with N many ScanResults matching unique saved passpoint providers
- repeated NumConnectableNetworksBucket available_saved_passpoint_provider_profiles_in_scan_histogram = 72;
-
- // Histogram counting instances of scans with N many ScanResults BSSIDs matching a saved passpoint provider
- repeated NumConnectableNetworksBucket available_saved_passpoint_provider_bssids_in_scan_histogram = 73;
-
- // Counts the number of AllSingleScanLister.onResult calls with a full band scan result
- optional int32 full_band_all_single_scan_listener_results = 74;
-
- // Counts the number of AllSingleScanLister.onResult calls with a partial (channels) scan result
- optional int32 partial_all_single_scan_listener_results = 75;
-
- // Pno scan metrics
- optional PnoScanMetrics pno_scan_metrics = 76;
-
- // Histogram of "Connect to Network" notifications.
- // The notification Action should be unset.
- repeated ConnectToNetworkNotificationAndActionCount connect_to_network_notification_count = 77;
-
- // Histogram of "Connect to Network" notification user actions.
- repeated ConnectToNetworkNotificationAndActionCount connect_to_network_notification_action_count = 78;
-
- // The number of SSIDs blacklisted from recommendation by the open network
- // notification recommender
- optional int32 open_network_recommender_blacklist_size = 79;
-
- // Is the available network notification feature turned on
- optional bool is_wifi_networks_available_notification_on = 80;
-
- // Count of recommendation updates made by the open network notification
- // recommender
- optional int32 num_open_network_recommendation_updates = 81;
-
- // Count of connection attempts that were initiated unsuccessfully
- optional int32 num_open_network_connect_message_failed_to_send = 82;
-
- // Histogram counting instances of scans with N many HotSpot 2.0 R1 APs
- repeated NumConnectableNetworksBucket observed_hotspot_r1_aps_in_scan_histogram = 83;
-
- // Histogram counting instances of scans with N many HotSpot 2.0 R2 APs
- repeated NumConnectableNetworksBucket observed_hotspot_r2_aps_in_scan_histogram = 84;
-
- // Histogram counting instances of scans with N many unique HotSpot 2.0 R1 ESS.
- // Where ESS is defined as the (HESSID, ANQP Domain ID), (SSID, ANQP Domain ID) or
- // (SSID, BSSID) tuple depending on AP configuration (in the above priority
- // order).
- repeated NumConnectableNetworksBucket observed_hotspot_r1_ess_in_scan_histogram = 85;
-
- // Histogram counting instances of scans with N many unique HotSpot 2.0 R2 ESS.
- // Where ESS is defined as the (HESSID, ANQP Domain ID), (SSID, ANQP Domain ID) or
- // (SSID, BSSID) tuple depending on AP configuration (in the above priority
- // order).
- repeated NumConnectableNetworksBucket observed_hotspot_r2_ess_in_scan_histogram = 86;
-
- // Histogram counting number of HotSpot 2.0 R1 APs per observed ESS in a scan
- // (one value added per unique ESS - potentially multiple counts per single
- // scan!)
- repeated NumConnectableNetworksBucket observed_hotspot_r1_aps_per_ess_in_scan_histogram = 87;
-
- // Histogram counting number of HotSpot 2.0 R2 APs per observed ESS in a scan
- // (one value added per unique ESS - potentially multiple counts per single
- // scan!)
- repeated NumConnectableNetworksBucket observed_hotspot_r2_aps_per_ess_in_scan_histogram = 88;
-
- // SoftAP event list tracking sessions and client counts in tethered mode
- repeated SoftApConnectedClientsEvent soft_ap_connected_clients_events_tethered = 89;
-
- // SoftAP event list tracking sessions and client counts in local only mode
- repeated SoftApConnectedClientsEvent soft_ap_connected_clients_events_local_only = 90;
-
- // Wps connection metrics
- optional WpsMetrics wps_metrics = 91;
-
- // Wifi power statistics
- optional WifiPowerStats wifi_power_stats = 92;
-
- // Number of connectivity single scan requests.
- optional int32 num_connectivity_oneshot_scans = 93;
-
- // WifiWake statistics
- optional WifiWakeStats wifi_wake_stats = 94;
-
- // Histogram counting instances of scans with N many 802.11mc (RTT) supporting APs
- repeated NumConnectableNetworksBucket observed_80211mc_supporting_aps_in_scan_histogram = 95;
-
- // Total number of times supplicant crashed.
- optional int32 num_supplicant_crashes = 96;
-
- // Total number of times hostapd crashed.
- optional int32 num_hostapd_crashes = 97;
-
- // Indicates the number of times an error was encountered in
- // supplicant on |WifiNative.setupInterfaceForClientMode|.
- optional int32 num_setup_client_interface_failure_due_to_supplicant = 98;
-
- // Indicates the number of times an error was encountered in
- // Wifi HAL on |WifiNative.setupInterfaceForSoftApMode|.
- optional int32 num_setup_soft_ap_interface_failure_due_to_hal = 99;
-
- // Indicates the number of times an error was encountered in
- // Wifi HAL on |WifiNative.setupInterfaceForSoftApMode|.
- optional int32 num_setup_soft_ap_interface_failure_due_to_wificond = 100;
-
- // Indicates the number of times an error was encountered in
- // Wifi HAL on |WifiNative.setupInterfaceForSoftApMode|.
- optional int32 num_setup_soft_ap_interface_failure_due_to_hostapd = 101;
-
- // Indicates the number of times we got an interface down in client mode.
- optional int32 num_client_interface_down = 102;
-
- // Indicates the number of times we got an interface down in softap mode.
- optional int32 num_soft_ap_interface_down = 103;
-
- // Indicates the number of scan requests from external apps.
- optional int32 num_external_app_oneshot_scan_requests = 104;
-
- // Indicates the number of times a scan request from an external foreground app was throttled.
- optional int32 num_external_foreground_app_oneshot_scan_requests_throttled = 105;
-
- // Indicates the number of times a scan request from an external background app was throttled.
- optional int32 num_external_background_app_oneshot_scan_requests_throttled = 106;
-
- // WifiLastResortWatchdog time milliseconds delta between trigger and first connection success
- optional int64 watchdog_trigger_to_connection_success_duration_ms = 107 [default = -1];
-
- // The number of times wifi experienced failures after watchdog has already been triggered and is
- // waiting for a connection success
- optional int64 watchdog_total_connection_failure_count_after_trigger = 108;
-
- // Number of times DFS channel scans are requested in single scan requests.
- optional int32 num_oneshot_has_dfs_channel_scans = 109;
-
- // Wi-Fi RTT metrics
- optional WifiRttLog wifi_rtt_log = 110;
-
- // Flag which indicates if Connected MAC Randomization is enabled
- optional bool is_mac_randomization_on = 111 [default = false];
-
- // Number of radio mode changes to MCC (Multi channel concurrency).
- optional int32 num_radio_mode_change_to_mcc = 112;
-
- // Number of radio mode changes to SCC (Single channel concurrency).
- optional int32 num_radio_mode_change_to_scc = 113;
-
- // Number of radio mode changes to SBS (Single band simultaneous).
- optional int32 num_radio_mode_change_to_sbs = 114;
-
- // Number of radio mode changes to DBS (Dual band simultaneous).
- optional int32 num_radio_mode_change_to_dbs = 115;
-
- // Number of times the firmware picked a SoftAp channel not satisfying user band preference.
- optional int32 num_soft_ap_user_band_preference_unsatisfied = 116;
-
- // Identifier for experimental scoring parameter settings.
- optional string score_experiment_id = 117;
-
- // Data on wifi radio usage
- optional WifiRadioUsage wifi_radio_usage = 118;
-
- // Stores settings values used for metrics testing.
- optional ExperimentValues experiment_values = 119;
-
- // List of WifiIsUnusableEvents which get logged when we notice that WiFi is unusable.
- // Collected only when WIFI_IS_UNUSABLE_EVENT_METRICS_ENABLED Settings is enabled.
- repeated WifiIsUnusableEvent wifi_is_unusable_event_list = 120;
-
- // Counts the occurrences of each link speed (Mbps) level
- // with rssi (dBm) and rssi^2 sums (dBm^2)
- repeated LinkSpeedCount link_speed_counts = 121;
-
- // Number of times the SarManager failed to register SAR sensor listener
- optional int32 num_sar_sensor_registration_failures = 122;
-
- // Hardware revision (EVT, DVT, PVT etc.)
- optional string hardware_revision = 124;
-
- // Total wifi link layer usage data over the logging duration in ms.
- optional WifiLinkLayerUsageStats wifi_link_layer_usage_stats = 125;
-
- // Multiple lists of timestamped link layer stats with labels to represent whether wifi is usable
- repeated WifiUsabilityStats wifi_usability_stats_list = 126;
-
- // Counts the occurrences of each Wifi usability score provided by external app
- repeated WifiUsabilityScoreCount wifi_usability_score_count = 127;
-
- // List of PNO scan stats, one element for each mobility state
- repeated DeviceMobilityStatePnoScanStats mobility_state_pno_stats_list = 128;
-
- // Wifi p2p statistics
- optional WifiP2pStats wifi_p2p_stats = 129;
-
- // Easy Connect (DPP) metrics
- optional WifiDppLog wifi_dpp_log = 130;
-
- // Number of Enhanced Open (OWE) networks in the saved networks.
- optional int32 num_enhanced_open_networks = 131;
-
- // Number of WPA3-Personal networks.
- optional int32 num_wpa3_personal_networks = 132;
-
- // Number of WPA3-Enterprise networks.
- optional int32 num_wpa3_enterprise_networks = 133;
-
- // Total number of scan results for Enhanced open networks
- optional int32 num_enhanced_open_network_scan_results = 134;
-
- // Total number of scan results for WPA3-Personal networks
- optional int32 num_wpa3_personal_network_scan_results = 135;
-
- // Total number of scan results for WPA3-Enterprise networks
- optional int32 num_wpa3_enterprise_network_scan_results = 136;
-
- // WifiConfigStore read/write metrics.
- optional WifiConfigStoreIO wifi_config_store_io = 137;
-
- // Total number of saved networks with mac randomization enabled.
- optional int32 num_saved_networks_with_mac_randomization = 138;
-
- // Link Probe metrics
- optional LinkProbeStats link_probe_stats = 139;
-
- // List of NetworkSelectionExperimentDecisions stats for each experiment
- repeated NetworkSelectionExperimentDecisions network_selection_experiment_decisions_list = 140;
-
- // Network Request API surface metrics.
- optional WifiNetworkRequestApiLog wifi_network_request_api_log = 141;
-
- // Network Suggestion API surface metrics.
- optional WifiNetworkSuggestionApiLog wifi_network_suggestion_api_log = 142;
-
- // WifiLock statistics
- optional WifiLockStats wifi_lock_stats = 143;
-
- // Stats on number of times Wi-Fi is turned on/off though the WifiManager#setWifiEnabled API
- optional WifiToggleStats wifi_toggle_stats = 144;
-
- // Number of times WifiManager#addOrUpdateNetwork is called.
- optional int32 num_add_or_update_network_calls = 145;
-
- // Number of times WifiManager#enableNetwork is called.
- optional int32 num_enable_network_calls = 146;
-
- // Passpoint provison metrics
- optional PasspointProvisionStats passpoint_provision_stats = 147;
-
- // Histogram of the EAP method type of all installed Passpoint profiles for R1
- repeated PasspointProfileTypeCount installed_passpoint_profile_type_for_r1 = 123;
-
- // Histogram of the EAP method type of all installed Passpoint profiles for R2
- repeated PasspointProfileTypeCount installed_passpoint_profile_type_for_r2 = 148;
-
- // Histogram of Tx link speed at 2G
- repeated Int32Count tx_link_speed_count_2g = 149;
-
- // Histogram of Tx link speed at 5G low band
- repeated Int32Count tx_link_speed_count_5g_low = 150;
-
- // Histogram of Tx link speed at 5G middle band
- repeated Int32Count tx_link_speed_count_5g_mid = 151;
-
- // Histogram of Tx link speed at 5G high band
- repeated Int32Count tx_link_speed_count_5g_high = 152;
-
- // Histogram of Rx link speed at 2G
- repeated Int32Count rx_link_speed_count_2g = 153;
-
- // Histogram of Rx link speed at 5G low band
- repeated Int32Count rx_link_speed_count_5g_low = 154;
-
- // Histogram of Rx link speed at 5G middle band
- repeated Int32Count rx_link_speed_count_5g_mid = 155;
-
- // Histogram of Rx link speed at 5G high band
- repeated Int32Count rx_link_speed_count_5g_high = 156;
-}
-
-// Information that gets logged for every WiFi connection.
-message RouterFingerPrint {
-
- enum RoamType {
-
- // Type is unknown.
- ROAM_TYPE_UNKNOWN = 0;
-
- // No roaming - usually happens on a single band (2.4 GHz) router.
- ROAM_TYPE_NONE = 1;
-
- // Enterprise router.
- ROAM_TYPE_ENTERPRISE = 2;
-
- // DBDC => Dual Band Dual Concurrent essentially a router that
- // supports both 2.4 GHz and 5 GHz bands.
- ROAM_TYPE_DBDC = 3;
- }
-
- enum Auth {
-
- // Auth is unknown.
- AUTH_UNKNOWN = 0;
-
- // No authentication.
- AUTH_OPEN = 1;
-
- // If the router uses a personal authentication.
- AUTH_PERSONAL = 2;
-
- // If the router is setup for enterprise authentication.
- AUTH_ENTERPRISE = 3;
- }
-
- enum RouterTechnology {
-
- // Router is unknown.
- ROUTER_TECH_UNKNOWN = 0;
-
- // Router Channel A.
- ROUTER_TECH_A = 1;
-
- // Router Channel B.
- ROUTER_TECH_B = 2;
-
- // Router Channel G.
- ROUTER_TECH_G = 3;
-
- // Router Channel N.
- ROUTER_TECH_N = 4;
-
- // Router Channel AC.
- ROUTER_TECH_AC = 5;
-
- // When the channel is not one of the above.
- ROUTER_TECH_OTHER = 6;
- }
-
- optional RoamType roam_type = 1;
-
- // Channel on which the connection takes place.
- optional int32 channel_info = 2;
-
- // DTIM setting of the router.
- optional int32 dtim = 3;
-
- // Authentication scheme of the router.
- optional Auth authentication = 4;
-
- // If the router is hidden.
- optional bool hidden = 5;
-
- // Channel information.
- optional RouterTechnology router_technology = 6;
-
- // whether ipv6 is supported.
- optional bool supports_ipv6 = 7;
-
- // If the router is a passpoint / hotspot 2.0 network
- optional bool passpoint = 8;
-}
-
-message ConnectionEvent {
-
- // Roam Type.
- enum RoamType {
-
- // Type is unknown.
- ROAM_UNKNOWN = 0;
-
- // No roaming.
- ROAM_NONE = 1;
-
- // DBDC roaming.
- ROAM_DBDC = 2;
-
- // Enterprise roaming.
- ROAM_ENTERPRISE = 3;
-
- // User selected roaming.
- ROAM_USER_SELECTED = 4;
-
- // Unrelated.
- ROAM_UNRELATED = 5;
- }
-
- // Connectivity Level Failure.
- enum ConnectivityLevelFailure {
-
- // Failure is unknown.
- HLF_UNKNOWN = 0;
-
- // No failure.
- HLF_NONE = 1;
-
- // DHCP failure.
- HLF_DHCP = 2;
-
- // No internet connection.
- HLF_NO_INTERNET = 3;
-
- // No internet connection.
- HLF_UNWANTED = 4;
- }
-
- // Level 2 failure reason.
- enum Level2FailureReason {
-
- // Unknown default
- FAILURE_REASON_UNKNOWN = 0;
-
- // The reason code if there is no error during authentication. It could
- // also imply that there no authentication in progress.
- AUTH_FAILURE_NONE = 1;
-
- // The reason code if there was a timeout authenticating.
- AUTH_FAILURE_TIMEOUT = 2;
-
- // The reason code if there was a wrong password while authenticating.
- AUTH_FAILURE_WRONG_PSWD = 3;
-
- // The reason code if there was EAP failure while authenticating.
- AUTH_FAILURE_EAP_FAILURE = 4;
- }
-
- // Entity that recommended connecting to this network.
- enum ConnectionNominator {
- // Unknown nominator
- NOMINATOR_UNKNOWN = 0;
-
- // User selected network manually
- NOMINATOR_MANUAL = 1;
-
- // Saved network
- NOMINATOR_SAVED = 2;
-
- // Suggestion API
- NOMINATOR_SUGGESTION = 3;
-
- // Passpoint
- NOMINATOR_PASSPOINT = 4;
-
- // Carrier suggestion
- NOMINATOR_CARRIER = 5;
-
- // External scorer
- NOMINATOR_EXTERNAL_SCORED = 6;
-
- // Network Specifier
- NOMINATOR_SPECIFIER = 7;
-
- // User connected choice override
- NOMINATOR_SAVED_USER_CONNECT_CHOICE = 8;
-
- // Open Network Available Pop-up
- NOMINATOR_OPEN_NETWORK_AVAILABLE = 9;
- }
-
- // Start time of the connection.
- optional int64 start_time_millis = 1;// [(datapol.semantic_type) = ST_TIMESTAMP];
-
- // Duration to connect.
- optional int32 duration_taken_to_connect_millis = 2;
-
- // Router information.
- optional RouterFingerPrint router_fingerprint = 3;
-
- // RSSI at the start of the connection.
- optional int32 signal_strength = 4;
-
- // Roam Type.
- optional RoamType roam_type = 5;
-
- // Result of the connection.
- optional int32 connection_result = 6;
-
- // Reasons for level 2 failure (needs to be coordinated with wpa-supplicant).
- optional int32 level_2_failure_code = 7;
-
- // Failures that happen at the connectivity layer.
- optional ConnectivityLevelFailure connectivity_level_failure_code = 8;
-
- // Has bug report been taken.
- optional bool automatic_bug_report_taken = 9;
-
- // Connection is using locally generated random MAC address.
- optional bool use_randomized_mac = 10 [default = false];
-
- // Who chose to connect.
- optional ConnectionNominator connection_nominator = 11;
-
- // The currently running network selector when this connection event occurred.
- optional int32 network_selector_experiment_id = 12;
-
- // Breakdown of level_2_failure_code with more detailed reason.
- optional Level2FailureReason level_2_failure_reason = 13
- [default = FAILURE_REASON_UNKNOWN];
-}
-
-// Number of occurrences of a specific RSSI poll rssi value
-message RssiPollCount {
- // RSSI
- optional int32 rssi = 1;
-
- // Number of RSSI polls with 'rssi'
- optional int32 count = 2;
-
- // Beacon frequency of the channel in MHz
- optional int32 frequency = 3;
-}
-
-// Number of occurrences of a specific alert reason value
-message AlertReasonCount {
- // Alert reason
- optional int32 reason = 1;
-
- // Number of alerts with |reason|.
- optional int32 count = 2;
-}
-
-// Counts the number of instances of a specific Wifi Score calculated by WifiScoreReport
-message WifiScoreCount {
- // Wifi Score
- optional int32 score = 1;
-
- // Number of Wifi score reports with this score
- optional int32 count = 2;
-}
-
-// Counts the number of instances of a specific Wifi Usability Score
-message WifiUsabilityScoreCount {
- // Wifi Usability Score
- optional int32 score = 1;
-
- // Number of Wifi score reports with this score
- optional int32 count = 2;
-}
-
-// Number of occurrences of a specific link speed (Mbps)
-// and sum of rssi (dBm) and rssi^2 (dBm^2)
-message LinkSpeedCount {
- // Link speed (Mbps)
- optional int32 link_speed_mbps = 1;
-
- // Number of RSSI polls with link_speed
- optional int32 count = 2;
-
- // Sum of absolute values of rssi values (dBm)
- optional int32 rssi_sum_dbm = 3;
-
- // Sum of squares of rssi values (dBm^2)
- optional int64 rssi_sum_of_squares_dbm_sq = 4;
-}
-
-
-// Number of occurrences of Soft AP session durations
-message SoftApDurationBucket {
- // Bucket covers duration : [duration_sec, duration_sec + bucket_size_sec)
- // The (inclusive) lower bound of Soft AP session duration represented by this bucket
- optional int32 duration_sec = 1;
-
- // The size of this bucket
- optional int32 bucket_size_sec = 2;
-
- // Number of soft AP session durations that fit into this bucket
- optional int32 count = 3;
-}
-
-// Number of occurrences of a soft AP session return code
-message SoftApReturnCodeCount {
-
- enum SoftApStartResult {
-
- // SoftApManager return code unknown
- SOFT_AP_RETURN_CODE_UNKNOWN = 0;
-
- // SoftAp started successfully
- SOFT_AP_STARTED_SUCCESSFULLY = 1;
-
- // Catch all for failures with no specific failure reason
- SOFT_AP_FAILED_GENERAL_ERROR = 2;
-
- // SoftAp failed to start due to NO_CHANNEL error
- SOFT_AP_FAILED_NO_CHANNEL = 3;
- }
-
- // Historical, no longer used for writing as of 01/2017.
- optional int32 return_code = 1 [deprecated = true];
-
- // Occurrences of this soft AP return code
- optional int32 count = 2;
-
- // Result of attempt to start SoftAp
- optional SoftApStartResult start_result = 3;
-}
-
-message StaEvent {
- message ConfigInfo {
- // The set of key management protocols supported by this configuration.
- optional uint32 allowed_key_management = 1 [default = 0];
-
- // The set of security protocols supported by this configuration.
- optional uint32 allowed_protocols = 2 [default = 0];
-
- // The set of authentication protocols supported by this configuration.
- optional uint32 allowed_auth_algorithms = 3 [default = 0];
-
- // The set of pairwise ciphers for WPA supported by this configuration.
- optional uint32 allowed_pairwise_ciphers = 4 [default = 0];
-
- // The set of group ciphers supported by this configuration.
- optional uint32 allowed_group_ciphers = 5;
-
- // Is this a 'hidden network'
- optional bool hidden_ssid = 6;
-
- // Is this a Hotspot 2.0 / passpoint network
- optional bool is_passpoint = 7;
-
- // Is this an 'ephemeral' network (Not in saved network list, recommended externally)
- optional bool is_ephemeral = 8;
-
- // Has a successful connection ever been established using this WifiConfiguration
- optional bool has_ever_connected = 9;
-
- // RSSI of the scan result candidate associated with this WifiConfiguration
- optional int32 scan_rssi = 10 [default = -127];
-
- // Frequency of the scan result candidate associated with this WifiConfiguration
- optional int32 scan_freq = 11 [default = -1];
- }
-
- enum EventType {
- // Default/Invalid event
- TYPE_UNKNOWN = 0;
-
- // Supplicant Association Rejection event. Code contains the 802.11
- TYPE_ASSOCIATION_REJECTION_EVENT = 1;
-
- // Supplicant L2 event,
- TYPE_AUTHENTICATION_FAILURE_EVENT = 2;
-
- // Supplicant L2 event
- TYPE_NETWORK_CONNECTION_EVENT = 3;
-
- // Supplicant L2 event
- TYPE_NETWORK_DISCONNECTION_EVENT = 4;
-
- // Supplicant L2 event
- TYPE_SUPPLICANT_STATE_CHANGE_EVENT = 5;
-
- // Supplicant L2 event
- TYPE_CMD_ASSOCIATED_BSSID = 6;
-
- // IP Manager successfully completed IP Provisioning
- TYPE_CMD_IP_CONFIGURATION_SUCCESSFUL = 7;
-
- // IP Manager failed to complete IP Provisioning
- TYPE_CMD_IP_CONFIGURATION_LOST = 8;
-
- // IP Manager lost reachability to network neighbors
- TYPE_CMD_IP_REACHABILITY_LOST = 9;
-
- // Indicator that Supplicant is targeting a BSSID for roam/connection
- TYPE_CMD_TARGET_BSSID = 10;
-
- // Wifi framework is initiating a connection attempt
- TYPE_CMD_START_CONNECT = 11;
-
- // Wifi framework is initiating a roaming connection attempt
- TYPE_CMD_START_ROAM = 12;
-
- // SystemAPI connect() command, Settings App
- TYPE_CONNECT_NETWORK = 13;
-
- // Network Agent has validated the internet connection (Captive Portal Check success, or user
- // validation)
- TYPE_NETWORK_AGENT_VALID_NETWORK = 14;
-
- // Framework initiated disconnect. Sometimes generated to give an extra reason for a disconnect
- // Should typically be followed by a NETWORK_DISCONNECTION_EVENT with a local_gen = true
- TYPE_FRAMEWORK_DISCONNECT = 15;
-
- // The NetworkAgent score for wifi has changed in a way that may impact
- // connectivity
- TYPE_SCORE_BREACH = 16;
-
- // Framework changed Sta interface MAC address
- TYPE_MAC_CHANGE = 17;
-
- // Wifi is turned on
- TYPE_WIFI_ENABLED = 18;
-
- // Wifi is turned off
- TYPE_WIFI_DISABLED = 19;
-
- // The NetworkAgent Wifi usability score has changed in a way that may
- // impact connectivity
- TYPE_WIFI_USABILITY_SCORE_BREACH = 20;
-
- // Link probe was performed
- TYPE_LINK_PROBE = 21;
- }
-
- enum FrameworkDisconnectReason {
- // default/none/unknown value
- DISCONNECT_UNKNOWN = 0;
-
- // API DISCONNECT
- DISCONNECT_API = 1;
-
- // Some framework internal reason (generic)
- DISCONNECT_GENERIC = 2;
-
- // Network Agent network validation failed, user signaled network unwanted
- DISCONNECT_UNWANTED = 3;
-
- // Roaming timed out
- DISCONNECT_ROAM_WATCHDOG_TIMER = 4;
-
- // P2P service requested wifi disconnect
- DISCONNECT_P2P_DISCONNECT_WIFI_REQUEST = 5;
-
- // SIM was removed while using a SIM config
- DISCONNECT_RESET_SIM_NETWORKS = 6;
- }
-
- // Authentication Failure reasons as reported through the API.
- enum AuthFailureReason {
- // Unknown default
- AUTH_FAILURE_UNKNOWN = 0;
-
- // The reason code if there is no error during authentication. It could also imply that there no
- // authentication in progress,
- AUTH_FAILURE_NONE = 1;
-
- // The reason code if there was a timeout authenticating.
- AUTH_FAILURE_TIMEOUT = 2;
-
- // The reason code if there was a wrong password while authenticating.
- AUTH_FAILURE_WRONG_PSWD = 3;
-
- // The reason code if there was EAP failure while authenticating.
- AUTH_FAILURE_EAP_FAILURE = 4;
- }
-
- // What event was this
- optional EventType type = 1;
-
- // 80211 death reason code, relevant to NETWORK_DISCONNECTION_EVENTs
- optional int32 reason = 2 [default = -1];
-
- // 80211 Association Status code, relevant to ASSOCIATION_REJECTION_EVENTs
- optional int32 status = 3 [default = -1];
-
- // Designates whether a NETWORK_DISCONNECT_EVENT was by the STA or AP
- optional bool local_gen = 4 [default = false];
-
- // Network information from the WifiConfiguration of a framework initiated connection attempt
- optional ConfigInfo config_info = 5;
-
- // RSSI from the last rssi poll (Only valid for active connections)
- optional int32 last_rssi = 6 [default = -127];
-
- // Link speed from the last rssi poll (Only valid for active connections)
- optional int32 last_link_speed = 7 [default = -1];
-
- // Frequency from the last rssi poll (Only valid for active connections)
- optional int32 last_freq = 8 [default = -1];
-
- // Enum used to define bit positions in the supplicant_state_change_bitmask
- // See {@code frameworks/base/wifi/java/android/net/wifi/SupplicantState.java} for documentation
- enum SupplicantState {
- STATE_DISCONNECTED = 0;
-
- STATE_INTERFACE_DISABLED = 1;
-
- STATE_INACTIVE = 2;
-
- STATE_SCANNING = 3;
-
- STATE_AUTHENTICATING = 4;
-
- STATE_ASSOCIATING = 5;
-
- STATE_ASSOCIATED = 6;
-
- STATE_FOUR_WAY_HANDSHAKE = 7;
-
- STATE_GROUP_HANDSHAKE = 8;
-
- STATE_COMPLETED = 9;
-
- STATE_DORMANT = 10;
-
- STATE_UNINITIALIZED = 11;
-
- STATE_INVALID = 12;
- }
-
- // Bit mask of all supplicant state changes that occurred since the last event
- optional uint32 supplicant_state_changes_bitmask = 9 [default = 0];
-
- // The number of milliseconds that have elapsed since the device booted
- optional int64 start_time_millis = 10 [default = 0];
-
- optional FrameworkDisconnectReason framework_disconnect_reason = 11 [default = DISCONNECT_UNKNOWN];
-
- // Flag which indicates if an association rejection event occurred due to a timeout
- optional bool association_timed_out = 12 [default = false];
-
- // Authentication failure reason, as reported by WifiManager (calculated from state & deauth code)
- optional AuthFailureReason auth_failure_reason = 13 [default = AUTH_FAILURE_UNKNOWN];
-
- // NetworkAgent score of connected wifi
- optional int32 last_score = 14 [default = -1];
-
- // NetworkAgent Wifi usability score of connected wifi
- optional int32 last_wifi_usability_score = 15 [default = -1];
-
- // Prediction horizon (in second) of Wifi usability score provided by external
- // system app
- optional int32 last_prediction_horizon_sec = 16 [default = -1];
-
- // Only valid if event type == TYPE_LINK_PROBE.
- // true if link probe succeeded, false otherwise.
- optional bool link_probe_was_success = 17;
-
- // Only valid if event type == TYPE_LINK_PROBE and link_probe_was_success == true.
- // Elapsed time, in milliseconds, of a successful link probe.
- optional int32 link_probe_success_elapsed_time_ms = 18;
-
- // Only valid if event type == TYPE_LINK_PROBE and link_probe_was_success == false.
- // Failure reason for an unsuccessful link probe.
- optional LinkProbeStats.LinkProbeFailureReason link_probe_failure_reason = 19;
-}
-
-// Wi-Fi Aware metrics
-message WifiAwareLog {
- // total number of unique apps that used Aware (measured on attach)
- optional int32 num_apps = 1;
-
- // total number of unique apps that used an identity callback when attaching
- optional int32 num_apps_using_identity_callback = 2;
-
- // maximum number of attaches for an app
- optional int32 max_concurrent_attach_sessions_in_app = 3;
-
- // histogram of attach request results
- repeated NanStatusHistogramBucket histogram_attach_session_status = 4;
-
- // maximum number of concurrent publish sessions in a single app
- optional int32 max_concurrent_publish_in_app = 5;
-
- // maximum number of concurrent subscribe sessions in a single app
- optional int32 max_concurrent_subscribe_in_app = 6;
-
- // maximum number of concurrent discovery (publish+subscribe) sessions in a single app
- optional int32 max_concurrent_discovery_sessions_in_app = 7;
-
- // maximum number of concurrent publish sessions in the system
- optional int32 max_concurrent_publish_in_system = 8;
-
- // maximum number of concurrent subscribe sessions in the system
- optional int32 max_concurrent_subscribe_in_system = 9;
-
- // maximum number of concurrent discovery (publish+subscribe) sessions in the system
- optional int32 max_concurrent_discovery_sessions_in_system = 10;
-
- // histogram of publish request results
- repeated NanStatusHistogramBucket histogram_publish_status = 11;
-
- // histogram of subscribe request results
- repeated NanStatusHistogramBucket histogram_subscribe_status = 12;
-
- // number of unique apps which experienced a discovery session creation failure due to lack of
- // resources
- optional int32 num_apps_with_discovery_session_failure_out_of_resources = 13;
-
- // histogram of create ndp request results
- repeated NanStatusHistogramBucket histogram_request_ndp_status = 14;
-
- // histogram of create ndp out-of-band (OOB) request results
- repeated NanStatusHistogramBucket histogram_request_ndp_oob_status = 15;
-
- // maximum number of concurrent active data-interfaces (NDI) in a single app
- optional int32 max_concurrent_ndi_in_app = 19;
-
- // maximum number of concurrent active data-interfaces (NDI) in the system
- optional int32 max_concurrent_ndi_in_system = 20;
-
- // maximum number of concurrent data-paths (NDP) in a single app
- optional int32 max_concurrent_ndp_in_app = 21;
-
- // maximum number of concurrent data-paths (NDP) in the system
- optional int32 max_concurrent_ndp_in_system = 22;
-
- // maximum number of concurrent secure data-paths (NDP) in a single app
- optional int32 max_concurrent_secure_ndp_in_app = 23;
-
- // maximum number of concurrent secure data-paths (NDP) in the system
- optional int32 max_concurrent_secure_ndp_in_system = 24;
-
- // maximum number of concurrent data-paths (NDP) per data-interface (NDI)
- optional int32 max_concurrent_ndp_per_ndi = 25;
-
- // histogram of durations of Aware being available
- repeated HistogramBucket histogram_aware_available_duration_ms = 26;
-
- // histogram of durations of Aware being enabled
- repeated HistogramBucket histogram_aware_enabled_duration_ms = 27;
-
- // histogram of duration (in ms) of attach sessions
- repeated HistogramBucket histogram_attach_duration_ms = 28;
-
- // histogram of duration (in ms) of publish sessions
- repeated HistogramBucket histogram_publish_session_duration_ms = 29;
-
- // histogram of duration (in ms) of subscribe sessions
- repeated HistogramBucket histogram_subscribe_session_duration_ms = 30;
-
- // histogram of duration (in ms) of data-paths (NDP)
- repeated HistogramBucket histogram_ndp_session_duration_ms = 31;
-
- // histogram of usage (in MB) of data-paths (NDP)
- repeated HistogramBucket histogram_ndp_session_data_usage_mb = 32;
-
- // histogram of usage (in MB) of data-path creation time (in ms) measured as request -> confirm
- repeated HistogramBucket histogram_ndp_creation_time_ms = 33;
-
- // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: minimum
- optional int64 ndp_creation_time_ms_min = 34;
-
- // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: maximum
- optional int64 ndp_creation_time_ms_max = 35;
-
- // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: sum
- optional int64 ndp_creation_time_ms_sum = 36;
-
- // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: sum of sq
- optional int64 ndp_creation_time_ms_sum_of_sq = 37;
-
- // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: number of
- // samples
- optional int64 ndp_creation_time_ms_num_samples = 38;
-
- // total time within the logging window that aware was available
- optional int64 available_time_ms = 39;
-
- // total time within the logging window that aware was enabled
- optional int64 enabled_time_ms = 40;
-
- // maximum number of concurrent publish sessions enabling ranging in a single app
- optional int32 max_concurrent_publish_with_ranging_in_app = 41;
-
- // maximum number of concurrent subscribe sessions specifying a geofence in a single app
- optional int32 max_concurrent_subscribe_with_ranging_in_app = 42;
-
- // maximum number of concurrent publish sessions enabling ranging in the system
- optional int32 max_concurrent_publish_with_ranging_in_system = 43;
-
- // maximum number of concurrent subscribe sessions specifying a geofence in the system
- optional int32 max_concurrent_subscribe_with_ranging_in_system = 44;
-
- // histogram of subscribe session geofence minimum (only when specified)
- repeated HistogramBucket histogram_subscribe_geofence_min = 45;
-
- // histogram of subscribe session geofence maximum (only when specified)
- repeated HistogramBucket histogram_subscribe_geofence_max = 46;
-
- // total number of subscribe sessions which enabled ranging
- optional int32 num_subscribes_with_ranging = 47;
-
- // total number of matches (service discovery indication) with ranging provided
- optional int32 num_matches_with_ranging = 48;
-
- // total number of matches (service discovery indication) for service discovery with ranging
- // enabled which did not trigger ranging
- optional int32 num_matches_without_ranging_for_ranging_enabled_subscribes = 49;
-
- // Histogram bucket for Wi-Fi Aware logs. Range is [start, end)
- message HistogramBucket {
- // lower range of the bucket (inclusive)
- optional int64 start = 1;
-
- // upper range of the bucket (exclusive)
- optional int64 end = 2;
-
- // number of samples in the bucket
- optional int32 count = 3;
- }
-
- // Status of various NAN operations
- enum NanStatusTypeEnum {
- // constant to be used by proto
- UNKNOWN = 0;
-
- // NAN operation succeeded
- SUCCESS = 1;
-
- // NAN Discovery Engine/Host driver failures
- INTERNAL_FAILURE = 2;
-
- // NAN OTA failures
- PROTOCOL_FAILURE = 3;
-
- // The publish/subscribe discovery session id is invalid
- INVALID_SESSION_ID = 4;
-
- // Out of resources to fufill request
- NO_RESOURCES_AVAILABLE = 5;
-
- // Invalid arguments passed
- INVALID_ARGS = 6;
-
- // Invalid peer id
- INVALID_PEER_ID = 7;
-
- // Invalid NAN data-path (ndp) id
- INVALID_NDP_ID = 8;
-
- // Attempting to enable NAN when not available, e.g. wifi is disabled
- NAN_NOT_ALLOWED = 9;
-
- // Over the air ACK not received
- NO_OTA_ACK = 10;
-
- // Attempting to enable NAN when already enabled
- ALREADY_ENABLED = 11;
-
- // Can't queue tx followup message foor transmission
- FOLLOWUP_TX_QUEUE_FULL = 12;
-
- // Unsupported concurrency of NAN and another feature - NAN disabled
- UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 13;
-
- // Unknown NanStatusType
- UNKNOWN_HAL_STATUS = 14;
- }
-
- // Histogram bucket for Wi-Fi Aware (NAN) status.
- message NanStatusHistogramBucket {
- // status type defining the bucket
- optional NanStatusTypeEnum nan_status_type = 1;
-
- // number of samples in the bucket
- optional int32 count = 2;
- }
-}
-
-// Data point used to build 'Number of Connectable Network' histograms
-message NumConnectableNetworksBucket {
- // Number of connectable networks seen in a scan result
- optional int32 num_connectable_networks = 1 [default = 0];
-
- // Number of scan results with num_connectable_networks
- optional int32 count = 2 [default = 0];
-}
-
-// Pno scan metrics
-// Here "Pno Scan" refers to the session of offloaded scans, these metrics count the result of a
-// single session, and not the individual scans within that session.
-message PnoScanMetrics {
- // Total number of attempts to offload pno scans
- optional int32 num_pno_scan_attempts = 1;
-
- // Total number of pno scans failed
- optional int32 num_pno_scan_failed = 2;
-
- // Number of pno scans started successfully over offload
- optional int32 num_pno_scan_started_over_offload = 3;
-
- // Number of pno scans failed over offload
- optional int32 num_pno_scan_failed_over_offload = 4;
-
- // Total number of pno scans that found any network
- optional int32 num_pno_found_network_events = 5;
-}
-
-// Number of occurrences for a particular "Connect to Network" Notification or
-// notification Action.
-message ConnectToNetworkNotificationAndActionCount {
-
- // "Connect to Network" notifications
- enum Notification {
-
- // Default
- NOTIFICATION_UNKNOWN = 0;
-
- // Initial notification with a recommended network.
- NOTIFICATION_RECOMMEND_NETWORK = 1;
-
- // Notification when connecting to the recommended network.
- NOTIFICATION_CONNECTING_TO_NETWORK = 2;
-
- // Notification when successfully connected to the network.
- NOTIFICATION_CONNECTED_TO_NETWORK = 3;
-
- // Notification when failed to connect to network.
- NOTIFICATION_FAILED_TO_CONNECT = 4;
- }
-
- // "Connect to Network" notification actions
- enum Action {
-
- // Default
- ACTION_UNKNOWN = 0;
-
- // User dismissed the "Connect to Network" notification.
- ACTION_USER_DISMISSED_NOTIFICATION = 1;
-
- // User tapped action button to connect to recommended network.
- ACTION_CONNECT_TO_NETWORK = 2;
-
- // User tapped action button to open Wi-Fi Settings.
- ACTION_PICK_WIFI_NETWORK = 3;
-
- // User tapped "Failed to connect" notification to open Wi-Fi Settings.
- ACTION_PICK_WIFI_NETWORK_AFTER_CONNECT_FAILURE = 4;
- }
-
- // Recommenders of the "Connect to Network" notification
- enum Recommender {
-
- // Default.
- RECOMMENDER_UNKNOWN = 0;
-
- // Open Network Available recommender.
- RECOMMENDER_OPEN = 1;
- }
-
- // Notification Type.
- optional Notification notification = 1;
-
- // Action Type.
- optional Action action = 2;
-
- // Recommender Type.
- optional Recommender recommender = 3;
-
- // Occurrences of this action.
- optional int32 count = 4;
-}
-
-// SoftAP event tracking sessions and client counts
-message SoftApConnectedClientsEvent {
-
- // Soft AP event Types
- enum SoftApEventType {
-
- // Soft AP is Up and ready for use
- SOFT_AP_UP = 0;
-
- // Soft AP is Down
- SOFT_AP_DOWN = 1;
-
- // Number of connected soft AP clients has changed
- NUM_CLIENTS_CHANGED = 2;
- }
-
- // Soft AP channel bandwidth types
- enum ChannelBandwidth {
-
- BANDWIDTH_INVALID = 0;
-
- BANDWIDTH_20_NOHT = 1;
-
- BANDWIDTH_20 = 2;
-
- BANDWIDTH_40 = 3;
-
- BANDWIDTH_80 = 4;
-
- BANDWIDTH_80P80 = 5;
-
- BANDWIDTH_160 = 6;
- }
-
- // Type of event being recorded
- optional SoftApEventType event_type = 1;
-
- // Time passed since last boot in milliseconds
- optional int64 time_stamp_millis = 2;
-
- // Number of connected clients if event_type is NUM_CLIENTS_CHANGED, otherwise zero.
- optional int32 num_connected_clients = 3;
-
- // Channel frequency used for Soft AP
- optional int32 channel_frequency = 4;
-
- // Channel bandwidth used for Soft AP
- optional ChannelBandwidth channel_bandwidth = 5;
-}
-
-// Wps connection metrics
-// Keeps track of Wi-Fi Protected Setup usage
-message WpsMetrics {
- // Total number of wps connection attempts
- optional int32 num_wps_attempts = 1;
-
- // Total number of wps connection successes
- optional int32 num_wps_success = 2;
-
- // Total number of wps failures on start
- optional int32 num_wps_start_failure = 3;
-
- // Total number of wps overlap failure
- optional int32 num_wps_overlap_failure = 4;
-
- // Total number of wps timeout failure
- optional int32 num_wps_timeout_failure = 5;
-
- // Total number of other wps failure during connection
- optional int32 num_wps_other_connection_failure = 6;
-
- // Total number of supplicant failure after wps
- optional int32 num_wps_supplicant_failure = 7;
-
- // Total number of wps cancellation
- optional int32 num_wps_cancellation = 8;
-}
-
-// Power stats for Wifi
-message WifiPowerStats {
-
- // Duration of log (ms)
- optional int64 logging_duration_ms = 1;
-
- // Energy consumed by wifi (mAh)
- optional double energy_consumed_mah = 2;
-
- // Amount of time wifi is in idle (ms)
- optional int64 idle_time_ms = 3;
-
- // Amount of time wifi is in rx (ms)
- optional int64 rx_time_ms = 4;
-
- // Amount of time wifi is in tx (ms)
- optional int64 tx_time_ms = 5;
-
- // Amount of time kernel is active because of wifi data (ms)
- optional int64 wifi_kernel_active_time_ms = 6;
-
- // Number of packets sent (tx)
- optional int64 num_packets_tx = 7;
-
- // Number of bytes sent (tx)
- optional int64 num_bytes_tx = 8;
-
- // Number of packets received (rx)
- optional int64 num_packets_rx = 9;
-
- // Number of bytes sent (rx)
- optional int64 num_bytes_rx = 10;
-
- // Amount of time wifi is in sleep (ms)
- optional int64 sleep_time_ms = 11;
-
- // Amount of time wifi is scanning (ms)
- optional int64 scan_time_ms = 12;
-
- // Actual monitored rail energy consumed by wifi (mAh)
- optional double monitored_rail_energy_consumed_mah = 13;
-}
-
-// Metrics for Wifi Wake
-message WifiWakeStats {
- // An individual session for Wifi Wake
- message Session {
- // A Wifi Wake lifecycle event
- message Event {
- // Elapsed time in milliseconds since start of session.
- optional int64 elapsed_time_millis = 1;
-
- // Number of scans that have occurred since start of session.
- optional int32 elapsed_scans = 2;
- }
-
- // Start time of session in milliseconds.
- optional int64 start_time_millis = 1;
-
- // The number of networks the lock was provided with at start.
- optional int32 locked_networks_at_start = 2;
-
- // The number of networks in the lock at the time of the initialize event. Only valid if
- // initialize_event is recorded.
- optional int32 locked_networks_at_initialize = 6;
-
- // Event for fully initializing the WakeupLock (i.e. WakeupLock is "locked").
- optional Event initialize_event = 7;
-
- // Event for unlocking the WakeupLock. Does not occur if lock was initialized with 0 networks.
- optional Event unlock_event = 3;
-
- // Event for triggering wakeup.
- optional Event wakeup_event = 4;
-
- // Event for WifiWake reset event. This event marks the end of a session.
- optional Event reset_event = 5;
- }
-
- // Total number of sessions for Wifi Wake.
- optional int32 num_sessions = 1;
-
- // Session information for every Wifi Wake session (up to a maximum of 10).
- repeated Session sessions = 2;
-
- // Number of ignored calls to start (due to WakeupController already being active).
- optional int32 num_ignored_starts = 3;
-
- // Number of Wifi Wake sessions that have recorded wakeup events.
- optional int32 num_wakeups = 4;
-}
-
-// Metrics for Wi-Fi RTT
-message WifiRttLog {
- // Number of RTT request API calls
- optional int32 num_requests = 1;
-
- // Histogram of RTT operation overall status
- repeated RttOverallStatusHistogramBucket histogram_overall_status = 2;
-
- // RTT to Access Points metrics
- optional RttToPeerLog rtt_to_ap = 3;
-
- // RTT to Wi-Fi Aware peers metrics
- optional RttToPeerLog rtt_to_aware = 4;
-
- // Metrics for a RTT to Peer (peer = AP or Wi-Fi Aware)
- message RttToPeerLog {
- // Total number of API calls
- optional int32 num_requests = 1;
-
- // Total number of individual requests
- optional int32 num_individual_requests = 2;
-
- // Total number of apps which requested RTT
- optional int32 num_apps = 3;
-
- // Histogram of total number of RTT requests by an app (WifiRttManager#startRanging)
- repeated HistogramBucket histogram_num_requests_per_app = 4;
-
- // Histogram of number of peers in a single RTT request (RangingRequest entries)
- repeated HistogramBucket histogram_num_peers_per_request = 5;
-
- // Histogram of status of individual RTT operations (RangingResult entries)
- repeated RttIndividualStatusHistogramBucket histogram_individual_status = 6;
-
- // Histogram of measured distances (RangingResult entries)
- repeated HistogramBucket histogram_distance = 7;
-
- // Histogram of interval of RTT requests by an app (WifiRttManager#startRanging)
- repeated HistogramBucket histogram_request_interval_ms = 8;
- }
-
- // Histogram bucket for Wi-Fi RTT logs. Range is [start, end)
- message HistogramBucket {
- // lower range of the bucket (inclusive)
- optional int64 start = 1;
-
- // upper range of the bucket (exclusive)
- optional int64 end = 2;
-
- // number of samples in the bucket
- optional int32 count = 3;
- }
-
- // Status codes for overall RTT operation
- enum RttOverallStatusTypeEnum {
- // constant to be used by proto
- OVERALL_UNKNOWN = 0;
-
- // RTT operation succeeded (individual results may still fail)
- OVERALL_SUCCESS = 1;
-
- // RTT operation failed (unspecified reason)
- OVERALL_FAIL = 2;
-
- // RTT operation failed since RTT was not available (e.g. Airplane mode)
- OVERALL_RTT_NOT_AVAILABLE = 3;
-
- // RTT operation timed-out: didn't receive response from HAL in expected time
- OVERALL_TIMEOUT = 4;
-
- // RTT operation aborted since the app is spamming the service
- OVERALL_THROTTLE = 5;
-
- // RTT request to HAL received immediate failure
- OVERALL_HAL_FAILURE = 6;
-
- // RTT to Wi-Fi Aware peer using PeerHandle failed to get a MAC address translation
- OVERALL_AWARE_TRANSLATION_FAILURE = 7;
-
- // RTT operation failed due to missing Location permission (post execution)
- OVERALL_LOCATION_PERMISSION_MISSING = 8;
- }
-
- // Status codes for individual RTT operation
- enum RttIndividualStatusTypeEnum {
- // constant to be used by proto
- UNKNOWN = 0;
-
- // RTT operation succeeded
- SUCCESS = 1;
-
- // RTT failure: generic reason (no further information)
- FAILURE = 2;
-
- // Target STA does not respond to request
- FAIL_NO_RSP = 3;
-
- // Request rejected. Applies to 2-sided RTT only
- FAIL_REJECTED = 4;
-
- // Operation not scheduled
- FAIL_NOT_SCHEDULED_YET = 5;
-
- // Timing measurement times out
- FAIL_TM_TIMEOUT = 6;
-
- // Target on different channel, cannot range
- FAIL_AP_ON_DIFF_CHANNEL = 7;
-
- // Ranging not supported
- FAIL_NO_CAPABILITY = 8;
-
- // Request aborted for unknown reason
- ABORTED = 9;
-
- // Invalid T1-T4 timestamp
- FAIL_INVALID_TS = 10;
-
- // 11mc protocol failed
- FAIL_PROTOCOL = 11;
-
- // Request could not be scheduled
- FAIL_SCHEDULE = 12;
-
- // Responder cannot collaborate at time of request
- FAIL_BUSY_TRY_LATER = 13;
-
- // Bad request args
- INVALID_REQ = 14;
-
- // WiFi not enabled
- NO_WIFI = 15;
-
- // Responder overrides param info, cannot range with new params
- FAIL_FTM_PARAM_OVERRIDE = 16;
-
- // HAL did not provide a result to a framework request
- MISSING_RESULT = 17;
- }
-
- // Histogram bucket for Wi-Fi RTT overall operation status
- message RttOverallStatusHistogramBucket {
- // status type defining the bucket
- optional RttOverallStatusTypeEnum status_type = 1;
-
- // number of samples in the bucket
- optional int32 count = 2;
- }
-
- // Histogram bucket for Wi-Fi RTT individual operation status
- message RttIndividualStatusHistogramBucket {
- // status type defining the bucket
- optional RttIndividualStatusTypeEnum status_type = 1;
-
- // number of samples in the bucket
- optional int32 count = 2;
- }
-}
-
-// Usage data for the wifi radio while device is running on battery.
-message WifiRadioUsage {
- // Duration of log (ms)
- optional int64 logging_duration_ms = 1;
-
- // Total time for which the radio is awake due to scan.
- optional int64 scan_time_ms = 2;
-}
-
-message ExperimentValues {
- // Indicates if we are logging WifiIsUnusableEvent in metrics
- optional bool wifi_is_unusable_logging_enabled = 1;
-
- // Minimum number of txBad to trigger a data stall
- optional int32 wifi_data_stall_min_tx_bad = 2;
-
- // Minimum number of txSuccess to trigger a data stall
- // when rxSuccess is 0
- optional int32 wifi_data_stall_min_tx_success_without_rx = 3;
-
- // Indicates if we are logging LinkSpeedCount in metrics
- optional bool link_speed_counts_logging_enabled = 4;
-
- // Duration for evaluating Wifi condition to trigger a data stall
- // measured in milliseconds
- optional int32 data_stall_duration_ms = 5;
-
- // Threshold of Tx throughput below which to trigger a data stall
- // measured in Kbps
- optional int32 data_stall_tx_tput_thr_kbps = 6;
-
- // Threshold of Rx throughput below which to trigger a data stall
- // measured in Kbps
- optional int32 data_stall_rx_tput_thr_kbps = 7;
-
- // Threshold of Tx packet error rate above which to trigger a data stall
- // in percentage
- optional int32 data_stall_tx_per_thr = 8;
-
- // Threshold of CCA level above which to trigger a data stall in percentage
- optional int32 data_stall_cca_level_thr = 9;
-}
-
-message WifiIsUnusableEvent {
- enum TriggerType {
- // Default/Invalid event
- TYPE_UNKNOWN = 0;
-
- // There is a data stall from tx failures
- TYPE_DATA_STALL_BAD_TX = 1;
-
- // There is a data stall from rx failures
- TYPE_DATA_STALL_TX_WITHOUT_RX = 2;
-
- // There is a data stall from both tx and rx failures
- TYPE_DATA_STALL_BOTH = 3;
-
- // Firmware generated an alert
- TYPE_FIRMWARE_ALERT = 4;
-
- // IP Manager lost reachability to network neighbors
- TYPE_IP_REACHABILITY_LOST = 5;
- }
-
- // What event triggered WifiIsUnusableEvent.
- optional TriggerType type = 1;
-
- // The timestamp at which this event occurred.
- // Measured in milliseconds that have elapsed since the device booted.
- optional int64 start_time_millis = 2;
-
- // NetworkAgent score of connected wifi.
- // Defaults to -1 if the score was never set.
- optional int32 last_score = 3 [default = -1];
-
- // Delta of successfully transmitted (ACKed) unicast data packets
- // between the last two WifiLinkLayerStats.
- optional int64 tx_success_delta = 4;
-
- // Delta of transmitted unicast data retry packets
- // between the last two WifiLinkLayerStats.
- optional int64 tx_retries_delta = 5;
-
- // Delta of lost (not ACKed) transmitted unicast data packets
- // between the last two WifiLinkLayerStats.
- optional int64 tx_bad_delta = 6;
-
- // Delta of received unicast data packets
- // between the last two WifiLinkLayerStats.
- optional int64 rx_success_delta = 7;
-
- // Time in millisecond between the last two WifiLinkLayerStats.
- optional int64 packet_update_time_delta = 8;
-
- // The timestamp at which the last WifiLinkLayerStats was updated.
- // Measured in milliseconds that have elapsed since the device booted.
- optional int64 last_link_layer_stats_update_time = 9;
-
- // Firmware alert code. Only valid when the event was triggered by a firmware alert, otherwise -1.
- optional int32 firmware_alert_code = 10 [default = -1];
-
- // NetworkAgent wifi usability score of connected wifi.
- // Defaults to -1 if the score was never set.
- optional int32 last_wifi_usability_score = 11 [default = -1];
-
- // Prediction horizon (in second) of Wifi usability score provided by external
- // system app
- optional int32 last_prediction_horizon_sec = 12 [default = -1];
-
- // Whether screen status is on when WifiIsUnusableEvent happens.
- optional bool screen_on = 13 [default = false];
-}
-
-message PasspointProfileTypeCount {
- enum EapMethod {
- // Unknown Type
- TYPE_UNKNOWN = 0;
-
- // EAP_TLS (13)
- TYPE_EAP_TLS = 1;
-
- // EAP_TTLS (21)
- TYPE_EAP_TTLS = 2;
-
- // EAP_SIM (18)
- TYPE_EAP_SIM = 3;
-
- // EAP_AKA (23)
- TYPE_EAP_AKA = 4;
-
- // EAP_AKA_PRIME (50)
- TYPE_EAP_AKA_PRIME = 5;
- }
-
- // Eap method type set in Passpoint profile
- optional EapMethod eap_method_type = 1;
-
- // Num of installed Passpoint profile with same eap method
- optional int32 count = 2;
-}
-
-message WifiLinkLayerUsageStats {
- // Total logging duration in ms.
- optional int64 logging_duration_ms = 1;
-
- // Total time the wifi radio is on in ms over the logging duration.
- optional int64 radio_on_time_ms = 2;
-
- // Total time the wifi radio is doing tx in ms over the logging duration.
- optional int64 radio_tx_time_ms = 3;
-
- // Total time the wifi radio is doing rx in ms over the logging duration.
- optional int64 radio_rx_time_ms = 4;
-
- // Total time the wifi radio is scanning in ms over the logging duration.
- optional int64 radio_scan_time_ms = 5;
-
- // Total time the wifi radio spent doing nan scans in ms over the logging duration.
- optional int64 radio_nan_scan_time_ms = 6;
-
- // Total time the wifi radio spent doing background scans in ms over the logging duration.
- optional int64 radio_background_scan_time_ms = 7;
-
- // Total time the wifi radio spent doing roam scans in ms over the logging duration.
- optional int64 radio_roam_scan_time_ms = 8;
-
- // Total time the wifi radio spent doing pno scans in ms over the logging duration.
- optional int64 radio_pno_scan_time_ms = 9;
-
- // Total time the wifi radio spent doing hotspot 2.0 scans and GAS exchange
- // in ms over the logging duration.
- optional int64 radio_hs20_scan_time_ms = 10;
-}
-
-message WifiUsabilityStatsEntry {
- // Status codes for link probe status
- enum LinkProbeStatus {
- // Link probe status is unknown
- PROBE_STATUS_UNKNOWN = 0;
-
- // Link probe is not triggered
- PROBE_STATUS_NO_PROBE = 1;
-
- // Link probe is triggered and the result is success
- PROBE_STATUS_SUCCESS = 2;
-
- // Link probe is triggered and the result is failure
- PROBE_STATUS_FAILURE = 3;
- }
-
- // Codes for cellular data network type
- enum CellularDataNetworkType {
- // Unknown network
- NETWORK_TYPE_UNKNOWN = 0;
-
- // GSM network
- NETWORK_TYPE_GSM = 1;
-
- // CDMA network
- NETWORK_TYPE_CDMA = 2;
-
- // CDMA EVDO network
- NETWORK_TYPE_EVDO_0 = 3;
-
- // WCDMA network
- NETWORK_TYPE_UMTS = 4;
-
- // TDSCDMA network
- NETWORK_TYPE_TD_SCDMA = 5;
-
- // LTE network
- NETWORK_TYPE_LTE = 6;
-
- // NR network
- NETWORK_TYPE_NR = 7;
- }
-
- // Absolute milliseconds from device boot when these stats were sampled
- optional int64 time_stamp_ms = 1;
-
- // The RSSI at the sample time
- optional int32 rssi = 2;
-
- // Link speed at the sample time in Mbps
- optional int32 link_speed_mbps = 3;
-
- // The total number of tx success counted from the last radio chip reset
- optional int64 total_tx_success = 4;
-
- // The total number of MPDU data packet retries counted from the last radio chip reset
- optional int64 total_tx_retries = 5;
-
- // The total number of tx bad counted from the last radio chip reset
- optional int64 total_tx_bad = 6;
-
- // The total number of rx success counted from the last radio chip reset
- optional int64 total_rx_success = 7;
-
- // The total time the wifi radio is on in ms counted from the last radio chip reset
- optional int64 total_radio_on_time_ms = 8;
-
- // The total time the wifi radio is doing tx in ms counted from the last radio chip reset
- optional int64 total_radio_tx_time_ms = 9;
-
- // The total time the wifi radio is doing rx in ms counted from the last radio chip reset
- optional int64 total_radio_rx_time_ms = 10;
-
- // The total time spent on all types of scans in ms counted from the last radio chip reset
- optional int64 total_scan_time_ms = 11;
-
- // The total time spent on nan scans in ms counted from the last radio chip reset
- optional int64 total_nan_scan_time_ms = 12;
-
- // The total time spent on background scans in ms counted from the last radio chip reset
- optional int64 total_background_scan_time_ms = 13;
-
- // The total time spent on roam scans in ms counted from the last radio chip reset
- optional int64 total_roam_scan_time_ms = 14;
-
- // The total time spent on pno scans in ms counted from the last radio chip reset
- optional int64 total_pno_scan_time_ms = 15;
-
- // The total time spent on hotspot2.0 scans and GAS exchange in ms counted from the last radio
- // chip reset
- optional int64 total_hotspot_2_scan_time_ms = 16;
-
- // Internal framework Wifi score
- optional int32 wifi_score = 17;
-
- // Wifi usability score provided by external system app
- optional int32 wifi_usability_score = 18;
-
- // Sequence number from external system app to framework
- optional int32 seq_num_to_framework = 19;
-
- // The total time CCA is on busy status on the current frequency in ms
- // counted from the last radio chip reset
- optional int64 total_cca_busy_freq_time_ms = 20;
-
- // The total radio on time of the current frequency from the last radio
- // chip reset
- optional int64 total_radio_on_freq_time_ms = 21;
-
- // The total number of beacons received from the last radio chip reset
- optional int64 total_beacon_rx = 22;
-
- // Prediction horizon (in second) of Wifi usability score provided by external
- // system app
- optional int32 prediction_horizon_sec = 23;
-
- // The link probe status since last stats update
- optional LinkProbeStatus probe_status_since_last_update = 24;
-
- // The elapsed time of the most recent link probe since last stats update;
- optional int32 probe_elapsed_time_since_last_update_ms = 25;
-
- // The MCS rate of the most recent link probe since last stats update
- optional int32 probe_mcs_rate_since_last_update = 26;
-
- // Rx link speed at the sample time in Mbps
- optional int32 rx_link_speed_mbps = 27;
-
- // Sequence number generated by framework
- optional int32 seq_num_inside_framework = 28;
-
- // Whether current entry is for the same BSSID on the same frequency compared
- // to last entry
- optional bool is_same_bssid_and_freq = 29;
-
- // Cellular data network type currently in use on the device for data transmission
- optional CellularDataNetworkType cellular_data_network_type = 30;
-
- // Cellular signal strength in dBm, NR: CsiRsrp, LTE: Rsrp, WCDMA/TDSCDMA: Rscp,
- // CDMA: Rssi, EVDO: Rssi, GSM: Rssi
- optional int32 cellular_signal_strength_dbm = 31;
-
- // Cellular signal strength in dB, NR: CsiSinr, LTE: Rsrq, WCDMA: EcNo, TDSCDMA: invalid,
- // CDMA: Ecio, EVDO: SNR, GSM: invalid */
- optional int32 cellular_signal_strength_db = 32;
-
- // Whether the primary registered cell of current entry is same as that of previous entry
- optional bool is_same_registered_cell = 33;
-
- // The device mobility state
- optional DeviceMobilityStatePnoScanStats.DeviceMobilityState
- device_mobility_state = 34;
-}
-
-message WifiUsabilityStats {
- enum Label {
- // Default label
- LABEL_UNKNOWN = 0;
-
- // Wifi is usable
- LABEL_GOOD = 1;
-
- // Wifi is unusable
- LABEL_BAD = 2;
- }
-
- enum UsabilityStatsTriggerType {
- // Default/Invalid event
- TYPE_UNKNOWN = 0;
-
- // There is a data stall from tx failures
- TYPE_DATA_STALL_BAD_TX = 1;
-
- // There is a data stall from rx failures
- TYPE_DATA_STALL_TX_WITHOUT_RX = 2;
-
- // There is a data stall from both tx and rx failures
- TYPE_DATA_STALL_BOTH = 3;
-
- // Firmware generated an alert
- TYPE_FIRMWARE_ALERT = 4;
-
- // IP Manager lost reachability to network neighbors
- TYPE_IP_REACHABILITY_LOST = 5;
- }
-
- // The current wifi usability state
- optional Label label = 1;
-
- // The list of timestamped wifi usability stats
- repeated WifiUsabilityStatsEntry stats = 2;
-
- // What event triggered WifiUsabilityStats.
- optional UsabilityStatsTriggerType trigger_type = 3;
-
- // Firmware alert code. Only valid when the stats was triggered by a firmware
- // alert, otherwise -1.
- optional int32 firmware_alert_code = 4 [default = -1];
-
- // Absolute milliseconds from device boot when these stats were sampled
- optional int64 time_stamp_ms = 5;
-}
-
-message DeviceMobilityStatePnoScanStats {
- // see WifiManager.DEVICE_MOBILITY_STATE_* constants
- enum DeviceMobilityState {
- // Unknown mobility
- UNKNOWN = 0;
-
- // High movement
- HIGH_MVMT = 1;
-
- // Low movement
- LOW_MVMT = 2;
-
- // Stationary
- STATIONARY = 3;
- }
-
- // The device mobility state
- optional DeviceMobilityState device_mobility_state = 1;
-
- // The number of times that this state was entered
- optional int32 num_times_entered_state = 2;
-
- // The total duration elapsed while in this mobility state, in ms
- optional int64 total_duration_ms = 3;
-
- // the total duration elapsed while in this mobility state with PNO scans running, in ms
- optional int64 pno_duration_ms = 4;
-}
-
-// The information about the Wifi P2p events.
-message WifiP2pStats {
-
- // Group event list tracking sessions and client counts in tethered mode.
- repeated GroupEvent group_event = 1;
-
- // Session information that gets logged for every Wifi P2p connection.
- repeated P2pConnectionEvent connection_event = 2;
-
- // Number of persistent group in the user profile.
- optional int32 num_persistent_group = 3;
-
- // Number of peer scan.
- optional int32 num_total_peer_scans = 4;
-
- // Number of service scan.
- optional int32 num_total_service_scans = 5;
-}
-
-message P2pConnectionEvent {
-
- enum ConnectionType {
-
- // fresh new connection.
- CONNECTION_FRESH = 0;
-
- // reinvoke a group.
- CONNECTION_REINVOKE = 1;
-
- // create a group with the current device as the group owner locally.
- CONNECTION_LOCAL = 2;
-
- // create a group or join a group with config.
- CONNECTION_FAST = 3;
- }
-
- enum ConnectivityLevelFailure {
-
- // Failure is unknown.
- CLF_UNKNOWN = 0;
-
- // No failure.
- CLF_NONE = 1;
-
- // Timeout for current connecting request.
- CLF_TIMEOUT = 2;
-
- // The connecting request is canceled by the user.
- CLF_CANCEL = 3;
-
- // Provision discovery failure, e.g. no pin code, timeout, rejected by the peer.
- CLF_PROV_DISC_FAIL = 4;
-
- // Invitation failure, e.g. rejected by the peer.
- CLF_INVITATION_FAIL = 5;
-
- // Incoming request is rejected by the user.
- CLF_USER_REJECT = 6;
-
- // New connection request is issued before ending previous connecting request.
- CLF_NEW_CONNECTION_ATTEMPT = 7;
- }
-
- // WPS method.
- enum WpsMethod {
- // WPS is skipped for Group Reinvoke.
- WPS_NA = -1;
-
- // Push button configuration.
- WPS_PBC = 0;
-
- // Display pin method configuration - pin is generated and displayed on device.
- WPS_DISPLAY = 1;
-
- // Keypad pin method configuration - pin is entered on device.
- WPS_KEYPAD = 2;
-
- // Label pin method configuration - pin is labelled on device.
- WPS_LABEL = 3;
- }
-
- // Start time of the connection.
- optional int64 start_time_millis = 1;
-
- // Type of the connection.
- optional ConnectionType connection_type = 2;
-
- // WPS method.
- optional WpsMethod wps_method = 3 [default = WPS_NA];
-
- // Duration to connect.
- optional int32 duration_taken_to_connect_millis = 4;
-
- // Failures that happen at the connectivity layer.
- optional ConnectivityLevelFailure connectivity_level_failure_code = 5;
-}
-
-// GroupEvent tracking group information from GroupStarted to GroupRemoved.
-message GroupEvent {
-
- enum GroupRole {
-
- GROUP_OWNER = 0;
-
- GROUP_CLIENT = 1;
- }
-
- // The ID of network in supplicant for this group.
- optional int32 net_id = 1;
-
- // Start time of the group.
- optional int64 start_time_millis = 2;
-
- // Channel frequency used for Group.
- optional int32 channel_frequency = 3;
-
- // Is group owner or group client.
- optional GroupRole group_role = 5;
-
- // Number of connected clients.
- optional int32 num_connected_clients = 6;
-
- // Cumulative number of connected clients.
- optional int32 num_cumulative_clients = 7;
-
- // The session duration.
- optional int32 session_duration_millis = 8;
-
- // The idle duration. A group without any client is in idle.
- optional int32 idle_duration_millis = 9;
-}
-
-// Easy Connect (DPP)
-message WifiDppLog {
- reserved 6;
-
- // Number of Configurator-Initiator requests
- optional int32 num_dpp_configurator_initiator_requests = 1;
-
- // Number of Enrollee-Initiator requests
- optional int32 num_dpp_enrollee_initiator_requests = 2;
-
- // Easy Connect (DPP) Enrollee success
- optional int32 num_dpp_enrollee_success = 3;
-
- // Easy Connect (DPP) Configurator success code bucket
- repeated DppConfiguratorSuccessStatusHistogramBucket dpp_configurator_success_code = 4;
-
- // Easy Connect (DPP) failure code bucket
- repeated DppFailureStatusHistogramBucket dpp_failure_code = 5;
-
- // Easy Connect (DPP) operation time bucket
- repeated HistogramBucketInt32 dpp_operation_time = 7;
-
- // Histogram bucket for Wi-Fi DPP configurator success
- message DppConfiguratorSuccessStatusHistogramBucket {
- // status type defining the bucket
- optional DppConfiguratorSuccessCode dpp_status_type = 1;
-
- // number of samples in the bucket
- optional int32 count = 2;
- }
-
- // Histogram bucket for Wi-Fi DPP failures
- message DppFailureStatusHistogramBucket {
- // status type defining the bucket
- optional DppFailureCode dpp_status_type = 1;
-
- // number of samples in the bucket
- optional int32 count = 2;
- }
-
- enum DppConfiguratorSuccessCode {
- // Unknown success code
- EASY_CONNECT_EVENT_SUCCESS_UNKNOWN = 0;
-
- // Easy Connect Configurator success event: Configuration sent to enrollee
- EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT = 1;
- }
-
- enum DppFailureCode {
- // Unknown failure
- EASY_CONNECT_EVENT_FAILURE_UNKNOWN = 0;
-
- // Easy Connect Failure event: Scanned QR code is either not a Easy Connect URI, or the Easy
- // Connect URI has errors.
- EASY_CONNECT_EVENT_FAILURE_INVALID_URI = 1;
-
- // Easy Connect Failure event: Bootstrapping/Authentication initialization process failure.
- EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION = 2;
-
- // Easy Connect Failure event: Both devices are implementing the same role and are
- // incompatible.
- EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE = 3;
-
- // Easy Connect Failure event: Configuration process has failed due to malformed message.
- EASY_CONNECT_EVENT_FAILURE_CONFIGURATION = 4;
-
- // Easy Connect Failure event: Easy Connect request while in another Easy Connect exchange.
- EASY_CONNECT_EVENT_FAILURE_BUSY = 5;
-
- // Easy Connect Failure event: No response from the peer.
- EASY_CONNECT_EVENT_FAILURE_TIMEOUT = 6;
-
- // Easy Connect Failure event: General protocol failure.
- EASY_CONNECT_EVENT_FAILURE_GENERIC = 7;
-
- // Easy Connect Failure event: Feature or option is not supported.
- EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED = 8;
-
- // Easy Connect Failure event: Invalid network provided to Easy Connect configurator.
- // Network must either be WPA3-Personal (SAE) or WPA2-Personal (PSK).
- EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK = 9;
- }
-}
-
-// WifiConfigStore read/write metrics.
-message WifiConfigStoreIO {
- // Histogram of config store read durations.
- repeated DurationBucket read_durations = 1;
-
- // Histogram of config store write durations.
- repeated DurationBucket write_durations = 2;
-
- // Total Number of instances of write/read duration in this duration bucket.
- message DurationBucket {
- // Bucket covers duration : [range_start_ms, range_end_ms)
- // The (inclusive) lower bound of read/write duration represented by this bucket
- optional int32 range_start_ms = 1;
-
- // The (exclusive) upper bound of read/write duration represented by this bucket
- optional int32 range_end_ms = 2;
-
- // Number of read/write durations that fit into this bucket
- optional int32 count = 3;
- }
-}
-
-// Histogram bucket counting with int32. Range is [start, end)
-message HistogramBucketInt32 {
- // lower range of the bucket (inclusive)
- optional int32 start = 1;
-
- // upper range of the bucket (exclusive)
- optional int32 end = 2;
-
- // number of samples in the bucket
- optional int32 count = 3;
-}
-
-// Counts occurrences of a int32 key
-message Int32Count {
- // the key
- optional int32 key = 1;
-
- // the count
- optional int32 count = 2;
-}
-
-message LinkProbeStats {
- enum LinkProbeFailureReason {
- // unknown reason
- LINK_PROBE_FAILURE_REASON_UNKNOWN = 0;
-
- // Specified MCS rate when it is unsupported by the driver.
- LINK_PROBE_FAILURE_REASON_MCS_UNSUPPORTED = 1;
-
- // Driver reported that no ACK was received for the transmitted probe.
- LINK_PROBE_FAILURE_REASON_NO_ACK = 2;
-
- // Driver failed to report on the status of the transmitted probe within the timeout.
- LINK_PROBE_FAILURE_REASON_TIMEOUT = 3;
-
- // An existing link probe is in progress.
- LINK_PROBE_FAILURE_REASON_ALREADY_STARTED = 4;
- }
-
- // Counts the number of failures for each failure reason.
- message LinkProbeFailureReasonCount {
- // The failure reason.
- optional LinkProbeFailureReason failure_reason = 1;
-
- // The number of occurrences for this failure reason.
- optional int32 count = 2;
- }
-
- // Counts the number of link probes for each experiment.
- message ExperimentProbeCounts {
- // The experiment ID.
- optional string experiment_id = 1;
-
- // The number of link probes triggered for this experiment.
- optional int32 probe_count = 2;
- }
-
- // Counts the occurrences of RSSI values when a link probe succeeds.
- repeated Int32Count success_rssi_counts = 1;
-
- // Counts the occurrences of RSSI values when a link probe fails.
- repeated Int32Count failure_rssi_counts = 2;
-
- // Counts the occurrences of Link Speed values when a link probe succeeds.
- repeated Int32Count success_link_speed_counts = 3;
-
- // Counts the occurrences of Link Speed values when a link probe fails.
- repeated Int32Count failure_link_speed_counts = 4;
-
- // Histogram for the number of seconds since the last TX success when a link probe succeeds.
- repeated HistogramBucketInt32 success_seconds_since_last_tx_success_histogram = 5;
-
- // Histogram for the number of seconds since the last TX success when a link probe fails.
- repeated HistogramBucketInt32 failure_seconds_since_last_tx_success_histogram = 6;
-
- // Histogram for the elapsed time of successful link probes, in ms.
- repeated HistogramBucketInt32 success_elapsed_time_ms_histogram = 7;
-
- // Counts the occurrences of error codes for failed link probes.
- repeated LinkProbeFailureReasonCount failure_reason_counts = 8;
-
- // Counts the number of link probes for each experiment.
- repeated ExperimentProbeCounts experiment_probe_counts = 9;
-}
-
-// Stores the decisions that were made by a experiment when compared against another experiment
-message NetworkSelectionExperimentDecisions {
- // the id of one experiment
- optional int32 experiment1_id = 1;
-
- // the id of the other experiment
- optional int32 experiment2_id = 2;
-
- // Counts occurrences of the number of network choices there were when experiment1 makes the
- // same network selection as experiment2.
- // The keys are the number of network choices, and the values are the number of occurrences of
- // this number of network choices when exp1 and exp2 make the same network selection.
- repeated Int32Count same_selection_num_choices_counter = 3;
-
- // Counts occurrences of the number of network choices there were when experiment1 makes the
- // same network selection as experiment2.
- // The keys are the number of network choices, and the values are the number of occurrences of
- // this number of network choices when exp1 and exp2 make different network selections.
- // Note that it is possible for the network selection to be different even when there only exists
- // a single network choice, since choosing not to connect to that network is a valid choice.
- repeated Int32Count different_selection_num_choices_counter = 4;
-}
-
-// NetworkRequest API metrics.
-message WifiNetworkRequestApiLog {
- // Number of requests via this API surface.
- optional int32 num_request = 1;
-
- // Histogram of requests via this API surface to number of networks matched in scan results.
- repeated HistogramBucketInt32 network_match_size_histogram = 2;
-
- // Number of successful network connection from this API.
- optional int32 num_connect_success = 3;
-
- // Number of requests via this API surface that bypassed user approval.
- optional int32 num_user_approval_bypass = 4;
-
- // Number of requests via this API surface that was rejected by the user.
- optional int32 num_user_reject = 5;
-
- // Number of unique apps using this API surface.
- optional int32 num_apps = 6;
-}
-
-// NetworkSuggestion API metrics.
-message WifiNetworkSuggestionApiLog {
- // Number of modifications to their suggestions by apps.
- optional int32 num_modification = 1;
-
- // Number of successful network connection from app suggestions.
- optional int32 num_connect_success = 2;
-
- // Number of network connection failures from app suggestions.
- optional int32 num_connect_failure = 3;
-
- // Histogram for size of the network lists provided by various apps on the device.
- repeated HistogramBucketInt32 network_list_size_histogram = 4;
-}
-
-// WifiLock metrics
-message WifiLockStats {
- // Amount of time wifi is actively in HIGH_PERF mode (ms)
- // This means the lock takes effect and the device takes the actions required for this mode
- optional int64 high_perf_active_time_ms = 1;
-
- // Amount of time wifi is actively in LOW_LATENCY mode (ms)
- // This means the lock takes effect and the device takes the actions required for this mode
- optional int64 low_latency_active_time_ms = 2;
-
- // Histogram of HIGH_PERF lock acquisition duration (seconds)
- // Note that acquiring the lock does not necessarily mean that device is actively in that mode
- repeated HistogramBucketInt32 high_perf_lock_acq_duration_sec_histogram = 3;
-
- // Histogram of LOW_LATENCY lock acquisition duration (seconds)
- // Note that acquiring the lock does not necessarily mean that device is actively in that mode
- repeated HistogramBucketInt32 low_latency_lock_acq_duration_sec_histogram = 4;
-
- // Histogram of HIGH_PERF active session duration (seconds)
- // This means the lock takes effect and the device takes the actions required for this mode
- repeated HistogramBucketInt32 high_perf_active_session_duration_sec_histogram = 5;
-
- // Histogram of LOW_LATENCY active session duration (seconds)
- // This means the lock takes effect and the device takes the actions required for this mode
- repeated HistogramBucketInt32 low_latency_active_session_duration_sec_histogram = 6;
-}
-
-// Stats on number of times Wi-Fi is turned on/off though the WifiManager#setWifiEnabled API
-message WifiToggleStats {
- // Number of time Wi-Fi is turned on by privileged apps
- optional int32 num_toggle_on_privileged = 1;
-
- // Number of time Wi-Fi is turned off by privileged apps
- optional int32 num_toggle_off_privileged = 2;
-
- // Number of time Wi-Fi is turned on by normal apps
- optional int32 num_toggle_on_normal = 3;
-
- // Number of time Wi-Fi is turned off by normal apps
- optional int32 num_toggle_off_normal = 4;
-}
-
-// Information about the Passpoint provision metrics.
-message PasspointProvisionStats {
- enum ProvisionFailureCode {
- // provisioning failure for unknown reason.
- OSU_FAILURE_UNKNOWN = 0;
-
- // The reason code for Provisioning Failure due to connection failure to OSU AP.
- OSU_FAILURE_AP_CONNECTION = 1;
-
- // The reason code for invalid server URL address.
- OSU_FAILURE_SERVER_URL_INVALID = 2;
-
- // The reason code for provisioning failure due to connection failure to the server.
- OSU_FAILURE_SERVER_CONNECTION = 3;
-
- // The reason code for provisioning failure due to invalid server certificate.
- OSU_FAILURE_SERVER_VALIDATION = 4;
-
- // The reason code for provisioning failure due to invalid service provider.
- OSU_FAILURE_SERVICE_PROVIDER_VERIFICATION = 5;
-
- // The reason code for provisioning failure when a provisioning flow is aborted.
- OSU_FAILURE_PROVISIONING_ABORTED = 6;
-
- // The reason code for provisioning failure when a provisioning flow is not possible.
- OSU_FAILURE_PROVISIONING_NOT_AVAILABLE = 7;
-
- // The reason code for provisioning failure due to invalid web url format for an OSU web page.
- OSU_FAILURE_INVALID_URL_FORMAT_FOR_OSU = 8;
-
- // The reason code for provisioning failure when a command received is not the expected command
- // type.
- OSU_FAILURE_UNEXPECTED_COMMAND_TYPE = 9;
-
- // The reason code for provisioning failure when a SOAP message is not the expected message
- // type.
- OSU_FAILURE_UNEXPECTED_SOAP_MESSAGE_TYPE = 10;
-
- // The reason code for provisioning failure when a SOAP message exchange fails.
- OSU_FAILURE_SOAP_MESSAGE_EXCHANGE = 11;
-
- // The reason code for provisioning failure when a redirect listener fails to start.
- OSU_FAILURE_START_REDIRECT_LISTENER = 12;
-
- // The reason code for provisioning failure when a redirect listener timed out to receive a HTTP
- // redirect response.
- OSU_FAILURE_TIMED_OUT_REDIRECT_LISTENER = 13;
-
- // The reason code for provisioning failure when there is no OSU activity to listen to intent.
- OSU_FAILURE_NO_OSU_ACTIVITY_FOUND = 14;
-
- // The reason code for provisioning failure when the status of a SOAP message is not the
- // expected message status.
- OSU_FAILURE_UNEXPECTED_SOAP_MESSAGE_STATUS = 15;
-
- // The reason code for provisioning failure when there is no PPS MO.
- OSU_FAILURE_NO_PPS_MO = 16;
-
- // The reason code for provisioning failure when there is no AAAServerTrustRoot node in a PPS
- // MO.
- OSU_FAILURE_NO_AAA_SERVER_TRUST_ROOT_NODE = 17;
-
- // The reason code for provisioning failure when there is no TrustRoot node for remediation
- // server in a PPS MO.
- OSU_FAILURE_NO_REMEDIATION_SERVER_TRUST_ROOT_NODE = 18;
-
- // The reason code for provisioning failure when there is no TrustRoot node for policy server in
- // a PPS MO.
- OSU_FAILURE_NO_POLICY_SERVER_TRUST_ROOT_NODE = 19;
-
- // The reason code for provisioning failure when failing to retrieve trust root certificates
- // used for validating server certificate for AAA, Remediation and Policy server.
- OSU_FAILURE_RETRIEVE_TRUST_ROOT_CERTIFICATES = 20;
-
- // The reason code for provisioning failure when there is no trust root certificate for AAA
- // server.
- OSU_FAILURE_NO_AAA_TRUST_ROOT_CERTIFICATE = 21;
-
- // The reason code for provisioning failure when a {@link PasspointConfiguration} is failed to
- // install.
- OSU_FAILURE_ADD_PASSPOINT_CONFIGURATION = 22;
-
- // The reason code for provisioning failure when an {@link OsuProvider} is not found for
- // provisioning.
- OSU_FAILURE_OSU_PROVIDER_NOT_FOUND = 23;
- }
-
- // Number of passpoint provisioning success
- optional int32 num_provision_success = 1;
-
- // Count for passpoint provisioning failure
- repeated ProvisionFailureCount provision_failure_count = 2;
-
- // Number of occurrences of a specific passpoint provision failure code
- message ProvisionFailureCount {
- // Failure code
- optional ProvisionFailureCode failure_code = 1;
-
- // Number of failure for the failure_code.
- optional int32 count = 2;
- }
-}
diff --git a/services/art-profile b/services/art-profile
index 8b911a2..a0338d5 100644
--- a/services/art-profile
+++ b/services/art-profile
@@ -21148,7 +21148,6 @@
HPLcom/android/server/wm/RemoteAnimationController;->lambda$goodToGo$1$RemoteAnimationController([Landroid/view/RemoteAnimationTarget;[Landroid/view/RemoteAnimationTarget;)V
HPLcom/android/server/wm/RunningTasks;->getTasks(ILjava/util/List;IILjava/util/ArrayList;IZZLandroid/util/ArraySet;)V
HPLcom/android/server/wm/SplashScreenStartingData;->createStartingSurface(Lcom/android/server/wm/ActivityRecord;)Lcom/android/server/policy/WindowManagerPolicy$StartingSurface;
-HPLcom/android/server/wm/SurfaceAnimator$Animatable;->shouldDeferAnimationFinish(Ljava/lang/Runnable;)Z
HPLcom/android/server/wm/SurfaceAnimator;->lambda$getFinishedCallback$0$SurfaceAnimator(Lcom/android/server/wm/AnimationAdapter;Ljava/lang/Runnable;)V
HPLcom/android/server/wm/Task;->positionChildAt(ILcom/android/server/wm/ActivityRecord;Z)V
HPLcom/android/server/wm/TaskRecord;->handlesOrientationChangeFromDescendant()Z
@@ -21191,7 +21190,6 @@
HPLcom/android/server/wm/RemoteAnimationController;->createRemoteAnimationRecord(Lcom/android/server/wm/ActivityRecord;Landroid/graphics/Point;Landroid/graphics/Rect;Landroid/graphics/Rect;)Lcom/android/server/wm/RemoteAnimationController$RemoteAnimationRecord;
HPLcom/android/server/wm/RemoteAnimationController;->linkToDeathOfRunner()V
HPLcom/android/server/wm/RemoteAnimationController;->writeStartDebugStatement()V
-HPLcom/android/server/wm/SurfaceAnimator$Animatable;->shouldDeferAnimationFinish(Ljava/lang/Runnable;)Z
HPLcom/android/server/wm/TaskRecord;->setMinDimensions(Landroid/content/pm/ActivityInfo;)V
HPLcom/android/server/wm/WallpaperAnimationAdapter;->startWallpaperAnimations(Lcom/android/server/wm/WindowManagerService;JJLjava/util/function/Consumer;Ljava/util/ArrayList;)[Landroid/view/RemoteAnimationTarget;
HPLcom/android/server/wm/WindowStateAnimator;->finishDrawingLocked(Landroid/view/SurfaceControl$Transaction;)Z
@@ -21206,13 +21204,152 @@
HPLcom/android/server/wm/AnimationAdapter;->writeToProto(Landroid/util/proto/ProtoOutputStream;J)V
HPLcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;->dump(Ljava/io/PrintWriter;Ljava/lang/String;)V
HPLcom/android/server/wm/RemoteAnimationController$RemoteAnimationRecord;-><init>(Lcom/android/server/wm/RemoteAnimationController;Lcom/android/server/wm/ActivityRecord;Landroid/graphics/Point;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
-HPLcom/android/server/wm/SurfaceAnimator$Animatable;->shouldDeferAnimationFinish(Ljava/lang/Runnable;)Z
HPLcom/android/server/wm/WindowProcessController;->setBoundClientUids(Landroid/util/ArraySet;)V
HPLcom/google/android/startop/iorap/IorapForwardingService$AppLaunchObserver;->lambda$onActivityLaunched$2$IorapForwardingService$AppLaunchObserver([BILcom/google/android/startop/iorap/IIorap;)V
HPLcom/google/android/startop/iorap/IorapForwardingService$AppLaunchObserver;->lambda$onActivityLaunchFinished$4$IorapForwardingService$AppLaunchObserver([BJLcom/google/android/startop/iorap/IIorap;)V
HPLcom/google/android/startop/iorap/IorapForwardingService$AppLaunchObserver;->lambda$onIntentStarted$0$IorapForwardingService$AppLaunchObserver(Landroid/content/Intent;JLcom/google/android/startop/iorap/IIorap;)V
HPLcom/android/server/statusbar/StatusBarManagerService;->updateUiVisibilityLocked(IIIIILandroid/graphics/Rect;Landroid/graphics/Rect;Z)V
HPLcom/android/server/wm/AnimationAdapter;->writeToProto(Landroid/util/proto/ProtoOutputStream;J)V
-HPLcom/android/server/wm/SurfaceAnimator$Animatable;->shouldDeferAnimationFinish(Ljava/lang/Runnable;)Z
HPLcom/google/android/startop/iorap/IIorap$Stub$Proxy;->onAppLaunchEvent(Lcom/google/android/startop/iorap/RequestId;Lcom/google/android/startop/iorap/AppLaunchEvent;)V
HPLcom/google/android/startop/iorap/RequestId;->nextValueForSequence()Lcom/google/android/startop/iorap/RequestId;
+HPLcom/android/server/AlarmManagerService;->decrementAlarmCount(II)V
+HPLcom/android/server/am/ActivityManagerService$4;->newArray(I)[Landroid/content/IntentFilter;
+HPLcom/android/server/am/ActivityManagerService$PidMap;->remove(Lcom/android/server/am/ProcessRecord;)V
+HPLcom/android/server/am/ActivityManagerService;->updateOomAdjLocked(Ljava/lang/String;)V
+HPLcom/android/server/am/ActivityManagerShellCommand$1;-><init>(Lcom/android/server/am/ActivityManagerShellCommand;)V
+HPLcom/android/server/am/ActivityManagerShellCommand;-><init>(Lcom/android/server/am/ActivityManagerService;Z)V
+HPLcom/android/server/am/ActivityManagerShellCommand;->runStartActivity(Ljava/io/PrintWriter;)I
+HPLcom/android/server/am/HostingRecord;-><init>(Ljava/lang/String;Landroid/content/ComponentName;I)V
+HPLcom/android/server/am/PendingIntentController;->registerIntentSenderCancelListener(Landroid/content/IIntentSender;Lcom/android/internal/os/IResultReceiver;)V
+HPLcom/android/server/appprediction/-$$Lambda$AppPredictionManagerService$PredictionManagerServiceStub$vSY20eQq5y5FXrxhhqOTcEmezTs;-><init>(Landroid/app/prediction/AppPredictionSessionId;)V
+HPLcom/android/server/appprediction/-$$Lambda$RemoteAppPredictionService$9DCowUTEF8fYuBlWGxOmP5hTAWA;-><init>(Landroid/app/prediction/AppPredictionSessionId;)V
+HPLcom/android/server/appprediction/RemoteAppPredictionService;->lambda$requestPredictionUpdate$6(Landroid/app/prediction/AppPredictionSessionId;Landroid/service/appprediction/IPredictionService;)V
+HPLcom/android/server/autofill/-$$Lambda$AutofillManagerService$1$1-WNu3tTkxodB_LsZ7dGIlvrPN0;->visit(Ljava/lang/Object;)V
+HPLcom/android/server/autofill/ui/-$$Lambda$AutoFillUI$56AC3ykfo4h_e2LSjdkJ3XQn370;-><init>(Lcom/android/server/autofill/ui/AutoFillUI;Lcom/android/server/autofill/ui/AutoFillUI$AutoFillUiCallback;)V
+HPLcom/android/server/contentsuggestions/-$$Lambda$RemoteContentSuggestionsService$Enqw46SYVKFK9F2xX4qUcIu5_3I;->run(Landroid/os/IInterface;)V
+HPLcom/android/server/contentsuggestions/-$$Lambda$RemoteContentSuggestionsService$eoGnQ2MDLLnW1UBX6wxNE1VBLAk;->run(Landroid/os/IInterface;)V
+HPLcom/android/server/contentsuggestions/-$$Lambda$RemoteContentSuggestionsService$VKh1DoMPNSPjPfnVGdsInmxuqzc;->run(Landroid/os/IInterface;)V
+HPLcom/android/server/contentsuggestions/-$$Lambda$RemoteContentSuggestionsService$yUTbcaYlZCYTmagCkNJ3i2VCkY4;->run(Landroid/os/IInterface;)V
+HPLcom/android/server/contentsuggestions/RemoteContentSuggestionsService;->getServiceInterface(Landroid/os/IBinder;)Landroid/os/IInterface;
+HPLcom/android/server/display/AutomaticBrightnessController;->updateAutoBrightness(ZZ)V
+HPLcom/android/server/display/DisplayPowerController$BrightnessReason;->setModifier(I)V
+HPLcom/android/server/display/DisplayPowerController$BrightnessReason;->setReason(I)V
+HPLcom/android/server/display/DisplayPowerController$BrightnessReason;->toString(I)Ljava/lang/String;
+HPLcom/android/server/display/DisplayPowerController$BrightnessReason;->toString()Ljava/lang/String;
+HPLcom/android/server/media/projection/MediaProjectionManagerService$1;->onProcessDied(II)V
+HPLcom/android/server/net/NetworkPolicyManagerService;->removeUidStateUL(I)Z
+HPLcom/android/server/pm/permission/PermissionManagerService;->addOnPermissionsChangeListener(Landroid/permission/IOnPermissionsChangeListener;)V
+HPLcom/android/server/protolog/ProtoLogImpl;->getSingleInstance()Lcom/android/server/protolog/ProtoLogImpl;
+HPLcom/android/server/soundtrigger/SoundTriggerHelper$PowerSaveModeListener;-><init>(Lcom/android/server/soundtrigger/SoundTriggerHelper;)V
+HPLcom/android/server/statusbar/-$$Lambda$StatusBarManagerService$uF0ibEnnXe7Lxunxb98QQLJjgZM;->run()V
+HPLcom/android/server/statusbar/StatusBarManagerService$UiState;->setSystemUiState(IIILandroid/graphics/Rect;Landroid/graphics/Rect;Z)V
+HPLcom/android/server/statusbar/StatusBarManagerService$UiState;->systemUiStateEquals(IIILandroid/graphics/Rect;Landroid/graphics/Rect;Z)Z
+HPLcom/android/server/usage/UsageStatsDatabase;->filterStats(Lcom/android/server/usage/IntervalStats;)V
+HPLcom/android/server/VibratorService$VibrationInfo;-><init>(JLandroid/os/VibrationEffect;Landroid/os/VibrationEffect;Landroid/media/AudioAttributes;ILjava/lang/String;Ljava/lang/String;)V
+HPLcom/android/server/VibratorService;->getAppOpMode(Lcom/android/server/VibratorService$Vibration;)I
+HPLcom/android/server/VibratorService;->getCurrentIntensityLocked(Lcom/android/server/VibratorService$Vibration;)I
+HPLcom/android/server/VibratorService;->isAllowedToVibrateLocked(Lcom/android/server/VibratorService$Vibration;)Z
+HPLcom/android/server/VibratorService;->vibrate(ILjava/lang/String;Landroid/os/VibrationEffect;Landroid/media/AudioAttributes;Ljava/lang/String;Landroid/os/IBinder;)V
+HPLcom/android/server/wm/-$$Lambda$ActivityRecord$g49I60MBbnNkxHlgA-NR7ALwWTQ;->apply(Ljava/lang/Object;)Z
+HPLcom/android/server/wm/-$$Lambda$ActivityRecord$pBc6yUdDV5IrUd9vt6oCz6QzpiE;->accept(Ljava/lang/Object;)V
+HPLcom/android/server/wm/-$$Lambda$BEx3OWenCvYAaV5h_J2ZkZXhEcY;->accept(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
+HPLcom/android/server/wm/-$$Lambda$DisplayPolicy$Zbxkj4wIhcDki6VwBh1kWmSmxqM;-><init>(Lcom/android/server/wm/DisplayPolicy;IIILandroid/graphics/Rect;Landroid/graphics/Rect;ZLcom/android/server/wm/WindowState;I[Lcom/android/internal/view/AppearanceRegion;ZZ)V
+HPLcom/android/server/wm/-$$Lambda$DisplayPolicy$Zbxkj4wIhcDki6VwBh1kWmSmxqM;->run()V
+HPLcom/android/server/wm/-$$Lambda$TaskChangeNotificationController$UexNbaqPy0mc3VxTw2coCctHho8;->accept(Landroid/app/ITaskStackListener;Landroid/os/Message;)V
+HPLcom/android/server/wm/ActivityMetricsLogger;->allWindowsDrawn()Z
+HPLcom/android/server/wm/ActivityRecord;->createAnimationBoundsLayer(Landroid/view/SurfaceControl$Transaction;)Landroid/view/SurfaceControl;
+HPLcom/android/server/wm/ActivityRecord;->destroyed(Ljava/lang/String;)V
+HPLcom/android/server/wm/ActivityRecord;->forAllWindowsUnchecked(Lcom/android/internal/util/ToBooleanFunction;Z)Z
+HPLcom/android/server/wm/ActivityRecord;->getTopFullscreenWindow()Lcom/android/server/wm/WindowState;
+HPLcom/android/server/wm/ActivityRecord;->loadAnimation(Landroid/view/WindowManager$LayoutParams;IZZ)Landroid/view/animation/Animation;
+HPLcom/android/server/wm/ActivityRecord;->notifyAppStopped()V
+HPLcom/android/server/wm/ActivityRecord;->onFirstWindowDrawn(Lcom/android/server/wm/WindowState;Lcom/android/server/wm/WindowStateAnimator;)V
+HPLcom/android/server/wm/ActivityRecord;->onRemovedFromDisplay()V
+HPLcom/android/server/wm/ActivityRecord;->removeDeadWindows()V
+HPLcom/android/server/wm/ActivityRecord;->setClientHidden(Z)V
+HPLcom/android/server/wm/ActivityRecord;->stopFreezingScreenLocked(Z)V
+HPLcom/android/server/wm/ActivityStack;->removeTimeoutsForActivity(Lcom/android/server/wm/ActivityRecord;)V
+HPLcom/android/server/wm/ActivityStarter;->recycleTask(Lcom/android/server/wm/TaskRecord;Lcom/android/server/wm/ActivityRecord;Lcom/android/server/wm/ActivityRecord;[Lcom/android/server/wm/ActivityRecord;)I
+HPLcom/android/server/wm/ActivityTaskManagerService;->getTaskSnapshot(IZZ)Landroid/app/ActivityManager$TaskSnapshot;
+HPLcom/android/server/wm/AnimationAdapter;->writeToProto(Landroid/util/proto/ProtoOutputStream;J)V
+HPLcom/android/server/wm/DisplayContent;->getWindowCornerRadius()F
+HPLcom/android/server/wm/DisplayPolicy;->convertNonDecorInsetsToStableInsets(Landroid/graphics/Rect;I)V
+HPLcom/android/server/wm/DisplayPolicy;->getInsetsPolicy()Lcom/android/server/wm/InsetsPolicy;
+HPLcom/android/server/wm/DisplayPolicy;->updateLightStatusBarAppearanceLw(ILcom/android/server/wm/WindowState;Lcom/android/server/wm/WindowState;)I
+HPLcom/android/server/wm/InsetsPolicy;->getInsetsForDispatch(Lcom/android/server/wm/WindowState;)Landroid/view/InsetsState;
+HPLcom/android/server/wm/InsetsPolicy;->isHidden(I)Z
+HPLcom/android/server/wm/InsetsPolicy;->updateBarControlTarget(Lcom/android/server/wm/WindowState;)V
+HPLcom/android/server/wm/Task;->getTopFullscreenActivity()Lcom/android/server/wm/ActivityRecord;
+HPLcom/android/server/wm/TaskRecord;->removeTaskActivitiesLocked(Ljava/lang/String;)V
+HPLcom/android/server/wm/Task;->removeChild(Lcom/android/server/wm/ActivityRecord;)V
+HPLcom/android/server/wm/TaskSnapshotCache$CacheEntry;-><init>(Landroid/app/ActivityManager$TaskSnapshot;Lcom/android/server/wm/ActivityRecord;)V
+HPLcom/android/server/wm/TaskSnapshotController;->createTaskSnapshot(Lcom/android/server/wm/Task;F)Landroid/view/SurfaceControl$ScreenshotGraphicBuffer;
+HPLcom/android/server/wm/TaskSnapshotController;->findAppTokenForSnapshot(Lcom/android/server/wm/Task;)Lcom/android/server/wm/ActivityRecord;
+HPLcom/android/server/wm/TaskSnapshotPersister$DeleteWriteQueueItem;-><init>(Lcom/android/server/wm/TaskSnapshotPersister;II)V
+HPLcom/android/server/wm/TaskSnapshotPersister$StoreWriteQueueItem;-><init>(Lcom/android/server/wm/TaskSnapshotPersister;IILandroid/app/ActivityManager$TaskSnapshot;)V
+HPLcom/android/server/wm/TaskSnapshotPersister$StoreWriteQueueItem;->onQueuedLocked()V
+HPLcom/android/server/wm/WallpaperAnimationAdapter;->lambda$startWallpaperAnimations$0(JJLjava/util/function/Consumer;Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/android/server/wm/WallpaperWindowToken;)V
+HPLcom/android/server/wm/WallpaperAnimationAdapter;->startWallpaperAnimations(Lcom/android/server/wm/WindowManagerService;JJLjava/util/function/Consumer;Ljava/util/ArrayList;)[Landroid/view/RemoteAnimationTarget;
+HPLcom/android/server/wm/WindowAnimationSpec;->findTranslateAnimation(Landroid/view/animation/Animation;)Landroid/view/animation/TranslateAnimation;
+HPLcom/android/server/wm/WindowProcessControllerMap;->removeProcessFromUidMap(Lcom/android/server/wm/WindowProcessController;)V
+HPLcom/android/server/wm/WindowProcessController;->updateProcessInfo(ZZZ)V
+HPLcom/android/server/wm/WindowState$DeathRecipient;-><init>(Lcom/android/server/wm/WindowState;Lcom/android/server/wm/WindowState$1;)V
+HPLcom/android/server/wm/WindowState$WindowId;-><init>(Lcom/android/server/wm/WindowState;Lcom/android/server/wm/WindowState$1;)V
+HPLcom/google/android/startop/iorap/AppLaunchEvent$ActivityLaunched;->writeToParcelImpl(Landroid/os/Parcel;I)V
+HPLcom/google/android/startop/iorap/AppLaunchEvent$ActivityLaunchFinished;->writeToParcelImpl(Landroid/os/Parcel;I)V
+HPLcom/google/android/startop/iorap/AppLaunchEvent$IntentStarted;->writeToParcelImpl(Landroid/os/Parcel;I)V
+HPLcom/google/android/startop/iorap/AppLaunchEvent;->getTypeIndex()I
+HPLcom/android/server/pm/PackageManagerService;->access$7600(Lcom/android/server/pm/PackageManagerService;Landroid/content/Intent;Ljava/lang/String;IIZI)Landroid/content/pm/ResolveInfo;
+HPLcom/android/server/pm/PackageManagerService;->access$8100(Lcom/android/server/pm/PackageManagerService;II)Z
+HPLcom/android/server/wm/ActivityRecord$Token;->access$100(Lcom/android/server/wm/ActivityRecord$Token;Lcom/android/server/wm/ActivityRecord;)V
+HPLcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;->access$000(Lcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;)Lcom/android/server/wm/SurfaceAnimator$OnAnimationFinishedCallback;
+HPLcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;->access$400(Lcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;)Landroid/graphics/Point;
+HPLcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;->access$500(Lcom/android/server/wm/RemoteAnimationController$RemoteAnimationAdapterWrapper;)Landroid/graphics/Rect;
+HPLcom/android/server/wm/RemoteAnimationController;->access$100(Lcom/android/server/wm/RemoteAnimationController;)V
+HPLcom/android/server/wm/RemoteAnimationController;->access$300(Lcom/android/server/wm/RemoteAnimationController;)Landroid/view/RemoteAnimationAdapter;
+HPLcom/android/server/wm/TaskPersister$TaskWriteQueueItem;->access$200(Lcom/android/server/wm/TaskPersister$TaskWriteQueueItem;)Lcom/android/server/wm/TaskRecord;
+HPLcom/android/server/wm/TaskPersister;->access$000(I)Ljava/io/File;
+HPLcom/android/server/wm/WindowContainer;->access$100(Lcom/android/server/wm/WindowContainer;)Landroid/util/Pools$SynchronizedPool;
+HPLcom/android/server/wm/WindowManagerService;->access$1600(Lcom/android/server/wm/WindowManagerService;Landroid/os/IBinder;)V
+HPLcom/android/server/pm/ShortcutUser;->logSharingShortcutStats(Lcom/android/internal/logging/MetricsLogger;)V
+HPLcom/android/server/statusbar/StatusBarManagerService;->lambda$topAppWindowChanged$1$StatusBarManagerService(IZZ)V
+HPLcom/android/server/wm/ActivityRecord$Token;->attach(Lcom/android/server/wm/ActivityRecord;)V
+HPLcom/android/server/wm/AnimationAdapter;->writeToProto(Landroid/util/proto/ProtoOutputStream;J)V
+HPLcom/android/server/wm/DisplayPolicy;->lambda$updateSystemUiVisibilityLw$10$DisplayPolicy(IIILandroid/graphics/Rect;Landroid/graphics/Rect;ZLcom/android/server/wm/WindowState;I[Lcom/android/internal/view/AppearanceRegion;ZZ)V
+HPLcom/android/server/wm/InsetsSourceProvider;->hasWindow()Z
+HPLcom/android/server/wm/InsetsStateController;->onBarControlTargetChanged(Lcom/android/server/wm/InsetsControlTarget;Lcom/android/server/wm/InsetsControlTarget;Lcom/android/server/wm/InsetsControlTarget;Lcom/android/server/wm/InsetsControlTarget;)V
+HPLcom/android/server/wm/InsetsStateController;->peekSourceProvider(I)Lcom/android/server/wm/InsetsSourceProvider;
+HPLcom/android/server/wm/TaskPersister$TaskWriteQueueItem;->access$200(Lcom/android/server/wm/TaskPersister$TaskWriteQueueItem;)Lcom/android/server/wm/TaskRecord;
+HPLcom/android/server/wm/WindowContainer;->access$100(Lcom/android/server/wm/WindowContainer;)Landroid/util/Pools$SynchronizedPool;
+HPLcom/android/server/-$$Lambda$AlarmManagerService$2$Eo-D98J-N9R2METkD-12gPs320c;-><init>(Lcom/android/server/AlarmManagerService$2;Landroid/app/IAlarmCompleteListener;)V
+HPLcom/android/server/AlarmManagerService;->access$100(Lcom/android/server/AlarmManagerService;)Lcom/android/server/AlarmManagerService$Injector;
+HPLcom/android/server/AlarmManagerService;->access$2102(Lcom/android/server/AlarmManagerService;J)J
+HPLcom/android/server/AlarmManagerService;->access$2202(Lcom/android/server/AlarmManagerService;J)J
+HPLcom/android/server/AlarmManagerService;->access$2300(Lcom/android/server/AlarmManagerService;)V
+HPLcom/android/server/AlarmManagerService;->access$2400(Lcom/android/server/AlarmManagerService;Lcom/android/server/AlarmManagerService$Alarm;)Z
+HPLcom/android/server/AlarmManagerService;->isExemptFromAppStandby(Lcom/android/server/AlarmManagerService$Alarm;)Z
+HPLcom/android/server/appwidget/AppWidgetServiceImpl$HostId;-><init>(IILjava/lang/String;)V
+HPLcom/android/server/content/ContentService$ObserverCall;->run()V
+HPLcom/android/server/statusbar/-$$Lambda$StatusBarManagerService$uF0ibEnnXe7Lxunxb98QQLJjgZM;-><init>(Lcom/android/server/statusbar/StatusBarManagerService;IZZ)V
+HPLcom/android/server/statusbar/StatusBarManagerService$1;->topAppWindowChanged(IZZ)V
+HPLcom/android/server/statusbar/StatusBarManagerService$UiState;->access$1600(Lcom/android/server/statusbar/StatusBarManagerService$UiState;Z)V
+HPLcom/android/server/statusbar/StatusBarManagerService$UiState;->access$1700(Lcom/android/server/statusbar/StatusBarManagerService$UiState;Z)V
+HPLcom/android/server/statusbar/StatusBarManagerService$UiState;->setFullscreen(Z)V
+HPLcom/android/server/statusbar/StatusBarManagerService$UiState;->setImmersive(Z)V
+HPLcom/android/server/statusbar/StatusBarManagerService;->access$600(Lcom/android/server/statusbar/StatusBarManagerService;IZZ)V
+HPLcom/android/server/statusbar/StatusBarManagerService;->enforceStatusBar()V
+HPLcom/android/server/statusbar/StatusBarManagerService;->getUiState(I)Lcom/android/server/statusbar/StatusBarManagerService$UiState;
+HPLcom/android/server/statusbar/StatusBarManagerService;->topAppWindowChanged(IZZ)V
+HPLcom/android/server/wm/InsetsStateController;->onControlFakeTargetChanged(ILcom/android/server/wm/InsetsControlTarget;)V
+HPLcom/android/server/wm/LocalAnimationAdapter$AnimationSpec;->writeToProto(Landroid/util/proto/ProtoOutputStream;J)V
+HPLcom/android/server/wm/LocalAnimationAdapter;->writeToProto(Landroid/util/proto/ProtoOutputStream;)V
+HPLcom/android/server/wm/PersisterQueue;->access$100(Lcom/android/server/wm/PersisterQueue;)Ljava/util/ArrayList;
+HPLcom/android/server/wm/PersisterQueue;->access$200(Lcom/android/server/wm/PersisterQueue;)Ljava/util/ArrayList;
+HPLcom/android/server/wm/PersisterQueue;->access$300(Lcom/android/server/wm/PersisterQueue;)V
+HPLcom/android/server/wm/TaskSnapshotPersister;->access$100(Lcom/android/server/wm/TaskSnapshotPersister;)Ljava/lang/Object;
+HPLcom/android/server/wm/TaskSnapshotPersister;->access$200(Lcom/android/server/wm/TaskSnapshotPersister;)Z
+HPLcom/android/server/wm/TaskSnapshotPersister;->access$300(Lcom/android/server/wm/TaskSnapshotPersister;)Ljava/util/ArrayDeque;
+HPLcom/android/server/wm/TaskSnapshotPersister;->access$402(Lcom/android/server/wm/TaskSnapshotPersister;Z)Z
+HPLcom/android/server/wm/WindowAnimationSpec;->findTranslateAnimation(Landroid/view/animation/Animation;)Landroid/view/animation/TranslateAnimation;
+HPLcom/android/server/wm/WindowAnimationSpec;->writeToProtoInner(Landroid/util/proto/ProtoOutputStream;)V
+HPLcom/android/server/wm/WindowContainer;->access$100(Lcom/android/server/wm/WindowContainer;)Landroid/util/Pools$SynchronizedPool;
diff --git a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
index 7d129ea..1fc4751 100644
--- a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
+++ b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
@@ -197,8 +197,20 @@
if ((type & SaveInfo.SAVE_DATA_TYPE_ADDRESS) != 0) {
types.add(context.getString(R.string.autofill_save_type_address));
}
- if ((type & SaveInfo.SAVE_DATA_TYPE_CREDIT_CARD) != 0) {
+
+ // fallback to generic card type if set multiple types
+ final int cardTypeMask = SaveInfo.SAVE_DATA_TYPE_CREDIT_CARD
+ | SaveInfo.SAVE_DATA_TYPE_DEBIT_CARD
+ | SaveInfo.SAVE_DATA_TYPE_PAYMENT_CARD;
+ final int count = Integer.bitCount(type & cardTypeMask);
+ if (count > 1 || (type & SaveInfo.SAVE_DATA_TYPE_GENERIC_CARD) != 0) {
+ types.add(context.getString(R.string.autofill_save_type_generic_card));
+ } else if ((type & SaveInfo.SAVE_DATA_TYPE_PAYMENT_CARD) != 0) {
+ types.add(context.getString(R.string.autofill_save_type_payment_card));
+ } else if ((type & SaveInfo.SAVE_DATA_TYPE_CREDIT_CARD) != 0) {
types.add(context.getString(R.string.autofill_save_type_credit_card));
+ } else if ((type & SaveInfo.SAVE_DATA_TYPE_DEBIT_CARD) != 0) {
+ types.add(context.getString(R.string.autofill_save_type_debit_card));
}
if ((type & SaveInfo.SAVE_DATA_TYPE_USERNAME) != 0) {
types.add(context.getString(R.string.autofill_save_type_username));
@@ -269,7 +281,9 @@
noButton.setOnClickListener((v) -> mListener.onCancel(info.getNegativeActionListener()));
final TextView yesButton = view.findViewById(R.id.autofill_save_yes);
- if (isUpdate) {
+ if (info.getPositiveActionStyle() == SaveInfo.POSITIVE_BUTTON_STYLE_CONTINUE) {
+ yesButton.setText(R.string.autofill_continue_yes);
+ } else if (isUpdate) {
yesButton.setText(R.string.autofill_update_yes);
}
yesButton.setOnClickListener((v) -> mListener.onSave());
diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java
index 06d9395..7828050 100644
--- a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java
+++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java
@@ -22,6 +22,7 @@
import android.app.ActivityManager;
import android.app.AppGlobals;
import android.app.contentsuggestions.ClassificationsRequest;
+import android.app.contentsuggestions.ContentSuggestionsManager;
import android.app.contentsuggestions.IClassificationsCallback;
import android.app.contentsuggestions.ISelectionsCallback;
import android.app.contentsuggestions.SelectionsRequest;
@@ -97,15 +98,19 @@
void provideContextImageLocked(int taskId, @NonNull Bundle imageContextRequestExtras) {
RemoteContentSuggestionsService service = ensureRemoteServiceLocked();
if (service != null) {
- ActivityManager.TaskSnapshot snapshot =
- mActivityTaskManagerInternal.getTaskSnapshotNoRestore(taskId, false);
GraphicBuffer snapshotBuffer = null;
int colorSpaceId = 0;
- if (snapshot != null) {
- snapshotBuffer = snapshot.getSnapshot();
- ColorSpace colorSpace = snapshot.getColorSpace();
- if (colorSpace != null) {
- colorSpaceId = colorSpace.getId();
+
+ // Skip taking TaskSnapshot when bitmap is provided.
+ if (!imageContextRequestExtras.containsKey(ContentSuggestionsManager.EXTRA_BITMAP)) {
+ ActivityManager.TaskSnapshot snapshot =
+ mActivityTaskManagerInternal.getTaskSnapshotNoRestore(taskId, false);
+ if (snapshot != null) {
+ snapshotBuffer = snapshot.getSnapshot();
+ ColorSpace colorSpace = snapshot.getColorSpace();
+ if (colorSpace != null) {
+ colorSpaceId = colorSpace.getId();
+ }
}
}
diff --git a/core/java/android/app/usage/UsageStatsManagerInternal.java b/services/core/java/android/app/usage/UsageStatsManagerInternal.java
similarity index 91%
rename from core/java/android/app/usage/UsageStatsManagerInternal.java
rename to services/core/java/android/app/usage/UsageStatsManagerInternal.java
index 024afe25..6641b5b 100644
--- a/core/java/android/app/usage/UsageStatsManagerInternal.java
+++ b/services/core/java/android/app/usage/UsageStatsManagerInternal.java
@@ -23,6 +23,8 @@
import android.os.UserHandle;
import android.os.UserManager;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
+
import java.util.List;
import java.util.Set;
@@ -153,35 +155,6 @@
*/
public abstract int[] getIdleUidsForUser(@UserIdInt int userId);
- /**
- * Sets up a listener for changes to packages being accessed.
- * @param listener A listener within the system process.
- */
- public abstract void addAppIdleStateChangeListener(
- AppIdleStateChangeListener listener);
-
- /**
- * Removes a listener that was previously added for package usage state changes.
- * @param listener The listener within the system process to remove.
- */
- public abstract void removeAppIdleStateChangeListener(
- AppIdleStateChangeListener listener);
-
- public static abstract class AppIdleStateChangeListener {
-
- /** Callback to inform listeners that the idle state has changed to a new bucket. */
- public abstract void onAppIdleStateChanged(String packageName, @UserIdInt int userId,
- boolean idle, int bucket, int reason);
-
- /**
- * Optional callback to inform the listener that the app has transitioned into
- * an active state due to user interaction.
- */
- public void onUserInteractionStarted(String packageName, @UserIdInt int userId) {
- // No-op by default
- }
- }
-
/** Backup/Restore API */
public abstract byte[] getBackupPayload(@UserIdInt int userId, String key);
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index b41e95f..ff0044f 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -99,6 +99,8 @@
import com.android.internal.util.LocalLog;
import com.android.internal.util.StatLogger;
import com.android.server.AppStateTracker.Listener;
+import com.android.server.usage.AppStandbyInternal;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import java.io.ByteArrayOutputStream;
import java.io.FileDescriptor;
@@ -1599,7 +1601,9 @@
LocalServices.getService(DeviceIdleInternal.class);
mUsageStatsManagerInternal =
LocalServices.getService(UsageStatsManagerInternal.class);
- mUsageStatsManagerInternal.addAppIdleStateChangeListener(new AppStandbyTracker());
+ AppStandbyInternal appStandbyInternal =
+ LocalServices.getService(AppStandbyInternal.class);
+ appStandbyInternal.addListener(new AppStandbyTracker());
mAppStateTracker = LocalServices.getService(AppStateTracker.class);
mAppStateTracker.addListener(mForceAppStandbyListener);
@@ -4468,7 +4472,7 @@
* Tracking of app assignments to standby buckets
*/
private final class AppStandbyTracker extends
- UsageStatsManagerInternal.AppIdleStateChangeListener {
+ AppIdleStateChangeListener {
@Override
public void onAppIdleStateChanged(final String packageName, final @UserIdInt int userId,
boolean idle, int bucket, int reason) {
diff --git a/services/core/java/com/android/server/AppStateTracker.java b/services/core/java/com/android/server/AppStateTracker.java
index da760b6..5eff2c5 100644
--- a/services/core/java/com/android/server/AppStateTracker.java
+++ b/services/core/java/com/android/server/AppStateTracker.java
@@ -24,7 +24,6 @@
import android.app.IUidObserver;
import android.app.usage.UsageStatsManager;
import android.app.usage.UsageStatsManagerInternal;
-import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -58,6 +57,8 @@
import com.android.internal.util.StatLogger;
import com.android.server.AppStateTrackerProto.ExemptedPackage;
import com.android.server.AppStateTrackerProto.RunAnyInBackgroundRestrictedPackages;
+import com.android.server.usage.AppStandbyInternal;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import java.io.PrintWriter;
import java.util.Arrays;
@@ -89,7 +90,7 @@
IAppOpsService mAppOpsService;
PowerManagerInternal mPowerManagerInternal;
StandbyTracker mStandbyTracker;
- UsageStatsManagerInternal mUsageStatsManagerInternal;
+ AppStandbyInternal mAppStandbyInternal;
private final MyHandler mHandler;
@@ -420,8 +421,7 @@
mAppOpsManager = Preconditions.checkNotNull(injectAppOpsManager());
mAppOpsService = Preconditions.checkNotNull(injectIAppOpsService());
mPowerManagerInternal = Preconditions.checkNotNull(injectPowerManagerInternal());
- mUsageStatsManagerInternal = Preconditions.checkNotNull(
- injectUsageStatsManagerInternal());
+ mAppStandbyInternal = Preconditions.checkNotNull(injectAppStandbyInternal());
mFlagsObserver = new FeatureFlagsObserver();
mFlagsObserver.register();
@@ -429,7 +429,7 @@
mForceAllAppStandbyForSmallBattery =
mFlagsObserver.isForcedAppStandbyForSmallBatteryEnabled();
mStandbyTracker = new StandbyTracker();
- mUsageStatsManagerInternal.addAppIdleStateChangeListener(mStandbyTracker);
+ mAppStandbyInternal.addListener(mStandbyTracker);
try {
mIActivityManager.registerUidObserver(new UidObserver(),
@@ -494,8 +494,8 @@
}
@VisibleForTesting
- UsageStatsManagerInternal injectUsageStatsManagerInternal() {
- return LocalServices.getService(UsageStatsManagerInternal.class);
+ AppStandbyInternal injectAppStandbyInternal() {
+ return LocalServices.getService(AppStandbyInternal.class);
}
@VisibleForTesting
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index d18b4f6..a33fcd5 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -720,6 +720,8 @@
event.putInt(BatteryManager.EXTRA_SCALE, BATTERY_SCALE);
event.putInt(BatteryManager.EXTRA_PLUGGED, mPlugType);
event.putInt(BatteryManager.EXTRA_VOLTAGE, mHealthInfo.batteryVoltage);
+ event.putInt(BatteryManager.EXTRA_TEMPERATURE, mHealthInfo.batteryTemperature);
+ event.putInt(BatteryManager.EXTRA_CHARGE_COUNTER, mHealthInfo.batteryChargeCounter);
event.putLong(BatteryManager.EXTRA_EVENT_TIMESTAMP, now);
boolean queueWasEmpty = mBatteryLevelsEventQueue.isEmpty();
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 0bb72cb..ce0e9e7 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -26,6 +26,7 @@
import static android.net.ConnectivityManager.TYPE_VPN;
import static android.net.ConnectivityManager.getNetworkTypeName;
import static android.net.ConnectivityManager.isNetworkTypeValid;
+import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_PRIVDNS;
import static android.net.INetworkMonitor.NETWORK_VALIDATION_RESULT_PARTIAL;
import static android.net.INetworkMonitor.NETWORK_VALIDATION_RESULT_VALID;
import static android.net.NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL;
@@ -528,6 +529,15 @@
private static final int EVENT_SET_ACCEPT_PARTIAL_CONNECTIVITY = 45;
/**
+ * Event for NetworkMonitor to inform ConnectivityService that the probe status has changed.
+ * Both of the arguments are bitmasks, and the value of bits come from
+ * INetworkMonitor.NETWORK_VALIDATION_PROBE_*.
+ * arg1 = A bitmask to describe which probes are completed.
+ * arg2 = A bitmask to describe which probes are successful.
+ */
+ public static final int EVENT_PROBE_STATUS_CHANGED = 46;
+
+ /**
* Argument for {@link #EVENT_PROVISIONING_NOTIFICATION} to indicate that the notification
* should be shown.
*/
@@ -2663,6 +2673,41 @@
switch (msg.what) {
default:
return false;
+ case EVENT_PROBE_STATUS_CHANGED: {
+ final Integer netId = (Integer) msg.obj;
+ final NetworkAgentInfo nai = getNetworkAgentInfoForNetId(netId);
+ if (nai == null) {
+ break;
+ }
+ final boolean probePrivateDnsCompleted =
+ ((msg.arg1 & NETWORK_VALIDATION_PROBE_PRIVDNS) != 0);
+ final boolean privateDnsBroken =
+ ((msg.arg2 & NETWORK_VALIDATION_PROBE_PRIVDNS) == 0);
+ if (probePrivateDnsCompleted) {
+ if (nai.networkCapabilities.isPrivateDnsBroken() != privateDnsBroken) {
+ nai.networkCapabilities.setPrivateDnsBroken(privateDnsBroken);
+ final int oldScore = nai.getCurrentScore();
+ updateCapabilities(oldScore, nai, nai.networkCapabilities);
+ }
+ // Only show the notification when the private DNS is broken and the
+ // PRIVATE_DNS_BROKEN notification hasn't shown since last valid.
+ if (privateDnsBroken && !nai.networkMisc.hasShownBroken) {
+ showNetworkNotification(nai, NotificationType.PRIVATE_DNS_BROKEN);
+ }
+ nai.networkMisc.hasShownBroken = privateDnsBroken;
+ } else if (nai.networkCapabilities.isPrivateDnsBroken()) {
+ // If probePrivateDnsCompleted is false but nai.networkCapabilities says
+ // private DNS is broken, it means this network is being reevaluated.
+ // Either probing private DNS is not necessary any more or it hasn't been
+ // done yet. In either case, the networkCapabilities should be updated to
+ // reflect the new status.
+ nai.networkCapabilities.setPrivateDnsBroken(false);
+ final int oldScore = nai.getCurrentScore();
+ updateCapabilities(oldScore, nai, nai.networkCapabilities);
+ nai.networkMisc.hasShownBroken = false;
+ }
+ break;
+ }
case EVENT_NETWORK_TESTED: {
final NetworkAgentInfo nai = getNetworkAgentInfoForNetId(msg.arg2);
if (nai == null) break;
@@ -2705,14 +2750,20 @@
if (oldScore != nai.getCurrentScore()) sendUpdatedScoreToFactories(nai);
if (valid) {
handleFreshlyValidatedNetwork(nai);
- // Clear NO_INTERNET, PARTIAL_CONNECTIVITY and LOST_INTERNET
- // notifications if network becomes valid.
+ // Clear NO_INTERNET, PRIVATE_DNS_BROKEN, PARTIAL_CONNECTIVITY and
+ // LOST_INTERNET notifications if network becomes valid.
mNotifier.clearNotification(nai.network.netId,
NotificationType.NO_INTERNET);
mNotifier.clearNotification(nai.network.netId,
NotificationType.LOST_INTERNET);
mNotifier.clearNotification(nai.network.netId,
NotificationType.PARTIAL_CONNECTIVITY);
+ mNotifier.clearNotification(nai.network.netId,
+ NotificationType.PRIVATE_DNS_BROKEN);
+ // If network becomes valid, the hasShownBroken should be reset for
+ // that network so that the notification will be fired when the private
+ // DNS is broken again.
+ nai.networkMisc.hasShownBroken = false;
}
} else if (partialConnectivityChanged) {
updateCapabilities(nai.getCurrentScore(), nai, nai.networkCapabilities);
@@ -2863,6 +2914,13 @@
}
@Override
+ public void notifyProbeStatusChanged(int probesCompleted, int probesSucceeded) {
+ mTrackerHandler.sendMessage(mTrackerHandler.obtainMessage(
+ EVENT_PROBE_STATUS_CHANGED,
+ probesCompleted, probesSucceeded, new Integer(mNetId)));
+ }
+
+ @Override
public void showProvisioningNotification(String action, String packageName) {
final Intent intent = new Intent(action);
intent.setPackage(packageName);
@@ -3679,6 +3737,11 @@
// High priority because it is only displayed for explicitly selected networks.
highPriority = true;
break;
+ case PRIVATE_DNS_BROKEN:
+ action = Settings.ACTION_WIRELESS_SETTINGS;
+ // High priority because we should let user know why there is no internet.
+ highPriority = true;
+ break;
case LOST_INTERNET:
action = ConnectivityManager.ACTION_PROMPT_LOST_VALIDATION;
// High priority because it could help the user avoid unexpected data usage.
@@ -3696,7 +3759,7 @@
}
Intent intent = new Intent(action);
- if (type != NotificationType.LOGGED_IN) {
+ if (type != NotificationType.LOGGED_IN && type != NotificationType.PRIVATE_DNS_BROKEN) {
intent.setData(Uri.fromParts("netId", Integer.toString(nai.network.netId), null));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("com.android.settings",
@@ -5162,6 +5225,13 @@
ns.assertValidFromUid(Binder.getCallingUid());
}
+ private void ensureValid(NetworkCapabilities nc) {
+ ensureValidNetworkSpecifier(nc);
+ if (nc.isPrivateDnsBroken()) {
+ throw new IllegalArgumentException("Can't request broken private DNS");
+ }
+ }
+
@Override
public NetworkRequest requestNetwork(NetworkCapabilities networkCapabilities,
Messenger messenger, int timeoutMs, IBinder binder, int legacyType) {
@@ -5195,7 +5265,7 @@
if (timeoutMs < 0) {
throw new IllegalArgumentException("Bad timeout specified");
}
- ensureValidNetworkSpecifier(networkCapabilities);
+ ensureValid(networkCapabilities);
NetworkRequest networkRequest = new NetworkRequest(networkCapabilities, legacyType,
nextNetworkRequestId(), type);
@@ -5337,7 +5407,7 @@
// There is no need to do this for requests because an app without CHANGE_NETWORK_STATE
// can't request networks.
restrictBackgroundRequestForCaller(nc);
- ensureValidNetworkSpecifier(nc);
+ ensureValid(nc);
NetworkRequest networkRequest = new NetworkRequest(nc, TYPE_NONE, nextNetworkRequestId(),
NetworkRequest.Type.LISTEN);
@@ -5355,7 +5425,7 @@
if (!hasWifiNetworkListenPermission(networkCapabilities)) {
enforceAccessPermission();
}
- ensureValidNetworkSpecifier(networkCapabilities);
+ ensureValid(networkCapabilities);
ensureSufficientPermissionsForRequest(networkCapabilities,
Binder.getCallingPid(), Binder.getCallingUid());
@@ -5841,6 +5911,7 @@
} else {
newNc.removeCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY);
}
+ newNc.setPrivateDnsBroken(nai.networkCapabilities.isPrivateDnsBroken());
return newNc;
}
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 18009e1..190e6cf 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -115,7 +115,8 @@
}
@Override
- public boolean startInstallation(long systemSize, long userdataSize) throws RemoteException {
+ public boolean startInstallation(String name, long size, boolean readOnly)
+ throws RemoteException {
// priority from high to low: sysprop -> sdcard -> /data
String path = SystemProperties.get("os.aot.path");
if (path.isEmpty()) {
@@ -137,11 +138,18 @@
}
Slog.i(TAG, "startInstallation -> " + path);
}
+ IGsiService service = getGsiService();
GsiInstallParams installParams = new GsiInstallParams();
installParams.installDir = path;
- installParams.gsiSize = systemSize;
- installParams.userdataSize = userdataSize;
- return getGsiService().beginGsiInstall(installParams) == 0;
+ installParams.name = name;
+ installParams.size = size;
+ installParams.wipe = readOnly;
+ installParams.readOnly = readOnly;
+ if (service.beginGsiInstall(installParams) != 0) {
+ Slog.i(TAG, "Failed to install " + name);
+ return false;
+ }
+ return true;
}
@Override
diff --git a/services/core/java/com/android/server/GnssManagerService.java b/services/core/java/com/android/server/GnssManagerService.java
index 44a8234..cbf2a62 100644
--- a/services/core/java/com/android/server/GnssManagerService.java
+++ b/services/core/java/com/android/server/GnssManagerService.java
@@ -18,6 +18,7 @@
import android.Manifest;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.content.Context;
@@ -66,7 +67,7 @@
/** Manages Gnss providers and related Gnss functions for LocationManagerService. */
public class GnssManagerService {
- private static final String TAG = "LocationManagerService";
+ private static final String TAG = "GnssManagerService";
private static final boolean D = Log.isLoggable(TAG, Log.DEBUG);
// Providers
@@ -123,7 +124,7 @@
// Can use this constructor to inject GnssLocationProvider for testing
@VisibleForTesting
- GnssManagerService(LocationManagerService locationManagerService,
+ public GnssManagerService(LocationManagerService locationManagerService,
Context context,
GnssLocationProvider gnssLocationProvider,
LocationUsageLogger locationUsageLogger) {
@@ -300,7 +301,7 @@
* @return true if callback is successfully added, false otherwise
*/
public boolean addGnssBatchingCallback(IBatchedLocationCallback callback, String packageName,
- @NonNull String listenerIdentity) {
+ @Nullable String featureId, @NonNull String listenerIdentity) {
mContext.enforceCallingPermission(
android.Manifest.permission.LOCATION_HARDWARE,
"Location Hardware permission not granted to access hardware batching");
@@ -319,7 +320,7 @@
CallerIdentity callerIdentity =
new CallerIdentity(Binder.getCallingUid(), Binder.getCallingPid(), packageName,
- listenerIdentity);
+ featureId, listenerIdentity);
synchronized (mGnssBatchingLock) {
mGnssBatchingCallback = callback;
mGnssBatchingDeathCallback =
@@ -497,6 +498,7 @@
private <TListener extends IInterface> boolean addGnssDataListenerLocked(
TListener listener,
String packageName,
+ @Nullable String featureId,
@NonNull String listenerIdentifier,
RemoteListenerHelper<TListener> gnssDataProvider,
ArrayMap<IBinder,
@@ -517,7 +519,7 @@
CallerIdentity callerIdentity =
new CallerIdentity(Binder.getCallingUid(), Binder.getCallingPid(), packageName,
- listenerIdentifier);
+ featureId, listenerIdentifier);
LinkedListener<TListener> linkedListener =
new LocationManagerServiceUtils.LinkedListener<>(
listener, listenerIdentifier, callerIdentity, binderDeathCallback);
@@ -605,11 +607,13 @@
* @param packageName name of requesting package
* @return true if listener is successfully registered, false otherwise
*/
- public boolean registerGnssStatusCallback(IGnssStatusListener listener, String packageName) {
+ public boolean registerGnssStatusCallback(IGnssStatusListener listener, String packageName,
+ @Nullable String featureId) {
synchronized (mGnssStatusListeners) {
return addGnssDataListenerLocked(
listener,
packageName,
+ featureId,
"Gnss status",
mGnssStatusProvider,
mGnssStatusListeners,
@@ -636,12 +640,13 @@
* @return true if listener is successfully added, false otherwise
*/
public boolean addGnssMeasurementsListener(
- IGnssMeasurementsListener listener, String packageName,
+ IGnssMeasurementsListener listener, String packageName, @Nullable String featureId,
@NonNull String listenerIdentifier) {
synchronized (mGnssMeasurementsListeners) {
return addGnssDataListenerLocked(
listener,
packageName,
+ featureId,
listenerIdentifier,
mGnssMeasurementsProvider,
mGnssMeasurementsListeners,
@@ -695,11 +700,12 @@
*/
public boolean addGnssNavigationMessageListener(
IGnssNavigationMessageListener listener, String packageName,
- @NonNull String listenerIdentifier) {
+ @Nullable String featureId, @NonNull String listenerIdentifier) {
synchronized (mGnssNavigationMessageListeners) {
return addGnssDataListenerLocked(
listener,
packageName,
+ featureId,
listenerIdentifier,
mGnssNavigationMessageProvider,
mGnssNavigationMessageListeners,
@@ -713,8 +719,10 @@
* @param listener called when navigation message is received
*/
public void removeGnssNavigationMessageListener(IGnssNavigationMessageListener listener) {
- removeGnssDataListener(
- listener, mGnssNavigationMessageProvider, mGnssNavigationMessageListeners);
+ synchronized (mGnssNavigationMessageListeners) {
+ removeGnssDataListener(
+ listener, mGnssNavigationMessageProvider, mGnssNavigationMessageListeners);
+ }
}
/**
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 1d22b82..0a63bf8 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -1000,6 +1000,12 @@
@Override
public void onReportLocation(Location location) {
+ // likelihood of a 0,0 bug is far greater than this being a valid location
+ if (!isMock() && location.getLatitude() == 0 && location.getLongitude() == 0) {
+ Slog.w(TAG, "blocking 0,0 location from " + mName + " provider");
+ return;
+ }
+
synchronized (mLock) {
handleLocationChangedLocked(location, this);
}
@@ -1227,9 +1233,9 @@
PowerManager.WakeLock mWakeLock;
private Receiver(ILocationListener listener, PendingIntent intent, int pid, int uid,
- String packageName, WorkSource workSource, boolean hideFromAppOps,
- @NonNull String listenerIdentifier) {
- super(new CallerIdentity(uid, pid, packageName, listenerIdentifier),
+ String packageName, @Nullable String featureId, WorkSource workSource,
+ boolean hideFromAppOps, @NonNull String listenerIdentifier) {
+ super(new CallerIdentity(uid, pid, packageName, featureId, listenerIdentifier),
"LocationListener");
mListener = listener;
mPendingIntent = intent;
@@ -1354,7 +1360,8 @@
if (!currentlyMonitoring) {
if (allowMonitoring) {
return mAppOps.startOpNoThrow(op, mCallerIdentity.mUid,
- mCallerIdentity.mPackageName) == AppOpsManager.MODE_ALLOWED;
+ mCallerIdentity.mPackageName, false, mCallerIdentity.mFeatureId, null)
+ == AppOpsManager.MODE_ALLOWED;
}
} else {
if (!allowMonitoring
@@ -1539,11 +1546,11 @@
@Override
public boolean addGnssBatchingCallback(IBatchedLocationCallback callback, String packageName,
- String listenerIdentifier) {
+ String featureId, String listenerIdentifier) {
Preconditions.checkNotNull(listenerIdentifier);
return mGnssManagerService == null ? false : mGnssManagerService.addGnssBatchingCallback(
- callback, packageName, listenerIdentifier);
+ callback, packageName, featureId, listenerIdentifier);
}
@Override
@@ -1706,10 +1713,10 @@
}
private boolean reportLocationAccessNoThrow(int pid, int uid, String packageName,
- int allowedResolutionLevel, @Nullable String message) {
+ @Nullable String featureId, int allowedResolutionLevel, @Nullable String message) {
int op = resolutionLevelToOp(allowedResolutionLevel);
if (op >= 0) {
- if (mAppOps.noteOpNoThrow(op, uid, packageName, null, message)
+ if (mAppOps.noteOpNoThrow(op, uid, packageName, featureId, message)
!= AppOpsManager.MODE_ALLOWED) {
return false;
}
@@ -2143,12 +2150,12 @@
@GuardedBy("mLock")
private Receiver getReceiverLocked(ILocationListener listener, int pid, int uid,
- String packageName, WorkSource workSource, boolean hideFromAppOps,
- @NonNull String listenerIdentifier) {
+ String packageName, @Nullable String featureId, WorkSource workSource,
+ boolean hideFromAppOps, @NonNull String listenerIdentifier) {
IBinder binder = listener.asBinder();
Receiver receiver = mReceivers.get(binder);
if (receiver == null) {
- receiver = new Receiver(listener, null, pid, uid, packageName, workSource,
+ receiver = new Receiver(listener, null, pid, uid, packageName, featureId, workSource,
hideFromAppOps, listenerIdentifier);
if (!receiver.linkToListenerDeathNotificationLocked(
receiver.getListener().asBinder())) {
@@ -2161,10 +2168,11 @@
@GuardedBy("mLock")
private Receiver getReceiverLocked(PendingIntent intent, int pid, int uid, String packageName,
- WorkSource workSource, boolean hideFromAppOps, @NonNull String listenerIdentifier) {
+ @Nullable String featureId, WorkSource workSource, boolean hideFromAppOps,
+ @NonNull String listenerIdentifier) {
Receiver receiver = mReceivers.get(intent);
if (receiver == null) {
- receiver = new Receiver(null, intent, pid, uid, packageName, workSource,
+ receiver = new Receiver(null, intent, pid, uid, packageName, featureId, workSource,
hideFromAppOps, listenerIdentifier);
mReceivers.put(intent, receiver);
}
@@ -2227,7 +2235,8 @@
@Override
public void requestLocationUpdates(LocationRequest request, ILocationListener listener,
- PendingIntent intent, String packageName, String listenerIdentifier) {
+ PendingIntent intent, String packageName, String featureId,
+ String listenerIdentifier) {
Preconditions.checkNotNull(listenerIdentifier);
synchronized (mLock) {
@@ -2283,11 +2292,11 @@
Receiver receiver;
if (intent != null) {
- receiver = getReceiverLocked(intent, pid, uid, packageName, workSource,
- hideFromAppOps, listenerIdentifier);
+ receiver = getReceiverLocked(intent, pid, uid, packageName, featureId,
+ workSource, hideFromAppOps, listenerIdentifier);
} else {
- receiver = getReceiverLocked(listener, pid, uid, packageName, workSource,
- hideFromAppOps, listenerIdentifier);
+ receiver = getReceiverLocked(listener, pid, uid, packageName, featureId,
+ workSource, hideFromAppOps, listenerIdentifier);
}
requestLocationUpdatesLocked(sanitizedRequest, receiver, uid, packageName);
} finally {
@@ -2356,9 +2365,10 @@
synchronized (mLock) {
Receiver receiver;
if (intent != null) {
- receiver = getReceiverLocked(intent, pid, uid, packageName, null, false, "");
+ receiver = getReceiverLocked(intent, pid, uid, packageName, null, null, false, "");
} else {
- receiver = getReceiverLocked(listener, pid, uid, packageName, null, false, "");
+ receiver = getReceiverLocked(listener, pid, uid, packageName, null, null, false,
+ "");
}
long identity = Binder.clearCallingIdentity();
@@ -2402,7 +2412,7 @@
}
@Override
- public Location getLastLocation(LocationRequest r, String packageName) {
+ public Location getLastLocation(LocationRequest r, String packageName, String featureId) {
synchronized (mLock) {
LocationRequest request = r != null ? r : DEFAULT_LOCATION_REQUEST;
int allowedResolutionLevel = getCallerAllowedResolutionLevel();
@@ -2477,8 +2487,8 @@
}
// Don't report location access if there is no last location to deliver.
if (lastLocation != null) {
- if (!reportLocationAccessNoThrow(pid, uid, packageName, allowedResolutionLevel,
- null)) {
+ if (!reportLocationAccessNoThrow(pid, uid, packageName, featureId,
+ allowedResolutionLevel, null)) {
if (D) {
Log.d(TAG, "not returning last loc for no op app: " + packageName);
}
@@ -2495,9 +2505,9 @@
@Override
public boolean getCurrentLocation(LocationRequest locationRequest,
ICancellationSignal remoteCancellationSignal, ILocationListener listener,
- String packageName, String listenerIdentifier) {
+ String packageName, String featureId, String listenerIdentifier) {
// side effect of validating locationRequest and packageName
- Location lastLocation = getLastLocation(locationRequest, packageName);
+ Location lastLocation = getLastLocation(locationRequest, packageName, featureId);
if (lastLocation != null) {
long locationAgeMs = TimeUnit.NANOSECONDS.toMillis(
SystemClock.elapsedRealtimeNanos() - lastLocation.getElapsedRealtimeNanos());
@@ -2532,7 +2542,8 @@
}
}
- requestLocationUpdates(locationRequest, listener, null, packageName, listenerIdentifier);
+ requestLocationUpdates(locationRequest, listener, null, packageName, featureId,
+ listenerIdentifier);
CancellationSignal cancellationSignal = CancellationSignal.fromTransport(
remoteCancellationSignal);
if (cancellationSignal != null) {
@@ -2582,7 +2593,7 @@
@Override
public void requestGeofence(LocationRequest request, Geofence geofence, PendingIntent intent,
- String packageName, String listenerIdentifier) {
+ String packageName, String featureId, String listenerIdentifier) {
Preconditions.checkNotNull(listenerIdentifier);
if (request == null) request = DEFAULT_LOCATION_REQUEST;
@@ -2630,7 +2641,7 @@
}
mGeofenceManager.addFence(sanitizedRequest, geofence, intent, allowedResolutionLevel,
- uid, packageName, listenerIdentifier);
+ uid, packageName, featureId, listenerIdentifier);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2666,9 +2677,10 @@
}
@Override
- public boolean registerGnssStatusCallback(IGnssStatusListener listener, String packageName) {
+ public boolean registerGnssStatusCallback(IGnssStatusListener listener, String packageName,
+ String featureId) {
return mGnssManagerService == null ? false : mGnssManagerService.registerGnssStatusCallback(
- listener, packageName);
+ listener, packageName, featureId);
}
@Override
@@ -2678,12 +2690,12 @@
@Override
public boolean addGnssMeasurementsListener(IGnssMeasurementsListener listener,
- String packageName, String listenerIdentifier) {
+ String packageName, String featureId, String listenerIdentifier) {
Preconditions.checkNotNull(listenerIdentifier);
return mGnssManagerService == null ? false
- : mGnssManagerService.addGnssMeasurementsListener(listener, packageName,
- listenerIdentifier);
+ : mGnssManagerService.addGnssMeasurementsListener(listener, packageName, featureId,
+ listenerIdentifier);
}
@Override
@@ -2711,12 +2723,12 @@
@Override
public boolean addGnssNavigationMessageListener(IGnssNavigationMessageListener listener,
- String packageName, String listenerIdentifier) {
+ String packageName, String featureId, String listenerIdentifier) {
Preconditions.checkNotNull(listenerIdentifier);
return mGnssManagerService == null ? false
: mGnssManagerService.addGnssNavigationMessageListener(listener, packageName,
- listenerIdentifier);
+ featureId, listenerIdentifier);
}
@Override
@@ -3022,6 +3034,7 @@
receiver.mCallerIdentity.mPid,
receiver.mCallerIdentity.mUid,
receiver.mCallerIdentity.mPackageName,
+ receiver.mCallerIdentity.mFeatureId,
receiver.mAllowedResolutionLevel,
"Location sent to " + receiver.mCallerIdentity.mListenerIdentifier)) {
if (D) {
diff --git a/services/core/java/com/android/server/LocationUsageLogger.java b/services/core/java/com/android/server/LocationUsageLogger.java
index 4ca74bf..a8a3cc4 100644
--- a/services/core/java/com/android/server/LocationUsageLogger.java
+++ b/services/core/java/com/android/server/LocationUsageLogger.java
@@ -30,7 +30,7 @@
/**
* Logger for Location API usage logging.
*/
-class LocationUsageLogger {
+public class LocationUsageLogger {
private static final String TAG = "LocationUsageLogger";
private static final boolean D = Log.isLoggable(TAG, Log.DEBUG);
diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java
index 54504c3..3ba2210 100644
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -508,7 +508,7 @@
}
if (key.requestIntent != null) {
pw.print(prefix); pw.print("requestIntent=");
- pw.println(key.requestIntent.toShortString(false, true, true, true));
+ pw.println(key.requestIntent.toShortString(false, true, true, false));
}
if (sent || canceled) {
pw.print(prefix); pw.print("sent="); pw.print(sent);
diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java
index cc4b160..5106b0e4 100644
--- a/services/core/java/com/android/server/am/ServiceRecord.java
+++ b/services/core/java/com/android/server/am/ServiceRecord.java
@@ -256,7 +256,7 @@
}
if (intent != null) {
intent.getIntent().writeToProto(proto, ServiceRecordProto.INTENT, false, true, false,
- true);
+ false);
}
proto.write(ServiceRecordProto.PACKAGE_NAME, packageName);
proto.write(ServiceRecordProto.PROCESS_NAME, processName);
@@ -358,7 +358,7 @@
void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("intent={");
- pw.print(intent.getIntent().toShortString(false, true, false, true));
+ pw.print(intent.getIntent().toShortString(false, true, false, false));
pw.println('}');
pw.print(prefix); pw.print("packageName="); pw.println(packageName);
pw.print(prefix); pw.print("processName="); pw.println(processName);
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 17541911..0ea913f 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -560,8 +560,8 @@
Slog.i(TAG, "Stopping pre-created user " + userInfo.toFullString());
// Pre-created user was started right after creation so services could properly
// intialize it; it should be stopped right away as it's not really a "real" user.
- // TODO(b/140750212): in the long-term, we should add a onCreateUser() callback
- // on SystemService instead.
+ // TODO(b/143092698): in the long-term, it might be better to add a onCreateUser()
+ // callback on SystemService instead.
stopUser(userInfo.id, /* force= */ true, /* stopUserCallback= */ null,
/* keyEvictedCallback= */ null);
return;
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java
index 087c84f..67d3589 100644
--- a/services/core/java/com/android/server/attention/AttentionManagerService.java
+++ b/services/core/java/com/android/server/attention/AttentionManagerService.java
@@ -23,7 +23,6 @@
import android.Manifest;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
-import android.app.ActivityManager;
import android.attention.AttentionManagerInternal;
import android.attention.AttentionManagerInternal.AttentionCallbackInternal;
import android.content.BroadcastReceiver;
@@ -300,7 +299,8 @@
@GuardedBy("mLock")
@VisibleForTesting
protected UserState getOrCreateCurrentUserStateLocked() {
- return getOrCreateUserStateLocked(ActivityManager.getCurrentUser());
+ // Doesn't need to cache the states of different users.
+ return getOrCreateUserStateLocked(0);
}
@GuardedBy("mLock")
@@ -318,7 +318,8 @@
@Nullable
@VisibleForTesting
protected UserState peekCurrentUserStateLocked() {
- return peekUserStateLocked(ActivityManager.getCurrentUser());
+ // Doesn't need to cache the states of different users.
+ return peekUserStateLocked(0);
}
@GuardedBy("mLock")
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index a6ac17d..0d493b8 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1018,7 +1018,14 @@
synchronized (mAudioPolicies) {
for (AudioPolicyProxy policy : mAudioPolicies.values()) {
- policy.connectMixes();
+ final int status = policy.connectMixes();
+ if (status != AudioSystem.SUCCESS) {
+ // note that PERMISSION_DENIED may also indicate trouble getting to APService
+ Log.e(TAG, "onAudioServerDied: error "
+ + AudioSystem.audioSystemErrorToString(status)
+ + " when connecting mixes for policy " + policy.toLogFriendlyString());
+ policy.release();
+ }
}
}
@@ -7019,16 +7026,8 @@
}
public void binderDied() {
- synchronized (mAudioPolicies) {
- Log.i(TAG, "audio policy " + mPolicyCallback + " died");
- release();
- mAudioPolicies.remove(mPolicyCallback.asBinder());
- }
- if (mIsVolumeController) {
- synchronized (mExtVolumeControllerLock) {
- mExtVolumeController = null;
- }
- }
+ Log.i(TAG, "audio policy " + mPolicyCallback + " died");
+ release();
}
String getRegistrationId() {
@@ -7052,9 +7051,20 @@
Log.e(TAG, "Fail to unregister Audiopolicy callback from MediaProjection");
}
}
+ if (mIsVolumeController) {
+ synchronized (mExtVolumeControllerLock) {
+ mExtVolumeController = null;
+ }
+ }
final long identity = Binder.clearCallingIdentity();
AudioSystem.registerPolicyMixes(mMixes, false);
Binder.restoreCallingIdentity(identity);
+ synchronized (mAudioPolicies) {
+ mAudioPolicies.remove(mPolicyCallback.asBinder());
+ }
+ try {
+ mPolicyCallback.notifyUnregistration();
+ } catch (RemoteException e) { }
}
boolean hasMixAffectingUsage(int usage, int excludedFlags) {
@@ -7105,7 +7115,7 @@
}
}
- int connectMixes() {
+ @AudioSystem.AudioSystemError int connectMixes() {
final long identity = Binder.clearCallingIdentity();
int status = AudioSystem.registerPolicyMixes(mMixes, true);
Binder.restoreCallingIdentity(identity);
diff --git a/core/java/com/android/server/backup/SystemBackupAgent.java b/services/core/java/com/android/server/backup/SystemBackupAgent.java
similarity index 100%
rename from core/java/com/android/server/backup/SystemBackupAgent.java
rename to services/core/java/com/android/server/backup/SystemBackupAgent.java
diff --git a/core/java/com/android/server/backup/UsageStatsBackupHelper.java b/services/core/java/com/android/server/backup/UsageStatsBackupHelper.java
similarity index 100%
rename from core/java/com/android/server/backup/UsageStatsBackupHelper.java
rename to services/core/java/com/android/server/backup/UsageStatsBackupHelper.java
diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java
index 4f1db3c..44c81fc 100644
--- a/services/core/java/com/android/server/biometrics/BiometricService.java
+++ b/services/core/java/com/android/server/biometrics/BiometricService.java
@@ -37,13 +37,12 @@
import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.BiometricsProtoEnums;
+import android.hardware.biometrics.IBiometricAuthenticator;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.biometrics.IBiometricService;
import android.hardware.biometrics.IBiometricServiceReceiver;
import android.hardware.biometrics.IBiometricServiceReceiverInternal;
-import android.hardware.face.FaceManager;
import android.hardware.face.IFaceService;
-import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.IFingerprintService;
import android.net.Uri;
import android.os.Binder;
@@ -68,6 +67,8 @@
import com.android.internal.os.SomeArgs;
import com.android.internal.statusbar.IStatusBarService;
import com.android.server.SystemService;
+import com.android.server.biometrics.face.FaceAuthenticator;
+import com.android.server.biometrics.fingerprint.FingerprintAuthenticator;
import java.util.ArrayList;
import java.util.HashMap;
@@ -95,11 +96,6 @@
private static final int MSG_CANCEL_AUTHENTICATION = 10;
private static final int MSG_ON_AUTHENTICATION_TIMED_OUT = 11;
private static final int MSG_ON_DEVICE_CREDENTIAL_PRESSED = 12;
- private static final int[] FEATURE_ID = {
- TYPE_FINGERPRINT,
- TYPE_IRIS,
- TYPE_FACE
- };
/**
* Authentication either just called and we have not transitioned to the CALLED state, or
@@ -172,7 +168,7 @@
byte[] mTokenEscrow;
// Waiting for SystemUI to complete animation
int mErrorEscrow;
- String mErrorStringEscrow;
+ int mVendorCodeEscrow;
// Timestamp when authentication started
private long mStartTimeMs;
@@ -219,19 +215,15 @@
private final Injector mInjector;
@VisibleForTesting
final IBiometricService.Stub mImpl;
+ private final boolean mHasFeatureFace;
private final boolean mHasFeatureFingerprint;
private final boolean mHasFeatureIris;
- private final boolean mHasFeatureFace;
@VisibleForTesting
final SettingObserver mSettingObserver;
private final List<EnabledOnKeyguardCallback> mEnabledOnKeyguardCallbacks;
private final Random mRandom = new Random();
@VisibleForTesting
- IFingerprintService mFingerprintService;
- @VisibleForTesting
- IFaceService mFaceService;
- @VisibleForTesting
IStatusBarService mStatusBarService;
@VisibleForTesting
KeyStore mKeyStore;
@@ -262,7 +254,7 @@
}
case MSG_ON_AUTHENTICATION_REJECTED: {
- handleAuthenticationRejected((String) msg.obj /* failureReason */);
+ handleAuthenticationRejected();
break;
}
@@ -270,8 +262,9 @@
SomeArgs args = (SomeArgs) msg.obj;
handleOnError(
args.argi1 /* cookie */,
- args.argi2 /* error */,
- (String) args.arg1 /* message */);
+ args.argi2 /* modality */,
+ args.argi3 /* error */,
+ args.argi4 /* vendorCode */);
args.recycle();
break;
}
@@ -331,7 +324,12 @@
}
case MSG_ON_AUTHENTICATION_TIMED_OUT: {
- handleAuthenticationTimedOut((String) msg.obj /* errorMessage */);
+ SomeArgs args = (SomeArgs) msg.obj;
+ handleAuthenticationTimedOut(
+ args.argi1 /* modality */,
+ args.argi2 /* error */,
+ args.argi3 /* vendorCode */);
+ args.recycle();
break;
}
@@ -347,21 +345,23 @@
}
};
- private final class AuthenticatorWrapper {
- final int mType;
- final BiometricAuthenticator mAuthenticator;
+ /**
+ * Wraps IBiometricAuthenticator implementation and stores information about the authenticator.
+ * TODO(b/141025588): Consider refactoring the tests to not rely on this implementation detail.
+ */
+ @VisibleForTesting
+ public static final class AuthenticatorWrapper {
+ public final int id;
+ public final int strength;
+ public final int modality;
+ public final IBiometricAuthenticator impl;
- AuthenticatorWrapper(int type, BiometricAuthenticator authenticator) {
- mType = type;
- mAuthenticator = authenticator;
- }
-
- int getType() {
- return mType;
- }
-
- BiometricAuthenticator getAuthenticator() {
- return mAuthenticator;
+ AuthenticatorWrapper(int id, int strength, int modality,
+ IBiometricAuthenticator impl) {
+ this.id = id;
+ this.strength = strength;
+ this.modality = modality;
+ this.impl = impl;
}
}
@@ -521,23 +521,28 @@
@Override
public void onAuthenticationFailed()
throws RemoteException {
- String failureReason = getContext().getString(R.string.biometric_not_recognized);
- Slog.v(TAG, "onAuthenticationFailed: " + failureReason);
- mHandler.obtainMessage(MSG_ON_AUTHENTICATION_REJECTED, failureReason).sendToTarget();
+ Slog.v(TAG, "onAuthenticationFailed");
+ mHandler.obtainMessage(MSG_ON_AUTHENTICATION_REJECTED).sendToTarget();
}
@Override
- public void onError(int cookie, int error, String message) throws RemoteException {
+ public void onError(int cookie, int modality, int error, int vendorCode)
+ throws RemoteException {
// Determine if error is hard or soft error. Certain errors (such as TIMEOUT) are
// soft errors and we should allow the user to try authenticating again instead of
// dismissing BiometricPrompt.
if (error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT) {
- mHandler.obtainMessage(MSG_ON_AUTHENTICATION_TIMED_OUT, message).sendToTarget();
+ SomeArgs args = SomeArgs.obtain();
+ args.argi1 = modality;
+ args.argi2 = error;
+ args.argi3 = vendorCode;
+ mHandler.obtainMessage(MSG_ON_AUTHENTICATION_TIMED_OUT, args).sendToTarget();
} else {
SomeArgs args = SomeArgs.obtain();
args.argi1 = cookie;
- args.argi2 = error;
- args.arg1 = message;
+ args.argi2 = modality;
+ args.argi3 = error;
+ args.argi4 = vendorCode;
mHandler.obtainMessage(MSG_ON_ERROR, args).sendToTarget();
}
}
@@ -666,7 +671,8 @@
final long ident = Binder.clearCallingIdentity();
int error;
try {
- final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId);
+ final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId,
+ opPackageName);
error = result.second;
} finally {
Binder.restoreCallingIdentity(ident);
@@ -675,22 +681,30 @@
}
@Override
- public boolean hasEnrolledBiometrics(int userId) {
+ public boolean hasEnrolledBiometrics(int userId, String opPackageName) {
checkInternalPermission();
final long ident = Binder.clearCallingIdentity();
try {
- for (int i = 0; i < mAuthenticators.size(); i++) {
- if (mAuthenticators.get(i).mAuthenticator.hasEnrolledTemplates(userId)) {
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ if (authenticator.impl.hasEnrolledTemplates(userId, opPackageName)) {
return true;
}
}
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
} finally {
Binder.restoreCallingIdentity(ident);
}
return false;
}
+ @Override
+ public void registerAuthenticator(int id, int strength, int modality,
+ IBiometricAuthenticator authenticator) {
+ mAuthenticators.add(new AuthenticatorWrapper(id, strength, modality, authenticator));
+ }
+
@Override // Binder call
public void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback)
throws RemoteException {
@@ -710,9 +724,11 @@
checkInternalPermission();
final long ident = Binder.clearCallingIdentity();
try {
- for (int i = 0; i < mAuthenticators.size(); i++) {
- mAuthenticators.get(i).getAuthenticator().setActiveUser(userId);
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ authenticator.impl.setActiveUser(userId);
}
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -723,11 +739,8 @@
checkInternalPermission();
final long ident = Binder.clearCallingIdentity();
try {
- if (mFingerprintService != null) {
- mFingerprintService.resetTimeout(token);
- }
- if (mFaceService != null) {
- mFaceService.resetLockout(token);
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ authenticator.impl.resetLockout(token);
}
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
@@ -750,40 +763,69 @@
}
}
+ /**
+ * Class for injecting dependencies into BiometricService.
+ * TODO(b/141025588): Replace with a dependency injection framework (e.g. Guice, Dagger).
+ */
@VisibleForTesting
- static class Injector {
- IActivityManager getActivityManagerService() {
+ public static class Injector {
+
+ @VisibleForTesting
+ public IActivityManager getActivityManagerService() {
return ActivityManager.getService();
}
- IStatusBarService getStatusBarService() {
+ @VisibleForTesting
+ public IStatusBarService getStatusBarService() {
return IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
}
- IFingerprintService getFingerprintService() {
- return IFingerprintService.Stub.asInterface(
- ServiceManager.getService(Context.FINGERPRINT_SERVICE));
+ /**
+ * Allows to mock FaceAuthenticator for testing.
+ */
+ @VisibleForTesting
+ public IBiometricAuthenticator getFingerprintAuthenticator() {
+ return new FingerprintAuthenticator(IFingerprintService.Stub.asInterface(
+ ServiceManager.getService(Context.FINGERPRINT_SERVICE)));
}
- IFaceService getFaceService() {
- return IFaceService.Stub.asInterface(ServiceManager.getService(Context.FACE_SERVICE));
+ /**
+ * Allows to mock FaceAuthenticator for testing.
+ */
+ @VisibleForTesting
+ public IBiometricAuthenticator getFaceAuthenticator() {
+ return new FaceAuthenticator(
+ IFaceService.Stub.asInterface(ServiceManager.getService(Context.FACE_SERVICE)));
}
- SettingObserver getSettingObserver(Context context, Handler handler,
+ /**
+ * Allows to mock SettingObserver for testing.
+ */
+ @VisibleForTesting
+ public SettingObserver getSettingObserver(Context context, Handler handler,
List<EnabledOnKeyguardCallback> callbacks) {
return new SettingObserver(context, handler, callbacks);
}
- KeyStore getKeyStore() {
+ @VisibleForTesting
+ public KeyStore getKeyStore() {
return KeyStore.getInstance();
}
- boolean isDebugEnabled(Context context, int userId) {
+ /**
+ * Allows to enable/disable debug logs.
+ */
+ @VisibleForTesting
+ public boolean isDebugEnabled(Context context, int userId) {
return Utils.isDebugEnabled(context, userId);
}
- void publishBinderService(BiometricService service, IBiometricService.Stub impl) {
+ /**
+ * Allows to stub publishBinderService(...) for testing.
+ */
+ @VisibleForTesting
+ public void publishBinderService(BiometricService service, IBiometricService.Stub impl) {
service.publishBinderService(Context.BIOMETRIC_SERVICE, impl);
}
}
@@ -812,9 +854,9 @@
mEnabledOnKeyguardCallbacks);
final PackageManager pm = context.getPackageManager();
+ mHasFeatureFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE);
mHasFeatureFingerprint = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
mHasFeatureIris = pm.hasSystemFeature(PackageManager.FEATURE_IRIS);
- mHasFeatureFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE);
try {
injector.getActivityManagerService().registerUserSwitchObserver(
@@ -833,26 +875,30 @@
@Override
public void onStart() {
- // TODO: maybe get these on-demand
- if (mHasFeatureFingerprint) {
- mFingerprintService = mInjector.getFingerprintService();
- }
- if (mHasFeatureFace) {
- mFaceService = mInjector.getFaceService();
+ // TODO(b/141025588): remove this code block once AuthService is integrated.
+ {
+ if (mHasFeatureFace) {
+ try {
+ mImpl.registerAuthenticator(0, 0, TYPE_FACE, mInjector.getFaceAuthenticator());
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
+ }
+ }
+ if (mHasFeatureFingerprint) {
+ try {
+ mImpl.registerAuthenticator(0, 0, TYPE_FINGERPRINT,
+ mInjector.getFingerprintAuthenticator());
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
+ }
+ }
+ if (mHasFeatureIris) {
+ Slog.e(TAG, "Iris is not supported");
+ }
}
mKeyStore = mInjector.getKeyStore();
mStatusBarService = mInjector.getStatusBarService();
-
- // Cache the authenticators
- for (int featureId : FEATURE_ID) {
- if (hasFeature(featureId)) {
- AuthenticatorWrapper authenticator =
- new AuthenticatorWrapper(featureId, getAuthenticator(featureId));
- mAuthenticators.add(authenticator);
- }
- }
-
mInjector.publishBinderService(this, mImpl);
}
@@ -868,7 +914,7 @@
* {@link BiometricAuthenticator#TYPE_FACE}
* and the error containing one of the {@link BiometricConstants} errors.
*/
- private Pair<Integer, Integer> checkAndGetBiometricModality(int userId) {
+ private Pair<Integer, Integer> checkAndGetBiometricModality(int userId, String opPackageName) {
// No biometric features, send error
if (mAuthenticators.isEmpty()) {
return new Pair<>(TYPE_NONE, BiometricConstants.BIOMETRIC_ERROR_HW_NOT_PRESENT);
@@ -886,23 +932,26 @@
int modality = TYPE_NONE;
int firstHwAvailable = TYPE_NONE;
- for (AuthenticatorWrapper authenticatorWrapper : mAuthenticators) {
- modality = authenticatorWrapper.getType();
- BiometricAuthenticator authenticator = authenticatorWrapper.getAuthenticator();
- if (authenticator.isHardwareDetected()) {
- isHardwareDetected = true;
- if (firstHwAvailable == TYPE_NONE) {
- // Store the first one since we want to return the error in correct priority
- // order.
- firstHwAvailable = modality;
- }
- if (authenticator.hasEnrolledTemplates(userId)) {
- hasTemplatesEnrolled = true;
- if (isEnabledForApp(modality, userId)) {
- enabledForApps = true;
- break;
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ modality = authenticator.modality;
+ try {
+ if (authenticator.impl.isHardwareDetected(opPackageName)) {
+ isHardwareDetected = true;
+ if (firstHwAvailable == TYPE_NONE) {
+ // Store the first one since we want to return the error in correct priority
+ // order.
+ firstHwAvailable = modality;
+ }
+ if (authenticator.impl.hasEnrolledTemplates(userId, opPackageName)) {
+ hasTemplatesEnrolled = true;
+ if (isEnabledForApp(modality, userId)) {
+ enabledForApps = true;
+ break;
+ }
}
}
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
}
}
@@ -926,7 +975,7 @@
}
private boolean isEnabledForApp(int modality, int userId) {
- switch(modality) {
+ switch (modality) {
case TYPE_FINGERPRINT:
return true;
case TYPE_IRIS:
@@ -939,49 +988,6 @@
}
}
- private String getErrorString(int type, int error, int vendorCode) {
- switch (type) {
- case TYPE_FINGERPRINT:
- return FingerprintManager.getErrorString(getContext(), error, vendorCode);
- case TYPE_IRIS:
- Slog.w(TAG, "Modality not supported");
- return null; // not supported
- case TYPE_FACE:
- return FaceManager.getErrorString(getContext(), error, vendorCode);
- default:
- Slog.w(TAG, "Unable to get error string for modality: " + type);
- return null;
- }
- }
-
- private BiometricAuthenticator getAuthenticator(int type) {
- switch (type) {
- case TYPE_FINGERPRINT:
- return (FingerprintManager)
- getContext().getSystemService(Context.FINGERPRINT_SERVICE);
- case TYPE_IRIS:
- return null;
- case TYPE_FACE:
- return (FaceManager)
- getContext().getSystemService(Context.FACE_SERVICE);
- default:
- return null;
- }
- }
-
- private boolean hasFeature(int type) {
- switch (type) {
- case TYPE_FINGERPRINT:
- return mHasFeatureFingerprint;
- case TYPE_IRIS:
- return mHasFeatureIris;
- case TYPE_FACE:
- return mHasFeatureFace;
- default:
- return false;
- }
- }
-
private void logDialogDismissed(int reason) {
if (reason == BiometricPrompt.DISMISSED_REASON_BIOMETRIC_CONFIRMED) {
// Explicit auth, authentication confirmed.
@@ -1081,14 +1087,14 @@
// Notify SysUI that the biometric has been authenticated. SysUI already knows
// the implicit/explicit state and will react accordingly.
- mStatusBarService.onBiometricAuthenticated(true, null /* failureReason */);
+ mStatusBarService.onBiometricAuthenticated();
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
}
}
- private void handleAuthenticationRejected(String failureReason) {
- Slog.v(TAG, "handleAuthenticationRejected: " + failureReason);
+ private void handleAuthenticationRejected() {
+ Slog.v(TAG, "handleAuthenticationRejected()");
try {
// Should never happen, log this to catch bad HAL behavior (e.g. auth succeeded
// after user dismissed/canceled dialog).
@@ -1097,7 +1103,8 @@
return;
}
- mStatusBarService.onBiometricAuthenticated(false, failureReason);
+ mStatusBarService.onBiometricError(TYPE_NONE,
+ BiometricConstants.BIOMETRIC_PAUSED_REJECTED, 0 /* vendorCode */);
// TODO: This logic will need to be updated if BP is multi-modal
if ((mCurrentAuthSession.mModality & TYPE_FACE) != 0) {
@@ -1112,8 +1119,9 @@
}
}
- private void handleAuthenticationTimedOut(String message) {
- Slog.v(TAG, "handleAuthenticationTimedOut: " + message);
+ private void handleAuthenticationTimedOut(int modality, int error, int vendorCode) {
+ Slog.v(TAG, String.format("handleAuthenticationTimedOut(%d, %d, %d)", modality, error,
+ vendorCode));
try {
// Should never happen, log this to catch bad HAL behavior (e.g. auth succeeded
// after user dismissed/canceled dialog).
@@ -1122,14 +1130,14 @@
return;
}
- mStatusBarService.onBiometricAuthenticated(false, message);
+ mStatusBarService.onBiometricError(modality, error, vendorCode);
mCurrentAuthSession.mState = STATE_AUTH_PAUSED;
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
}
}
- private void handleOnError(int cookie, int error, String message) {
+ private void handleOnError(int cookie, int modality, int error, int vendorCode) {
Slog.d(TAG, "handleOnError: " + error + " cookie: " + cookie);
// Errors can either be from the current auth session or the pending auth session.
// The pending auth session may receive errors such as ERROR_LOCKOUT before
@@ -1140,7 +1148,7 @@
try {
if (mCurrentAuthSession != null && mCurrentAuthSession.containsCookie(cookie)) {
mCurrentAuthSession.mErrorEscrow = error;
- mCurrentAuthSession.mErrorStringEscrow = message;
+ mCurrentAuthSession.mVendorCodeEscrow = vendorCode;
if (mCurrentAuthSession.mState == STATE_AUTH_STARTED) {
final boolean errorLockout = error == BiometricConstants.BIOMETRIC_ERROR_LOCKOUT
@@ -1148,20 +1156,20 @@
if (mCurrentAuthSession.isAllowDeviceCredential() && errorLockout) {
// SystemUI handles transition from biometric to device credential.
mCurrentAuthSession.mState = STATE_SHOWING_DEVICE_CREDENTIAL;
- mStatusBarService.onBiometricError(error, message);
+ mStatusBarService.onBiometricError(modality, error, vendorCode);
} else {
mCurrentAuthSession.mState = STATE_ERROR_PENDING_SYSUI;
if (error == BiometricConstants.BIOMETRIC_ERROR_CANCELED) {
mStatusBarService.hideAuthenticationDialog();
} else {
- mStatusBarService.onBiometricError(error, message);
+ mStatusBarService.onBiometricError(modality, error, vendorCode);
}
}
} else if (mCurrentAuthSession.mState == STATE_AUTH_PAUSED) {
// In the "try again" state, we should forward canceled errors to
// the client and and clean up. The only error we should get here is
// ERROR_CANCELED due to another client kicking us out.
- mCurrentAuthSession.mClientReceiver.onError(error, message);
+ mCurrentAuthSession.mClientReceiver.onError(modality, error, vendorCode);
mStatusBarService.hideAuthenticationDialog();
mCurrentAuthSession = null;
} else if (mCurrentAuthSession.mState == STATE_SHOWING_DEVICE_CREDENTIAL) {
@@ -1197,7 +1205,7 @@
mCurrentAuthSession.mUserId,
mCurrentAuthSession.mOpPackageName);
} else {
- mPendingAuthSession.mClientReceiver.onError(error, message);
+ mPendingAuthSession.mClientReceiver.onError(modality, error, vendorCode);
mPendingAuthSession = null;
}
} else {
@@ -1261,8 +1269,10 @@
case BiometricPrompt.DISMISSED_REASON_USER_CANCEL:
mCurrentAuthSession.mClientReceiver.onError(
+ mCurrentAuthSession.mModality,
BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED,
- getContext().getString(R.string.biometric_error_user_canceled));
+ 0 /* vendorCode */
+ );
// Cancel authentication. Skip the token/package check since we are cancelling
// from system server. The interface is permission protected so this is fine.
cancelInternal(null /* token */, null /* package */, false /* fromClient */);
@@ -1270,8 +1280,11 @@
case BiometricPrompt.DISMISSED_REASON_SERVER_REQUESTED:
case BiometricPrompt.DISMISSED_REASON_ERROR:
- mCurrentAuthSession.mClientReceiver.onError(mCurrentAuthSession.mErrorEscrow,
- mCurrentAuthSession.mErrorStringEscrow);
+ mCurrentAuthSession.mClientReceiver.onError(
+ mCurrentAuthSession.mModality,
+ mCurrentAuthSession.mErrorEscrow,
+ mCurrentAuthSession.mVendorCodeEscrow
+ );
break;
default:
@@ -1354,30 +1367,35 @@
mPendingAuthSession = null;
mCurrentAuthSession.mState = STATE_AUTH_STARTED;
- try {
- int modality = TYPE_NONE;
- it = mCurrentAuthSession.mModalitiesMatched.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry<Integer, Integer> pair = (Map.Entry) it.next();
- if (pair.getKey() == TYPE_FINGERPRINT) {
- mFingerprintService.startPreparedClient(pair.getValue());
- } else if (pair.getKey() == TYPE_IRIS) {
- Slog.e(TAG, "Iris unsupported");
- } else if (pair.getKey() == TYPE_FACE) {
- mFaceService.startPreparedClient(pair.getValue());
- } else {
- Slog.e(TAG, "Unknown modality: " + pair.getKey());
+ int modality = TYPE_NONE;
+ it = mCurrentAuthSession.mModalitiesMatched.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<Integer, Integer> pair = (Map.Entry) it.next();
+ boolean foundAuthenticator = false;
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ if (authenticator.modality == pair.getKey()) {
+ foundAuthenticator = true;
+ try {
+ authenticator.impl.startPreparedClient(pair.getValue());
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
+ }
}
- modality |= pair.getKey();
}
+ if (!foundAuthenticator) {
+ Slog.e(TAG, "Unknown modality: " + pair.getKey());
+ }
+ modality |= pair.getKey();
+ }
- if (!continuing) {
+ if (!continuing) {
+ try {
mStatusBarService.showAuthenticationDialog(mCurrentAuthSession.mBundle,
mInternalReceiver, modality, requireConfirmation, userId,
mCurrentAuthSession.mOpPackageName);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
}
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
}
}
}
@@ -1387,7 +1405,8 @@
int callingUid, int callingPid, int callingUserId) {
mHandler.post(() -> {
- final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId);
+ final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId,
+ opPackageName);
final int modality = result.first;
final int error = result.second;
@@ -1400,23 +1419,7 @@
} else if (error != BiometricConstants.BIOMETRIC_SUCCESS) {
// Check for errors, notify callback, and return
try {
- final String hardwareUnavailable =
- getContext().getString(R.string.biometric_error_hw_unavailable);
- switch (error) {
- case BiometricConstants.BIOMETRIC_ERROR_HW_NOT_PRESENT:
- receiver.onError(error, hardwareUnavailable);
- break;
- case BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE:
- receiver.onError(error, hardwareUnavailable);
- break;
- case BiometricConstants.BIOMETRIC_ERROR_NO_BIOMETRICS:
- receiver.onError(error,
- getErrorString(modality, error, 0 /* vendorCode */));
- break;
- default:
- Slog.e(TAG, "Unhandled error");
- break;
- }
+ receiver.onError(modality, error, 0 /* vendorCode */);
} catch (RemoteException e) {
Slog.e(TAG, "Unable to send error", e);
}
@@ -1435,41 +1438,41 @@
* modality/modalities to start authenticating with. authenticateInternal() should only be
* used for:
* 1) Preparing <Biometric>Services for authentication when BiometricPrompt#authenticate is,
- * invoked, shortly after which BiometricPrompt is shown and authentication starts
+ * invoked, shortly after which BiometricPrompt is shown and authentication starts
* 2) Preparing <Biometric>Services for authentication when BiometricPrompt is already shown
- * and the user has pressed "try again"
+ * and the user has pressed "try again"
*/
private void authenticateInternal(IBinder token, long sessionId, int userId,
IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle,
int callingUid, int callingPid, int callingUserId, int modality) {
+ boolean requireConfirmation = bundle.getBoolean(
+ BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true /* default */);
+ if ((modality & TYPE_FACE) != 0) {
+ // Check if the user has forced confirmation to be required in Settings.
+ requireConfirmation = requireConfirmation
+ || mSettingObserver.getFaceAlwaysRequireConfirmation(userId);
+ }
+ // Generate random cookies to pass to the services that should prepare to start
+ // authenticating. Store the cookie here and wait for all services to "ack"
+ // with the cookie. Once all cookies are received, we can show the prompt
+ // and let the services start authenticating. The cookie should be non-zero.
+ final int cookie = mRandom.nextInt(Integer.MAX_VALUE - 1) + 1;
+ final int authenticators = bundle.getInt(BiometricPrompt.KEY_AUTHENTICATORS_ALLOWED);
+ Slog.d(TAG, "Creating auth session. Modality: " + modality
+ + ", cookie: " + cookie
+ + ", authenticators: " + authenticators);
+ final HashMap<Integer, Integer> modalities = new HashMap<>();
+
+ // If it's only device credential, we don't need to wait - LockSettingsService is
+ // always ready to check credential (SystemUI invokes that path).
+ if ((authenticators & ~Authenticator.TYPE_CREDENTIAL) != 0) {
+ modalities.put(modality, cookie);
+ }
+ mPendingAuthSession = new AuthSession(modalities, token, sessionId, userId,
+ receiver, opPackageName, bundle, callingUid, callingPid, callingUserId,
+ modality, requireConfirmation);
+
try {
- boolean requireConfirmation = bundle.getBoolean(
- BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true /* default */);
- if ((modality & TYPE_FACE) != 0) {
- // Check if the user has forced confirmation to be required in Settings.
- requireConfirmation = requireConfirmation
- || mSettingObserver.getFaceAlwaysRequireConfirmation(userId);
- }
- // Generate random cookies to pass to the services that should prepare to start
- // authenticating. Store the cookie here and wait for all services to "ack"
- // with the cookie. Once all cookies are received, we can show the prompt
- // and let the services start authenticating. The cookie should be non-zero.
- final int cookie = mRandom.nextInt(Integer.MAX_VALUE - 1) + 1;
- final int authenticators = bundle.getInt(BiometricPrompt.KEY_AUTHENTICATORS_ALLOWED);
- Slog.d(TAG, "Creating auth session. Modality: " + modality
- + ", cookie: " + cookie
- + ", authenticators: " + authenticators);
- final HashMap<Integer, Integer> modalities = new HashMap<>();
-
- // If it's only device credential, we don't need to wait - LockSettingsService is
- // always ready to check credential (SystemUI invokes that path).
- if ((authenticators & ~Authenticator.TYPE_CREDENTIAL) != 0) {
- modalities.put(modality, cookie);
- }
- mPendingAuthSession = new AuthSession(modalities, token, sessionId, userId,
- receiver, opPackageName, bundle, callingUid, callingPid, callingUserId,
- modality, requireConfirmation);
-
if (authenticators == Authenticator.TYPE_CREDENTIAL) {
mPendingAuthSession.mState = STATE_SHOWING_DEVICE_CREDENTIAL;
mCurrentAuthSession = mPendingAuthSession;
@@ -1484,19 +1487,10 @@
mCurrentAuthSession.mOpPackageName);
} else {
mPendingAuthSession.mState = STATE_AUTH_CALLED;
- // No polymorphism :(
- if ((modality & TYPE_FINGERPRINT) != 0) {
- mFingerprintService.prepareForAuthentication(token, sessionId, userId,
- mInternalReceiver, opPackageName, cookie,
- callingUid, callingPid, callingUserId);
- }
- if ((modality & TYPE_IRIS) != 0) {
- Slog.w(TAG, "Iris unsupported");
- }
- if ((modality & TYPE_FACE) != 0) {
- mFaceService.prepareForAuthentication(requireConfirmation,
- token, sessionId, userId, mInternalReceiver, opPackageName,
- cookie, callingUid, callingPid, callingUserId);
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ authenticator.impl.prepareForAuthentication(requireConfirmation, token,
+ sessionId, userId, mInternalReceiver, opPackageName, cookie, callingUid,
+ callingPid, callingUserId);
}
}
} catch (RemoteException e) {
@@ -1517,11 +1511,10 @@
try {
// Send error to client
mCurrentAuthSession.mClientReceiver.onError(
+ mCurrentAuthSession.mModality,
BiometricConstants.BIOMETRIC_ERROR_CANCELED,
- getContext().getString(
- com.android.internal.R.string.biometric_error_user_canceled)
+ 0 /* vendorCode */
);
-
mCurrentAuthSession = null;
mStatusBarService.hideAuthenticationDialog();
} catch (RemoteException e) {
@@ -1537,30 +1530,25 @@
final int callingPid = Binder.getCallingPid();
final int callingUserId = UserHandle.getCallingUserId();
- try {
- if (mCurrentAuthSession == null) {
- Slog.w(TAG, "Skipping cancelInternal");
- return;
- } else if (mCurrentAuthSession.mState != STATE_AUTH_STARTED) {
- Slog.w(TAG, "Skipping cancelInternal, state: " + mCurrentAuthSession.mState);
- return;
- }
+ if (mCurrentAuthSession == null) {
+ Slog.w(TAG, "Skipping cancelInternal");
+ return;
+ } else if (mCurrentAuthSession.mState != STATE_AUTH_STARTED) {
+ Slog.w(TAG, "Skipping cancelInternal, state: " + mCurrentAuthSession.mState);
+ return;
+ }
- // TODO: For multiple modalities, send a single ERROR_CANCELED only when all
- // drivers have canceled authentication.
- if ((mCurrentAuthSession.mModality & TYPE_FINGERPRINT) != 0) {
- mFingerprintService.cancelAuthenticationFromService(token, opPackageName,
- callingUid, callingPid, callingUserId, fromClient);
+ // TODO: For multiple modalities, send a single ERROR_CANCELED only when all
+ // drivers have canceled authentication.
+ for (AuthenticatorWrapper authenticator : mAuthenticators) {
+ if ((authenticator.modality & mCurrentAuthSession.mModality) != 0) {
+ try {
+ authenticator.impl.cancelAuthenticationFromService(token, opPackageName,
+ callingUid, callingPid, callingUserId, fromClient);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Unable to cancel authentication");
+ }
}
- if ((mCurrentAuthSession.mModality & TYPE_IRIS) != 0) {
- Slog.w(TAG, "Iris unsupported");
- }
- if ((mCurrentAuthSession.mModality & TYPE_FACE) != 0) {
- mFaceService.cancelAuthenticationFromService(token, opPackageName,
- callingUid, callingPid, callingUserId, fromClient);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Unable to cancel authentication");
}
}
}
diff --git a/services/core/java/com/android/server/biometrics/face/FaceAuthenticator.java b/services/core/java/com/android/server/biometrics/face/FaceAuthenticator.java
new file mode 100644
index 0000000..5df5b29d
--- /dev/null
+++ b/services/core/java/com/android/server/biometrics/face/FaceAuthenticator.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 com.android.server.biometrics.face;
+
+import android.hardware.biometrics.IBiometricAuthenticator;
+import android.hardware.biometrics.IBiometricServiceReceiverInternal;
+import android.hardware.face.IFaceService;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+/**
+ * TODO(b/141025588): Add JavaDoc.
+ */
+public final class FaceAuthenticator extends IBiometricAuthenticator.Stub {
+ private final IFaceService mFaceService;
+
+ public FaceAuthenticator(IFaceService faceService) {
+ mFaceService = faceService;
+ }
+
+ @Override
+ public void prepareForAuthentication(boolean requireConfirmation, IBinder token,
+ long sessionId, int userId, IBiometricServiceReceiverInternal wrapperReceiver,
+ String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId)
+ throws RemoteException {
+ mFaceService.prepareForAuthentication(requireConfirmation, token, sessionId, userId,
+ wrapperReceiver, opPackageName, cookie, callingUid, callingPid, callingUserId);
+ }
+
+ @Override
+ public void startPreparedClient(int cookie) throws RemoteException {
+ mFaceService.startPreparedClient(cookie);
+ }
+
+ @Override
+ public void cancelAuthenticationFromService(IBinder token, String opPackageName, int callingUid,
+ int callingPid, int callingUserId, boolean fromClient) throws RemoteException {
+ mFaceService.cancelAuthenticationFromService(token, opPackageName, callingUid, callingPid,
+ callingUserId, fromClient);
+ }
+
+ @Override
+ public boolean isHardwareDetected(String opPackageName) throws RemoteException {
+ return mFaceService.isHardwareDetected(opPackageName);
+ }
+
+ @Override
+ public boolean hasEnrolledTemplates(int userId, String opPackageName) throws RemoteException {
+ return mFaceService.hasEnrolledFaces(userId, opPackageName);
+ }
+
+ @Override
+ public void resetLockout(byte[] token) throws RemoteException {
+ mFaceService.resetLockout(token);
+ }
+
+ @Override
+ public void setActiveUser(int uid) throws RemoteException {
+ mFaceService.setActiveUser(uid);
+ }
+}
diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java
index 1b13212..a0c8e23 100644
--- a/services/core/java/com/android/server/biometrics/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/face/FaceService.java
@@ -20,6 +20,7 @@
import static android.Manifest.permission.MANAGE_BIOMETRIC;
import static android.Manifest.permission.RESET_FACE_LOCKOUT;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
+import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
import android.app.ActivityManager;
import android.app.AppOpsManager;
@@ -538,7 +539,7 @@
// TODO: refactor out common code here
@Override // Binder call
- public boolean isHardwareDetected(long deviceId, String opPackageName) {
+ public boolean isHardwareDetected(String opPackageName) {
checkPermission(USE_BIOMETRIC_INTERNAL);
if (!canUseBiometric(opPackageName, false /* foregroundOnly */,
Binder.getCallingUid(), Binder.getCallingPid(),
@@ -752,8 +753,7 @@
public void onError(long deviceId, int error, int vendorCode, int cookie)
throws RemoteException {
if (getWrapperReceiver() != null) {
- getWrapperReceiver().onError(cookie, error,
- FaceManager.getErrorString(getContext(), error, vendorCode));
+ getWrapperReceiver().onError(cookie, TYPE_FACE, error, vendorCode);
}
}
}
diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintAuthenticator.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintAuthenticator.java
new file mode 100644
index 0000000..6150de1
--- /dev/null
+++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintAuthenticator.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 com.android.server.biometrics.fingerprint;
+
+import android.hardware.biometrics.IBiometricAuthenticator;
+import android.hardware.biometrics.IBiometricServiceReceiverInternal;
+import android.hardware.fingerprint.IFingerprintService;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+/**
+ * TODO(b/141025588): Add JavaDoc.
+ */
+public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub {
+ private final IFingerprintService mFingerprintService;
+
+ public FingerprintAuthenticator(IFingerprintService fingerprintService) {
+ mFingerprintService = fingerprintService;
+ }
+
+ @Override
+ public void prepareForAuthentication(boolean requireConfirmation, IBinder token,
+ long sessionId, int userId, IBiometricServiceReceiverInternal wrapperReceiver,
+ String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId)
+ throws RemoteException {
+ mFingerprintService.prepareForAuthentication(token, sessionId, userId, wrapperReceiver,
+ opPackageName, cookie, callingUid, callingPid, callingUserId);
+ }
+
+ @Override
+ public void startPreparedClient(int cookie) throws RemoteException {
+ mFingerprintService.startPreparedClient(cookie);
+ }
+
+ @Override
+ public void cancelAuthenticationFromService(IBinder token, String opPackageName, int callingUid,
+ int callingPid, int callingUserId, boolean fromClient) throws RemoteException {
+ mFingerprintService.cancelAuthenticationFromService(token, opPackageName, callingUid,
+ callingPid, callingUserId, fromClient);
+ }
+
+ @Override
+ public boolean isHardwareDetected(String opPackageName) throws RemoteException {
+ return mFingerprintService.isHardwareDetected(opPackageName);
+ }
+
+ @Override
+ public boolean hasEnrolledTemplates(int userId, String opPackageName) throws RemoteException {
+ return mFingerprintService.hasEnrolledFingerprints(userId, opPackageName);
+ }
+
+ @Override
+ public void resetLockout(byte[] token) throws RemoteException {
+ mFingerprintService.resetTimeout(token);
+ }
+
+ @Override
+ public void setActiveUser(int uid) throws RemoteException {
+ mFingerprintService.setActiveUser(uid);
+ }
+}
diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
index d85af2e..44797ad 100644
--- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
@@ -22,6 +22,7 @@
import static android.Manifest.permission.RESET_FINGERPRINT_LOCKOUT;
import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_FINGERPRINT;
+import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import android.app.ActivityManager;
import android.app.AlarmManager;
@@ -350,7 +351,7 @@
// TODO: refactor out common code here
@Override // Binder call
- public boolean isHardwareDetected(long deviceId, String opPackageName) {
+ public boolean isHardwareDetected(String opPackageName) {
if (!canUseBiometric(opPackageName, false /* foregroundOnly */,
Binder.getCallingUid(), Binder.getCallingPid(),
UserHandle.getCallingUserId())) {
@@ -480,8 +481,7 @@
public void onError(long deviceId, int error, int vendorCode, int cookie)
throws RemoteException {
if (getWrapperReceiver() != null) {
- getWrapperReceiver().onError(cookie, error,
- FingerprintManager.getErrorString(getContext(), error, vendorCode));
+ getWrapperReceiver().onError(cookie, TYPE_FINGERPRINT, error, vendorCode);
}
}
}
diff --git a/services/core/java/com/android/server/biometrics/iris/IrisAuthenticator.java b/services/core/java/com/android/server/biometrics/iris/IrisAuthenticator.java
new file mode 100644
index 0000000..c44b8e7
--- /dev/null
+++ b/services/core/java/com/android/server/biometrics/iris/IrisAuthenticator.java
@@ -0,0 +1,68 @@
+/*
+ * 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.biometrics.iris;
+
+import android.hardware.biometrics.IBiometricAuthenticator;
+import android.hardware.biometrics.IBiometricServiceReceiverInternal;
+import android.hardware.iris.IIrisService;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+/**
+ * TODO(b/141025588): Add JavaDoc.
+ */
+public final class IrisAuthenticator extends IBiometricAuthenticator.Stub {
+ private final IIrisService mIrisService;
+
+ public IrisAuthenticator(IIrisService irisService) {
+ mIrisService = irisService;
+ }
+
+ @Override
+ public void prepareForAuthentication(boolean requireConfirmation, IBinder token,
+ long sessionId, int userId, IBiometricServiceReceiverInternal wrapperReceiver,
+ String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId)
+ throws RemoteException {
+ }
+
+ @Override
+ public void startPreparedClient(int cookie) throws RemoteException {
+ }
+
+ @Override
+ public void cancelAuthenticationFromService(IBinder token, String opPackageName, int callingUid,
+ int callingPid, int callingUserId, boolean fromClient) throws RemoteException {
+ }
+
+ @Override
+ public boolean isHardwareDetected(String opPackageName) throws RemoteException {
+ return false;
+ }
+
+ @Override
+ public boolean hasEnrolledTemplates(int userId, String opPackageName) throws RemoteException {
+ return false;
+ }
+
+ @Override
+ public void resetLockout(byte[] token) throws RemoteException {
+ }
+
+ @Override
+ public void setActiveUser(int uid) throws RemoteException {
+ }
+}
diff --git a/services/core/java/com/android/server/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java
index 8a7dcc1..9ac9955 100644
--- a/services/core/java/com/android/server/compat/PlatformCompat.java
+++ b/services/core/java/com/android/server/compat/PlatformCompat.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.os.UserHandle;
import android.util.Slog;
import android.util.StatsLog;
@@ -53,8 +54,8 @@
}
@Override
- public void reportChangeByPackageName(long changeId, String packageName) {
- ApplicationInfo appInfo = getApplicationInfo(packageName);
+ public void reportChangeByPackageName(long changeId, String packageName, int userId) {
+ ApplicationInfo appInfo = getApplicationInfo(packageName, userId);
if (appInfo == null) {
return;
}
@@ -79,8 +80,8 @@
}
@Override
- public boolean isChangeEnabledByPackageName(long changeId, String packageName) {
- ApplicationInfo appInfo = getApplicationInfo(packageName);
+ public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) {
+ ApplicationInfo appInfo = getApplicationInfo(packageName, userId);
if (appInfo == null) {
return true;
}
@@ -95,7 +96,8 @@
}
boolean enabled = true;
for (String packageName : packages) {
- enabled = enabled && isChangeEnabledByPackageName(changeId, packageName);
+ enabled = enabled && isChangeEnabledByPackageName(changeId, packageName,
+ UserHandle.getUserId(uid));
}
return enabled;
}
@@ -126,9 +128,9 @@
mChangeReporter.resetReportedChanges(appInfo.uid);
}
- private ApplicationInfo getApplicationInfo(String packageName) {
+ private ApplicationInfo getApplicationInfo(String packageName, int userId) {
try {
- return mContext.getPackageManager().getApplicationInfo(packageName, 0);
+ return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0, userId);
} catch (PackageManager.NameNotFoundException e) {
Slog.e(TAG, "No installed package " + packageName);
}
diff --git a/services/core/java/com/android/server/compat/PlatformCompatNative.java b/services/core/java/com/android/server/compat/PlatformCompatNative.java
index 8399671..85dfbf4 100644
--- a/services/core/java/com/android/server/compat/PlatformCompatNative.java
+++ b/services/core/java/com/android/server/compat/PlatformCompatNative.java
@@ -29,8 +29,8 @@
}
@Override
- public void reportChangeByPackageName(long changeId, String packageName) {
- mPlatformCompat.reportChangeByPackageName(changeId, packageName);
+ public void reportChangeByPackageName(long changeId, String packageName, int userId) {
+ mPlatformCompat.reportChangeByPackageName(changeId, packageName, userId);
}
@Override
@@ -39,8 +39,8 @@
}
@Override
- public boolean isChangeEnabledByPackageName(long changeId, String packageName) {
- return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName);
+ public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) {
+ return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName, userId);
}
@Override
diff --git a/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java b/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java
index 077c405..d13e675 100644
--- a/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java
+++ b/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java
@@ -53,7 +53,8 @@
NO_INTERNET(SystemMessage.NOTE_NETWORK_NO_INTERNET),
LOGGED_IN(SystemMessage.NOTE_NETWORK_LOGGED_IN),
PARTIAL_CONNECTIVITY(SystemMessage.NOTE_NETWORK_PARTIAL_CONNECTIVITY),
- SIGN_IN(SystemMessage.NOTE_NETWORK_SIGN_IN);
+ SIGN_IN(SystemMessage.NOTE_NETWORK_SIGN_IN),
+ PRIVATE_DNS_BROKEN(SystemMessage.NOTE_NETWORK_PRIVATE_DNS_BROKEN);
public final int eventId;
@@ -175,13 +176,23 @@
}
Resources r = Resources.getSystem();
- CharSequence title;
- CharSequence details;
+ final CharSequence title;
+ final CharSequence details;
int icon = getIcon(transportType, notifyType);
if (notifyType == NotificationType.NO_INTERNET && transportType == TRANSPORT_WIFI) {
title = r.getString(R.string.wifi_no_internet,
WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
details = r.getString(R.string.wifi_no_internet_detailed);
+ } else if (notifyType == NotificationType.PRIVATE_DNS_BROKEN) {
+ if (transportType == TRANSPORT_CELLULAR) {
+ title = r.getString(R.string.mobile_no_internet);
+ } else if (transportType == TRANSPORT_WIFI) {
+ title = r.getString(R.string.wifi_no_internet,
+ WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
+ } else {
+ title = r.getString(R.string.other_networks_no_internet);
+ }
+ details = r.getString(R.string.private_dns_broken_detailed);
} else if (notifyType == NotificationType.PARTIAL_CONNECTIVITY
&& transportType == TRANSPORT_WIFI) {
title = r.getString(R.string.network_partial_connectivity,
@@ -357,8 +368,10 @@
}
switch (t) {
case SIGN_IN:
- return 5;
+ return 6;
case PARTIAL_CONNECTIVITY:
+ return 5;
+ case PRIVATE_DNS_BROKEN:
return 4;
case NO_INTERNET:
return 3;
diff --git a/services/core/java/com/android/server/content/SyncStorageEngine.java b/services/core/java/com/android/server/content/SyncStorageEngine.java
index e09c661..ebaa5a1 100644
--- a/services/core/java/com/android/server/content/SyncStorageEngine.java
+++ b/services/core/java/com/android/server/content/SyncStorageEngine.java
@@ -2032,13 +2032,17 @@
int token;
while ((token=in.readInt()) != STATUS_FILE_END) {
if (token == STATUS_FILE_ITEM) {
- SyncStatusInfo status = new SyncStatusInfo(in);
- if (mAuthorities.indexOfKey(status.authorityId) >= 0) {
- status.pending = false;
- if (Log.isLoggable(TAG_FILE, Log.VERBOSE)) {
- Slog.v(TAG_FILE, "Adding status for id " + status.authorityId);
+ try {
+ SyncStatusInfo status = new SyncStatusInfo(in);
+ if (mAuthorities.indexOfKey(status.authorityId) >= 0) {
+ status.pending = false;
+ if (Log.isLoggable(TAG_FILE, Log.VERBOSE)) {
+ Slog.v(TAG_FILE, "Adding status for id " + status.authorityId);
+ }
+ mSyncStatus.put(status.authorityId, status);
}
- mSyncStatus.put(status.authorityId, status);
+ } catch (Exception e) {
+ Slog.e(TAG, "Unable to parse some sync status.", e);
}
} else {
// Ooops.
diff --git a/services/core/java/com/android/server/display/color/ColorDisplayService.java b/services/core/java/com/android/server/display/color/ColorDisplayService.java
index 0bf43b6..2dc2cf0 100644
--- a/services/core/java/com/android/server/display/color/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/color/ColorDisplayService.java
@@ -589,16 +589,18 @@
if (immediate) {
dtm.setColorMatrix(tintController.getLevel(), to);
} else {
- tintController.setAnimator(ValueAnimator.ofObject(COLOR_MATRIX_EVALUATOR,
- from == null ? MATRIX_IDENTITY : from, to));
- tintController.getAnimator().setDuration(TRANSITION_DURATION);
- tintController.getAnimator().setInterpolator(AnimationUtils.loadInterpolator(
+ TintValueAnimator valueAnimator = TintValueAnimator.ofMatrix(COLOR_MATRIX_EVALUATOR,
+ from == null ? MATRIX_IDENTITY : from, to);
+ tintController.setAnimator(valueAnimator);
+ valueAnimator.setDuration(TRANSITION_DURATION);
+ valueAnimator.setInterpolator(AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.fast_out_slow_in));
- tintController.getAnimator().addUpdateListener((ValueAnimator animator) -> {
+ valueAnimator.addUpdateListener((ValueAnimator animator) -> {
final float[] value = (float[]) animator.getAnimatedValue();
dtm.setColorMatrix(tintController.getLevel(), value);
+ ((TintValueAnimator) animator).updateMinMaxComponents();
});
- tintController.getAnimator().addListener(new AnimatorListenerAdapter() {
+ valueAnimator.addListener(new AnimatorListenerAdapter() {
private boolean mIsCancelled;
@@ -609,9 +611,14 @@
@Override
public void onAnimationEnd(Animator animator) {
+ TintValueAnimator t = (TintValueAnimator) animator;
Slog.d(TAG, tintController.getClass().getSimpleName()
+ " Animation cancelled: " + mIsCancelled
- + " to matrix: " + TintController.matrixToString(to, 16));
+ + " to matrix: " + TintController.matrixToString(to, 16)
+ + " min matrix coefficients: "
+ + TintController.matrixToString(t.getMin(), 16)
+ + " max matrix coefficients: "
+ + TintController.matrixToString(t.getMax(), 16));
if (!mIsCancelled) {
// Ensure final color matrix is set at the end of the animation. If the
// animation is cancelled then don't set the final color matrix so the new
@@ -621,7 +628,7 @@
tintController.setAnimator(null);
}
});
- tintController.getAnimator().start();
+ valueAnimator.start();
}
}
@@ -1109,6 +1116,51 @@
}
/**
+ * Only animates matrices and saves min and max coefficients for logging.
+ */
+ static class TintValueAnimator extends ValueAnimator {
+ private float[] min;
+ private float[] max;
+
+ public static TintValueAnimator ofMatrix(ColorMatrixEvaluator evaluator,
+ Object... values) {
+ TintValueAnimator anim = new TintValueAnimator();
+ anim.setObjectValues(values);
+ anim.setEvaluator(evaluator);
+ if (values == null || values.length == 0) {
+ return null;
+ }
+ float[] m = (float[]) values[0];
+ anim.min = new float[m.length];
+ anim.max = new float[m.length];
+ for (int i = 0; i < m.length; ++i) {
+ anim.min[i] = Float.MAX_VALUE;
+ anim.max[i] = Float.MIN_VALUE;
+ }
+ return anim;
+ }
+
+ public void updateMinMaxComponents() {
+ float[] value = (float[]) getAnimatedValue();
+ if (value == null) {
+ return;
+ }
+ for (int i = 0; i < value.length; ++i) {
+ min[i] = Math.min(min[i], value[i]);
+ max[i] = Math.max(max[i], value[i]);
+ }
+ }
+
+ public float[] getMin() {
+ return min;
+ }
+
+ public float[] getMax() {
+ return max;
+ }
+ }
+
+ /**
* Interpolates between two 4x4 color transform matrices (in column-major order).
*/
private static class ColorMatrixEvaluator implements TypeEvaluator<float[]> {
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 d5706a5..3b0069c 100644
--- a/services/core/java/com/android/server/display/color/DisplayTransformManager.java
+++ b/services/core/java/com/android/server/display/color/DisplayTransformManager.java
@@ -111,6 +111,8 @@
@GuardedBy("mDaltonizerModeLock")
private int mDaltonizerMode = -1;
+ private static final IBinder sFlinger = ServiceManager.getService(SURFACE_FLINGER);
+
/* package */ DisplayTransformManager() {
}
@@ -195,25 +197,22 @@
* Propagates the provided color transformation matrix to the SurfaceFlinger.
*/
private static void applyColorMatrix(float[] m) {
- final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
- if (flinger != null) {
- final Parcel data = Parcel.obtain();
- data.writeInterfaceToken("android.ui.ISurfaceComposer");
- if (m != null) {
- data.writeInt(1);
- for (int i = 0; i < 16; i++) {
- data.writeFloat(m[i]);
- }
- } else {
- data.writeInt(0);
+ final Parcel data = Parcel.obtain();
+ data.writeInterfaceToken("android.ui.ISurfaceComposer");
+ if (m != null) {
+ data.writeInt(1);
+ for (int i = 0; i < 16; i++) {
+ data.writeFloat(m[i]);
}
- try {
- flinger.transact(SURFACE_FLINGER_TRANSACTION_COLOR_MATRIX, data, null, 0);
- } catch (RemoteException ex) {
- Slog.e(TAG, "Failed to set color transform", ex);
- } finally {
- data.recycle();
- }
+ } else {
+ data.writeInt(0);
+ }
+ try {
+ sFlinger.transact(SURFACE_FLINGER_TRANSACTION_COLOR_MATRIX, data, null, 0);
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Failed to set color transform", ex);
+ } finally {
+ data.recycle();
}
}
@@ -221,18 +220,15 @@
* Propagates the provided Daltonization mode to the SurfaceFlinger.
*/
private static void applyDaltonizerMode(int mode) {
- final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
- if (flinger != null) {
- final Parcel data = Parcel.obtain();
- data.writeInterfaceToken("android.ui.ISurfaceComposer");
- data.writeInt(mode);
- try {
- flinger.transact(SURFACE_FLINGER_TRANSACTION_DALTONIZER, data, null, 0);
- } catch (RemoteException ex) {
- Slog.e(TAG, "Failed to set Daltonizer mode", ex);
- } finally {
- data.recycle();
- }
+ final Parcel data = Parcel.obtain();
+ data.writeInterfaceToken("android.ui.ISurfaceComposer");
+ data.writeInt(mode);
+ try {
+ sFlinger.transact(SURFACE_FLINGER_TRANSACTION_DALTONIZER, data, null, 0);
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Failed to set Daltonizer mode", ex);
+ } finally {
+ data.recycle();
}
}
@@ -286,20 +282,17 @@
* #SURFACE_FLINGER_TRANSACTION_QUERY_COLOR_MANAGED}.
*/
public boolean isDeviceColorManaged() {
- final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
- if (flinger != null) {
- final Parcel data = Parcel.obtain();
- final Parcel reply = Parcel.obtain();
- data.writeInterfaceToken("android.ui.ISurfaceComposer");
- try {
- flinger.transact(SURFACE_FLINGER_TRANSACTION_QUERY_COLOR_MANAGED, data, reply, 0);
- return reply.readBoolean();
- } catch (RemoteException ex) {
- Slog.e(TAG, "Failed to query wide color support", ex);
- } finally {
- data.recycle();
- reply.recycle();
- }
+ final Parcel data = Parcel.obtain();
+ final Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken("android.ui.ISurfaceComposer");
+ try {
+ sFlinger.transact(SURFACE_FLINGER_TRANSACTION_QUERY_COLOR_MANAGED, data, reply, 0);
+ return reply.readBoolean();
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Failed to query wide color support", ex);
+ } finally {
+ data.recycle();
+ reply.recycle();
}
return false;
}
@@ -309,18 +302,15 @@
*/
private void applySaturation(float saturation) {
SystemProperties.set(PERSISTENT_PROPERTY_SATURATION, Float.toString(saturation));
- final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
- if (flinger != null) {
- final Parcel data = Parcel.obtain();
- data.writeInterfaceToken("android.ui.ISurfaceComposer");
- data.writeFloat(saturation);
- try {
- flinger.transact(SURFACE_FLINGER_TRANSACTION_SATURATION, data, null, 0);
- } catch (RemoteException ex) {
- Slog.e(TAG, "Failed to set saturation", ex);
- } finally {
- data.recycle();
- }
+ final Parcel data = Parcel.obtain();
+ data.writeInterfaceToken("android.ui.ISurfaceComposer");
+ data.writeFloat(saturation);
+ try {
+ sFlinger.transact(SURFACE_FLINGER_TRANSACTION_SATURATION, data, null, 0);
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Failed to set saturation", ex);
+ } finally {
+ data.recycle();
}
}
@@ -334,21 +324,18 @@
Integer.toString(compositionColorMode));
}
- final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
- if (flinger != null) {
- final Parcel data = Parcel.obtain();
- data.writeInterfaceToken("android.ui.ISurfaceComposer");
- data.writeInt(color);
- if (compositionColorMode != Display.COLOR_MODE_INVALID) {
- data.writeInt(compositionColorMode);
- }
- try {
- flinger.transact(SURFACE_FLINGER_TRANSACTION_DISPLAY_COLOR, data, null, 0);
- } catch (RemoteException ex) {
- Slog.e(TAG, "Failed to set display color", ex);
- } finally {
- data.recycle();
- }
+ final Parcel data = Parcel.obtain();
+ data.writeInterfaceToken("android.ui.ISurfaceComposer");
+ data.writeInt(color);
+ if (compositionColorMode != Display.COLOR_MODE_INVALID) {
+ data.writeInt(compositionColorMode);
+ }
+ try {
+ sFlinger.transact(SURFACE_FLINGER_TRANSACTION_DISPLAY_COLOR, data, null, 0);
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Failed to set display color", ex);
+ } finally {
+ data.recycle();
}
}
diff --git a/services/core/java/com/android/server/display/color/TintController.java b/services/core/java/com/android/server/display/color/TintController.java
index 8d8b9b2..422dd32 100644
--- a/services/core/java/com/android/server/display/color/TintController.java
+++ b/services/core/java/com/android/server/display/color/TintController.java
@@ -24,14 +24,14 @@
abstract class TintController {
- private ValueAnimator mAnimator;
+ private ColorDisplayService.TintValueAnimator mAnimator;
private Boolean mIsActivated;
- public ValueAnimator getAnimator() {
+ public ColorDisplayService.TintValueAnimator getAnimator() {
return mAnimator;
}
- public void setAnimator(ValueAnimator animator) {
+ public void setAnimator(ColorDisplayService.TintValueAnimator animator) {
mAnimator = animator;
}
diff --git a/services/core/java/com/android/server/location/CallerIdentity.java b/services/core/java/com/android/server/location/CallerIdentity.java
index 61e5d1f..75ba5b8 100644
--- a/services/core/java/com/android/server/location/CallerIdentity.java
+++ b/services/core/java/com/android/server/location/CallerIdentity.java
@@ -17,6 +17,7 @@
package com.android.server.location;
import android.annotation.NonNull;
+import android.annotation.Nullable;
/**
* Represents the calling process's uid, pid, and package name.
@@ -25,13 +26,15 @@
public final int mUid;
public final int mPid;
public final String mPackageName;
+ public final @Nullable String mFeatureId;
public final @NonNull String mListenerIdentifier;
- public CallerIdentity(int uid, int pid, String packageName,
+ public CallerIdentity(int uid, int pid, String packageName, @Nullable String featureId,
@NonNull String listenerIdentifier) {
mUid = uid;
mPid = pid;
mPackageName = packageName;
+ mFeatureId = featureId;
mListenerIdentifier = listenerIdentifier;
}
}
diff --git a/services/core/java/com/android/server/location/GeofenceManager.java b/services/core/java/com/android/server/location/GeofenceManager.java
index 4f10a71..17a2169 100644
--- a/services/core/java/com/android/server/location/GeofenceManager.java
+++ b/services/core/java/com/android/server/location/GeofenceManager.java
@@ -17,6 +17,7 @@
package com.android.server.location;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.content.ContentResolver;
@@ -152,7 +153,7 @@
}
public void addFence(LocationRequest request, Geofence geofence, PendingIntent intent,
- int allowedResolutionLevel, int uid, String packageName,
+ int allowedResolutionLevel, int uid, String packageName, @Nullable String featureId,
@NonNull String listenerIdentifier) {
if (D) {
Slog.d(TAG, "addFence: request=" + request + ", geofence=" + geofence
@@ -160,8 +161,8 @@
}
GeofenceState state = new GeofenceState(geofence,
- request.getExpireAt(), allowedResolutionLevel, uid, packageName, listenerIdentifier,
- intent);
+ request.getExpireAt(), allowedResolutionLevel, uid, packageName, featureId,
+ listenerIdentifier, intent);
synchronized (mLock) {
// first make sure it doesn't already exist
for (int i = mFences.size() - 1; i >= 0; i--) {
@@ -304,7 +305,7 @@
int op = LocationManagerService.resolutionLevelToOp(state.mAllowedResolutionLevel);
if (op >= 0) {
if (mAppOps.noteOpNoThrow(AppOpsManager.OP_FINE_LOCATION, state.mUid,
- state.mPackageName, null, state.mListenerIdentifier)
+ state.mPackageName, state.mFeatureId, state.mListenerIdentifier)
!= AppOpsManager.MODE_ALLOWED) {
if (D) {
Slog.d(TAG, "skipping geofence processing for no op app: "
diff --git a/services/core/java/com/android/server/location/GeofenceState.java b/services/core/java/com/android/server/location/GeofenceState.java
index fe0719d..a91a1dc 100644
--- a/services/core/java/com/android/server/location/GeofenceState.java
+++ b/services/core/java/com/android/server/location/GeofenceState.java
@@ -18,6 +18,7 @@
package com.android.server.location;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.app.PendingIntent;
import android.location.Geofence;
import android.location.Location;
@@ -39,6 +40,7 @@
public final int mAllowedResolutionLevel;
public final int mUid;
public final String mPackageName;
+ public final @Nullable String mFeatureId;
public final @NonNull String mListenerIdentifier;
public final PendingIntent mIntent;
@@ -46,7 +48,8 @@
double mDistanceToCenter; // current distance to center of fence
public GeofenceState(Geofence fence, long expireAt, int allowedResolutionLevel, int uid,
- String packageName, @NonNull String listenerIdentifier, PendingIntent intent) {
+ String packageName, @Nullable String featureId, @NonNull String listenerIdentifier,
+ PendingIntent intent) {
mState = STATE_UNKNOWN;
mDistanceToCenter = Double.MAX_VALUE;
@@ -55,6 +58,7 @@
mAllowedResolutionLevel = allowedResolutionLevel;
mUid = uid;
mPackageName = packageName;
+ mFeatureId = featureId;
mListenerIdentifier = listenerIdentifier;
mIntent = intent;
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 8bf01a3..11b9ac4 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -67,6 +67,7 @@
import android.util.TimeUtils;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
import com.android.internal.location.GpsNetInitiatedHandler;
import com.android.internal.location.GpsNetInitiatedHandler.GpsNiNotification;
@@ -304,6 +305,9 @@
private final ExponentialBackOff mPsdsBackOff = new ExponentialBackOff(RETRY_INTERVAL,
MAX_RETRY_INTERVAL);
+ private static boolean sIsInitialized = false;
+ private static boolean sStaticTestOverride = false;
+
// True if we are enabled
@GuardedBy("mLock")
private boolean mGpsEnabled;
@@ -576,7 +580,15 @@
}
}
+ @VisibleForTesting
+ public static void setIsSupportedForTest(boolean override) {
+ sStaticTestOverride = override;
+ }
+
public static boolean isSupported() {
+ if (sStaticTestOverride) {
+ return true;
+ }
return native_is_supported();
}
@@ -598,6 +610,13 @@
Looper looper) {
super(context, locationProviderManager);
+ synchronized (mLock) {
+ if (!sIsInitialized) {
+ class_init_native();
+ }
+ sIsInitialized = true;
+ }
+
mLooper = looper;
// Create a wake lock
@@ -2224,10 +2243,6 @@
// preallocated to avoid memory allocation in reportNmea()
private byte[] mNmeaBuffer = new byte[120];
- static {
- class_init_native();
- }
-
private static native void class_init_native();
private static native boolean native_is_supported();
diff --git a/services/core/java/com/android/server/location/GnssMeasurementsProvider.java b/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
index ec05c31..55e427f 100644
--- a/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
+++ b/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
@@ -47,7 +47,7 @@
}
@VisibleForTesting
- GnssMeasurementsProvider(
+ public GnssMeasurementsProvider(
Context context, Handler handler, GnssMeasurementProviderNative aNative) {
super(context, handler, TAG);
mNative = aNative;
@@ -158,7 +158,7 @@
}
@VisibleForTesting
- static class GnssMeasurementProviderNative {
+ public static class GnssMeasurementProviderNative {
public boolean isMeasurementSupported() {
return native_is_measurement_supported();
}
diff --git a/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java b/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
index 4c45ef6..983d1da 100644
--- a/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
+++ b/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
@@ -45,7 +45,7 @@
}
@VisibleForTesting
- GnssNavigationMessageProvider(Context context, Handler handler,
+ public GnssNavigationMessageProvider(Context context, Handler handler,
GnssNavigationMessageProviderNative aNative) {
super(context, handler, TAG);
mNative = aNative;
@@ -142,7 +142,7 @@
}
@VisibleForTesting
- static class GnssNavigationMessageProviderNative {
+ public static class GnssNavigationMessageProviderNative {
public boolean isNavigationMessageSupported() {
return native_is_navigation_message_supported();
}
diff --git a/services/core/java/com/android/server/location/RemoteListenerHelper.java b/services/core/java/com/android/server/location/RemoteListenerHelper.java
index 25b544f..60ce1f4 100644
--- a/services/core/java/com/android/server/location/RemoteListenerHelper.java
+++ b/services/core/java/com/android/server/location/RemoteListenerHelper.java
@@ -182,7 +182,7 @@
}
return mAppOps.noteOpNoThrow(AppOpsManager.OP_FINE_LOCATION, callerIdentity.mUid,
- callerIdentity.mPackageName, null,
+ callerIdentity.mPackageName, callerIdentity.mFeatureId,
"Location sent to " + callerIdentity.mListenerIdentifier)
== AppOpsManager.MODE_ALLOWED;
}
diff --git a/services/core/java/com/android/server/location/TEST_MAPPING b/services/core/java/com/android/server/location/TEST_MAPPING
new file mode 100644
index 0000000..2e21fa6
--- /dev/null
+++ b/services/core/java/com/android/server/location/TEST_MAPPING
@@ -0,0 +1,10 @@
+{
+ "presubmit": [
+ {
+ "name": "CtsLocationCoarseTestCases"
+ },
+ {
+ "name": "CtsLocationNoneTestCases"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 34fb641..d665001 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -23,8 +23,11 @@
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
+import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_ENABLED_BY_DEFAULT;
import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_ENABLED_KEY;
import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_HANDLE_KEY;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT;
@@ -101,7 +104,6 @@
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.EventLog;
-import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -116,7 +118,6 @@
import com.android.internal.widget.ICheckCredentialProgressCallback;
import com.android.internal.widget.ILockSettings;
import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.LockPatternUtils.CredentialType;
import com.android.internal.widget.LockSettingsInternal;
import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
@@ -178,7 +179,6 @@
private static final int PROFILE_KEY_IV_SIZE = 12;
private static final String SEPARATE_PROFILE_CHALLENGE_KEY = "lockscreen.profilechallenge";
- private static final int SYNTHETIC_PASSWORD_ENABLED_BY_DEFAULT = 1;
private static final String PREV_SYNTHETIC_PASSWORD_HANDLE_KEY = "prev-sp-handle";
private static final String SYNTHETIC_PASSWORD_UPDATE_TIME_KEY = "sp-handle-ts";
@@ -317,14 +317,34 @@
}
}
+ private LockscreenCredential generateRandomProfilePassword() {
+ byte[] randomLockSeed = new byte[] {};
+ try {
+ randomLockSeed = SecureRandom.getInstance("SHA1PRNG").generateSeed(40);
+ char[] newPasswordChars = HexEncoding.encode(randomLockSeed);
+ byte[] newPassword = new byte[newPasswordChars.length];
+ for (int i = 0; i < newPasswordChars.length; i++) {
+ newPassword[i] = (byte) newPasswordChars[i];
+ }
+ LockscreenCredential credential =
+ LockscreenCredential.createManagedPassword(newPassword);
+ Arrays.fill(newPasswordChars, '\u0000');
+ Arrays.fill(newPassword, (byte) 0);
+ Arrays.fill(randomLockSeed, (byte) 0);
+ return credential;
+ } catch (NoSuchAlgorithmException e) {
+ throw new IllegalStateException("Fail to generate profile password", e);
+ }
+ }
+
/**
* Tie managed profile to primary profile if it is in unified mode and not tied before.
*
* @param managedUserId Managed profile user Id
* @param managedUserPassword Managed profile original password (when it has separated lock).
- * NULL when it does not have a separated lock before.
*/
- public void tieManagedProfileLockIfNecessary(int managedUserId, byte[] managedUserPassword) {
+ public void tieManagedProfileLockIfNecessary(int managedUserId,
+ LockscreenCredential managedUserPassword) {
if (DEBUG) Slog.v(TAG, "Check child profile lock for user: " + managedUserId);
// Only for managed profile
if (!mUserManager.getUserInfo(managedUserId).isManagedProfile()) {
@@ -356,27 +376,10 @@
return;
}
if (DEBUG) Slog.v(TAG, "Tie managed profile to parent now!");
- byte[] randomLockSeed = new byte[] {};
- try {
- randomLockSeed = SecureRandom.getInstance("SHA1PRNG").generateSeed(40);
- char[] newPasswordChars = HexEncoding.encode(randomLockSeed);
- byte[] newPassword = new byte[newPasswordChars.length];
- for (int i = 0; i < newPasswordChars.length; i++) {
- newPassword[i] = (byte) newPasswordChars[i];
- }
- Arrays.fill(newPasswordChars, '\u0000');
- final int quality = DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
- setLockCredentialInternal(newPassword, CREDENTIAL_TYPE_PASSWORD, managedUserPassword,
- quality, managedUserId, false, /* isLockTiedToParent= */ true);
- // We store a private credential for the managed user that's unlocked by the primary
- // account holder's credential. As such, the user will never be prompted to enter this
- // password directly, so we always store a password.
- setLong(LockPatternUtils.PASSWORD_TYPE_KEY, quality, managedUserId);
- tieProfileLockToParent(managedUserId, newPassword);
- Arrays.fill(newPassword, (byte) 0);
- } catch (NoSuchAlgorithmException e) {
- Slog.e(TAG, "Fail to tie managed profile", e);
- // Nothing client can do to fix this issue, so we do not throw exception out
+ try (LockscreenCredential unifiedProfilePassword = generateRandomProfilePassword()) {
+ setLockCredentialInternal(unifiedProfilePassword, managedUserPassword, managedUserId,
+ false, /* isLockTiedToParent= */ true);
+ tieProfileLockToParent(managedUserId, unifiedProfilePassword);
}
}
@@ -512,6 +515,10 @@
}
}
+ public int settingsGlobalGetInt(ContentResolver contentResolver, String keyName,
+ int defaultValue) {
+ return Settings.Global.getInt(contentResolver, keyName, defaultValue);
+ }
}
public LockSettingsService(Context context) {
@@ -682,7 +689,7 @@
hideEncryptionNotification(new UserHandle(userId));
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
- tieManagedProfileLockIfNecessary(userId, null);
+ tieManagedProfileLockIfNecessary(userId, LockscreenCredential.createNone());
}
// If the user doesn't have a credential, try and derive their secret for the
@@ -704,10 +711,9 @@
}
final long handle = getSyntheticPasswordHandleLocked(userId);
- final byte[] noCredential = null;
AuthenticationResult result =
- mSpManager.unwrapPasswordBasedSyntheticPassword(
- getGateKeeperService(), handle, noCredential, userId, null);
+ mSpManager.unwrapPasswordBasedSyntheticPassword(getGateKeeperService(),
+ handle, LockscreenCredential.createNone(), userId, null);
if (result.authToken != null) {
Slog.i(TAG, "Retrieved auth token for user " + userId);
onAuthTokenKnownForUser(userId, result.authToken);
@@ -870,25 +876,6 @@
final List<UserInfo> users = mUserManager.getUsers();
for (int i = 0; i < users.size(); i++) {
final UserInfo userInfo = users.get(i);
- if (userInfo.isManagedProfile() && mStorage.hasChildProfileLock(userInfo.id)) {
- // When managed profile has a unified lock, the password quality stored has 2
- // possibilities only.
- // 1). PASSWORD_QUALITY_UNSPECIFIED, which is upgraded from dp2, and we are
- // going to set it back to PASSWORD_QUALITY_ALPHANUMERIC.
- // 2). PASSWORD_QUALITY_ALPHANUMERIC, which is the actual password quality for
- // unified lock.
- final long quality = getLong(LockPatternUtils.PASSWORD_TYPE_KEY,
- DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userInfo.id);
- if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
- // Only possible when it's upgraded from nyc dp3
- Slog.i(TAG, "Migrated tied profile lock type");
- setLong(LockPatternUtils.PASSWORD_TYPE_KEY,
- DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC, userInfo.id);
- } else if (quality != DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC) {
- // It should not happen
- Slog.e(TAG, "Invalid tied profile lock type: " + quality);
- }
- }
try {
final String alias = LockPatternUtils.PROFILE_KEY_NAME_ENCRYPT + userInfo.id;
java.security.KeyStore keyStore =
@@ -1024,28 +1011,33 @@
@Override
public boolean getSeparateProfileChallengeEnabled(int userId) {
checkReadPermission(SEPARATE_PROFILE_CHALLENGE_KEY, userId);
+ return getSeparateProfileChallengeEnabledInternal(userId);
+ }
+
+ private boolean getSeparateProfileChallengeEnabledInternal(int userId) {
synchronized (mSeparateChallengeLock) {
- return getBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, false, userId);
+ return getBooleanUnchecked(SEPARATE_PROFILE_CHALLENGE_KEY, false, userId);
}
}
@Override
public void setSeparateProfileChallengeEnabled(int userId, boolean enabled,
- byte[] managedUserPassword) {
+ LockscreenCredential managedUserPassword) {
checkWritePermission(userId);
if (!mLockPatternUtils.hasSecureLockScreen()) {
throw new UnsupportedOperationException(
"This operation requires secure lock screen feature.");
}
synchronized (mSeparateChallengeLock) {
- setSeparateProfileChallengeEnabledLocked(userId, enabled, managedUserPassword);
+ setSeparateProfileChallengeEnabledLocked(userId, enabled, managedUserPassword != null
+ ? managedUserPassword : LockscreenCredential.createNone());
}
notifySeparateProfileChallengeChanged(userId);
}
@GuardedBy("mSeparateChallengeLock")
private void setSeparateProfileChallengeEnabledLocked(@UserIdInt int userId,
- boolean enabled, byte[] managedUserPassword) {
+ boolean enabled, LockscreenCredential managedUserPassword) {
final boolean old = getBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, false, userId);
setBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, enabled, userId);
try {
@@ -1083,6 +1075,10 @@
@Override
public void setLong(String key, long value, int userId) {
checkWritePermission(userId);
+ setLongUnchecked(key, value, userId);
+ }
+
+ private void setLongUnchecked(String key, long value, int userId) {
setStringUnchecked(key, userId, Long.toString(value));
}
@@ -1104,6 +1100,10 @@
@Override
public boolean getBoolean(String key, boolean defaultValue, int userId) {
checkReadPermission(key, userId);
+ return getBooleanUnchecked(key, defaultValue, userId);
+ }
+
+ private boolean getBooleanUnchecked(String key, boolean defaultValue, int userId) {
String value = getStringUnchecked(key, null, userId);
return TextUtils.isEmpty(value) ?
defaultValue : (value.equals("1") || value.equals("true"));
@@ -1112,6 +1112,10 @@
@Override
public long getLong(String key, long defaultValue, int userId) {
checkReadPermission(key, userId);
+ return getLongUnchecked(key, defaultValue, userId);
+ }
+
+ private long getLongUnchecked(String key, long defaultValue, int userId) {
String value = getStringUnchecked(key, null, userId);
return TextUtils.isEmpty(value) ? defaultValue : Long.parseLong(value);
}
@@ -1122,7 +1126,7 @@
return getStringUnchecked(key, defaultValue, userId);
}
- public String getStringUnchecked(String key, String defaultValue, int userId) {
+ private String getStringUnchecked(String key, String defaultValue, int userId) {
if (Settings.Secure.LOCK_PATTERN_ENABLED.equals(key)) {
long ident = Binder.clearCallingIdentity();
try {
@@ -1131,9 +1135,8 @@
Binder.restoreCallingIdentity(ident);
}
}
-
if (userId == USER_FRP) {
- return getFrpStringUnchecked(key);
+ return null;
}
if (LockPatternUtils.LEGACY_LOCK_PATTERN_ENABLED.equals(key)) {
@@ -1143,51 +1146,81 @@
return mStorage.readKeyValue(key, defaultValue, userId);
}
- private String getFrpStringUnchecked(String key) {
- if (LockPatternUtils.PASSWORD_TYPE_KEY.equals(key)) {
- return String.valueOf(readFrpPasswordQuality());
- }
- return null;
+ private void setKeyguardStoredQuality(int quality, int userId) {
+ if (DEBUG) Slog.d(TAG, "setKeyguardStoredQuality: user=" + userId + " quality=" + quality);
+ setLongUnchecked(LockPatternUtils.PASSWORD_TYPE_KEY, quality, userId);
}
- private int readFrpPasswordQuality() {
- return mStorage.readPersistentDataBlock().qualityForUi;
+ private int getKeyguardStoredQuality(int userId) {
+ return (int) getLongUnchecked(LockPatternUtils.PASSWORD_TYPE_KEY,
+ DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId);
}
@Override
- public boolean havePassword(int userId) {
+ public int getCredentialType(int userId) {
checkPasswordHavePermission(userId);
- synchronized (mSpManager) {
- if (isSyntheticPasswordBasedCredentialLocked(userId)) {
- final long handle = getSyntheticPasswordHandleLocked(userId);
- return mSpManager.getCredentialType(handle, userId) == CREDENTIAL_TYPE_PASSWORD;
- }
- }
- // Do we need a permissions check here?
- return mStorage.hasPassword(userId);
+ return getCredentialTypeInternal(userId);
}
- @Override
- public boolean havePattern(int userId) {
- checkPasswordHavePermission(userId);
+ // TODO: this is a hot path, can we optimize it?
+ /**
+ * Returns the credential type of the user, can be one of {@link #CREDENTIAL_TYPE_NONE},
+ * {@link #CREDENTIAL_TYPE_PATTERN}, {@link #CREDENTIAL_TYPE_PIN} and
+ * {@link #CREDENTIAL_TYPE_PASSWORD}
+ */
+ public int getCredentialTypeInternal(int userId) {
+ if (userId == USER_FRP) {
+ return getFrpCredentialType();
+ }
synchronized (mSpManager) {
if (isSyntheticPasswordBasedCredentialLocked(userId)) {
final long handle = getSyntheticPasswordHandleLocked(userId);
- return mSpManager.getCredentialType(handle, userId) == CREDENTIAL_TYPE_PATTERN;
+ int rawType = mSpManager.getCredentialType(handle, userId);
+ if (rawType != CREDENTIAL_TYPE_PASSWORD_OR_PIN) {
+ return rawType;
+ }
+ return pinOrPasswordQualityToCredentialType(getKeyguardStoredQuality(userId));
}
}
- // Do we need a permissions check here?
- return mStorage.hasPattern(userId);
+ // Intentional duplication of the getKeyguardStoredQuality() call above since this is a
+ // unlikely code path (device with pre-synthetic password credential). We want to skip
+ // calling getKeyguardStoredQuality whenever possible.
+ final int savedQuality = getKeyguardStoredQuality(userId);
+ if (savedQuality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING
+ && mStorage.hasPattern(userId)) {
+ return CREDENTIAL_TYPE_PATTERN;
+ }
+ if (savedQuality >= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
+ && mStorage.hasPassword(userId)) {
+ return pinOrPasswordQualityToCredentialType(savedQuality);
+ }
+ return CREDENTIAL_TYPE_NONE;
+ }
+
+ private int getFrpCredentialType() {
+ PersistentData data = mStorage.readPersistentDataBlock();
+ if (data.type != PersistentData.TYPE_SP && data.type != PersistentData.TYPE_SP_WEAVER) {
+ return CREDENTIAL_TYPE_NONE;
+ }
+ int credentialType = SyntheticPasswordManager.getFrpCredentialType(data.payload);
+ if (credentialType != CREDENTIAL_TYPE_PASSWORD_OR_PIN) {
+ return credentialType;
+ }
+ return pinOrPasswordQualityToCredentialType(data.qualityForUi);
+ }
+
+ private static int pinOrPasswordQualityToCredentialType(int quality) {
+ if (LockPatternUtils.isQualityAlphabeticPassword(quality)) {
+ return CREDENTIAL_TYPE_PASSWORD;
+ }
+ if (LockPatternUtils.isQualityNumericPin(quality)) {
+ return CREDENTIAL_TYPE_PIN;
+ }
+ throw new IllegalArgumentException("Quality is neither Pin nor password: " + quality);
}
private boolean isUserSecure(int userId) {
- synchronized (mSpManager) {
- if (isSyntheticPasswordBasedCredentialLocked(userId)) {
- final long handle = getSyntheticPasswordHandleLocked(userId);
- return mSpManager.getCredentialType(handle, userId) != CREDENTIAL_TYPE_NONE;
- }
- }
- return mStorage.hasCredential(userId);
+ return getCredentialTypeInternal(userId) != CREDENTIAL_TYPE_NONE;
}
private void setKeystorePassword(byte[] password, int userHandle) {
@@ -1205,8 +1238,8 @@
ks.unlock(userHandle, passwordString);
}
- @VisibleForTesting
- protected byte[] getDecryptedPasswordForTiedProfile(int userId)
+ @VisibleForTesting /** Note: this method is overridden in unit tests */
+ protected LockscreenCredential getDecryptedPasswordForTiedProfile(int userId)
throws KeyStoreException, UnrecoverableKeyException,
NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException,
@@ -1230,7 +1263,10 @@
cipher.init(Cipher.DECRYPT_MODE, decryptionKey, new GCMParameterSpec(128, iv));
decryptionResult = cipher.doFinal(encryptedPassword);
- return decryptionResult;
+ LockscreenCredential credential = LockscreenCredential.createManagedPassword(
+ decryptionResult);
+ Arrays.fill(decryptionResult, (byte) 0);
+ return credential;
}
private void unlockChildProfile(int profileHandle, boolean ignoreUserNotAuthenticated,
@@ -1238,7 +1274,6 @@
@Nullable ArrayList<PendingResetLockout> resetLockouts) {
try {
doVerifyCredential(getDecryptedPasswordForTiedProfile(profileHandle),
- CREDENTIAL_TYPE_PASSWORD,
challengeType, challenge, profileHandle, null /* progressCallback */,
resetLockouts);
} catch (UnrecoverableKeyException | InvalidKeyException | KeyStoreException
@@ -1276,17 +1311,17 @@
final IProgressListener listener = new IProgressListener.Stub() {
@Override
public void onStarted(int id, Bundle extras) throws RemoteException {
- Log.d(TAG, "unlockUser started");
+ Slog.d(TAG, "unlockUser started");
}
@Override
public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
- Log.d(TAG, "unlockUser progress " + progress);
+ Slog.d(TAG, "unlockUser progress " + progress);
}
@Override
public void onFinished(int id, Bundle extras) throws RemoteException {
- Log.d(TAG, "unlockUser finished");
+ Slog.d(TAG, "unlockUser finished");
latch.countDown();
}
};
@@ -1351,11 +1386,11 @@
&& mUserManager.isUserRunning(userInfo.id);
}
- private Map<Integer, byte[]> getDecryptedPasswordsForAllTiedProfiles(int userId) {
+ private Map<Integer, LockscreenCredential> getDecryptedPasswordsForAllTiedProfiles(int userId) {
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
return null;
}
- Map<Integer, byte[]> result = new ArrayMap<Integer, byte[]>();
+ Map<Integer, LockscreenCredential> result = new ArrayMap<>();
final List<UserInfo> profiles = mUserManager.getProfiles(userId);
final int size = profiles.size();
for (int i = 0; i < size; i++) {
@@ -1393,7 +1428,7 @@
* terminates when the user is a managed profile.
*/
private void synchronizeUnifiedWorkChallengeForProfiles(int userId,
- Map<Integer, byte[]> profilePasswordMap) {
+ Map<Integer, LockscreenCredential> profilePasswordMap) {
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
return;
}
@@ -1408,20 +1443,23 @@
continue;
}
if (isSecure) {
- tieManagedProfileLockIfNecessary(managedUserId, null);
+ tieManagedProfileLockIfNecessary(managedUserId,
+ LockscreenCredential.createNone());
} else {
// We use cached work profile password computed before clearing the parent's
// credential, otherwise they get lost
- if (profilePasswordMap != null && profilePasswordMap.containsKey(managedUserId)) {
- setLockCredentialInternal(null, CREDENTIAL_TYPE_NONE,
+ if (profilePasswordMap != null
+ && profilePasswordMap.containsKey(managedUserId)) {
+ setLockCredentialInternal(LockscreenCredential.createNone(),
profilePasswordMap.get(managedUserId),
- DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, managedUserId,
+ managedUserId,
false, /* isLockTiedToParent= */ true);
} else {
Slog.wtf(TAG, "clear tied profile challenges, but no password supplied.");
- // Supplying null here would lead to untrusted credential change
- setLockCredentialInternal(null, CREDENTIAL_TYPE_NONE, null,
- DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, managedUserId,
+ // Attempt an untrusted reset by supplying an empty credential.
+ setLockCredentialInternal(LockscreenCredential.createNone(),
+ LockscreenCredential.createNone(),
+ managedUserId,
true, /* isLockTiedToParent= */ true);
}
mStorage.removeChildProfileLock(managedUserId);
@@ -1445,8 +1483,7 @@
* Send credentials for user {@code userId} to {@link RecoverableKeyStoreManager} during an
* unlock operation.
*/
- private void sendCredentialsOnUnlockIfRequired(
- int credentialType, @NonNull byte[] credential, int userId) {
+ private void sendCredentialsOnUnlockIfRequired(LockscreenCredential credential, int userId) {
// Don't send credentials during the factory reset protection flow.
if (userId == USER_FRP) {
return;
@@ -1459,10 +1496,12 @@
return;
}
+ // RecoverableKeyStoreManager expects null for empty credential.
+ final byte[] secret = credential.isNone() ? null : credential.getCredential();
// Send credentials for the user and any child profiles that share its lock screen.
for (int profileId : getProfilesWithSameLockScreen(userId)) {
mRecoverableKeyStoreManager.lockScreenSecretAvailable(
- credentialType, credential, profileId);
+ credential.getType(), secret, profileId);
}
}
@@ -1471,7 +1510,7 @@
* credentials are set/changed.
*/
private void sendCredentialsOnChangeIfRequired(
- int credentialType, byte[] credential, int userId, boolean isLockTiedToParent) {
+ LockscreenCredential credential, int userId, boolean isLockTiedToParent) {
// A profile whose lock screen is being tied to its parent's will either have a randomly
// generated credential (creation) or null (removal). We rely on the parent to send its
// credentials for the profile in both cases as it stores the unified lock credential.
@@ -1479,10 +1518,12 @@
return;
}
+ // RecoverableKeyStoreManager expects null for empty credential.
+ final byte[] secret = credential.isNone() ? null : credential.getCredential();
// Send credentials for the user and any child profiles that share its lock screen.
for (int profileId : getProfilesWithSameLockScreen(userId)) {
mRecoverableKeyStoreManager.lockScreenSecretChanged(
- credentialType, credential, profileId);
+ credential.getType(), secret, profileId);
}
}
@@ -1505,9 +1546,8 @@
// This method should be called by LockPatternUtil only, all internal methods in this class
// should call setLockCredentialInternal.
@Override
- public boolean setLockCredential(byte[] credential, int type,
- byte[] savedCredential, int requestedQuality, int userId,
- boolean allowUntrustedChange) {
+ public boolean setLockCredential(LockscreenCredential credential,
+ LockscreenCredential savedCredential, int userId, boolean allowUntrustedChange) {
if (!mLockPatternUtils.hasSecureLockScreen()) {
throw new UnsupportedOperationException(
@@ -1515,11 +1555,11 @@
}
checkWritePermission(userId);
synchronized (mSeparateChallengeLock) {
- if (!setLockCredentialInternal(credential, type, savedCredential, requestedQuality,
+ if (!setLockCredentialInternal(credential, savedCredential,
userId, allowUntrustedChange, /* isLockTiedToParent= */ false)) {
return false;
}
- setSeparateProfileChallengeEnabledLocked(userId, true, null);
+ setSeparateProfileChallengeEnabledLocked(userId, true, /* unused */ null);
notifyPasswordChanged(userId);
}
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
@@ -1531,51 +1571,44 @@
}
/**
+ * @param savedCredential if the user is a managed profile with unified challenge and
+ * savedCredential is empty, LSS will try to re-derive the profile password internally.
+ * TODO (b/80170828): Fix this so profile password is always passed in.
* @param isLockTiedToParent is {@code true} if {@code userId} is a profile and its new
* credentials are being tied to its parent's credentials.
*/
- private boolean setLockCredentialInternal(byte[] credential, @CredentialType int credentialType,
- byte[] savedCredential, int requestedQuality, int userId, boolean allowUntrustedChange,
- boolean isLockTiedToParent) {
- // Normalize savedCredential and credential such that empty string is always represented
- // as null.
- if (savedCredential == null || savedCredential.length == 0) {
- savedCredential = null;
- }
- if (credential == null || credential.length == 0) {
- credential = null;
- }
+ private boolean setLockCredentialInternal(LockscreenCredential credential,
+ LockscreenCredential savedCredential, int userId,
+ boolean allowUntrustedChange, boolean isLockTiedToParent) {
+ Preconditions.checkNotNull(credential);
+ Preconditions.checkNotNull(savedCredential);
synchronized (mSpManager) {
if (isSyntheticPasswordBasedCredentialLocked(userId)) {
- return spBasedSetLockCredentialInternalLocked(credential, credentialType,
- savedCredential, requestedQuality, userId, allowUntrustedChange,
- isLockTiedToParent);
+ return spBasedSetLockCredentialInternalLocked(credential, savedCredential, userId,
+ allowUntrustedChange, isLockTiedToParent);
}
}
- if (credentialType == CREDENTIAL_TYPE_NONE) {
- if (credential != null) {
- Slog.wtf(TAG, "CredentialType is none, but credential is non-null.");
- }
+ if (credential.isNone()) {
clearUserKeyProtection(userId);
gateKeeperClearSecureUserId(userId);
mStorage.writeCredentialHash(CredentialHash.createEmptyHash(), userId);
+ // Still update PASSWORD_TYPE_KEY if we are running in pre-synthetic password code path,
+ // since it forms part of the state that determines the credential type
+ // @see getCredentialTypeInternal
+ setKeyguardStoredQuality(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId);
setKeystorePassword(null, userId);
fixateNewestUserKeyAuth(userId);
synchronizeUnifiedWorkChallengeForProfiles(userId, null);
- setUserPasswordMetrics(CREDENTIAL_TYPE_NONE, null, userId);
- sendCredentialsOnChangeIfRequired(
- credentialType, credential, userId, isLockTiedToParent);
+ setUserPasswordMetrics(LockscreenCredential.createNone(), userId);
+ sendCredentialsOnChangeIfRequired(credential, userId, isLockTiedToParent);
return true;
}
- if (credential == null) {
- throw new IllegalArgumentException("Null credential with mismatched credential type");
- }
CredentialHash currentHandle = mStorage.readCredentialHash(userId);
if (isManagedProfileWithUnifiedLock(userId)) {
// get credential from keystore when managed profile has unified lock
- if (savedCredential == null) {
+ if (savedCredential.isNone()) {
try {
savedCredential = getDecryptedPasswordForTiedProfile(userId);
} catch (FileNotFoundException e) {
@@ -1589,47 +1622,50 @@
}
} else {
if (currentHandle.hash == null) {
- if (savedCredential != null) {
+ if (!savedCredential.isNone()) {
Slog.w(TAG, "Saved credential provided, but none stored");
}
- savedCredential = null;
+ savedCredential.close();
+ savedCredential = LockscreenCredential.createNone();
}
}
synchronized (mSpManager) {
if (shouldMigrateToSyntheticPasswordLocked(userId)) {
- initializeSyntheticPasswordLocked(currentHandle.hash, savedCredential,
- currentHandle.type, requestedQuality, userId);
- return spBasedSetLockCredentialInternalLocked(credential, credentialType,
- savedCredential, requestedQuality, userId, allowUntrustedChange,
- isLockTiedToParent);
+ initializeSyntheticPasswordLocked(currentHandle.hash, savedCredential, userId);
+ return spBasedSetLockCredentialInternalLocked(credential, savedCredential, userId,
+ allowUntrustedChange, isLockTiedToParent);
}
}
if (DEBUG) Slog.d(TAG, "setLockCredentialInternal: user=" + userId);
- byte[] enrolledHandle = enrollCredential(currentHandle.hash, savedCredential, credential,
- userId);
+ byte[] enrolledHandle = enrollCredential(currentHandle.hash,
+ savedCredential.getCredential(), credential.getCredential(), userId);
if (enrolledHandle == null) {
Slog.w(TAG, String.format("Failed to enroll %s: incorrect credential",
- credentialType == CREDENTIAL_TYPE_PASSWORD ? "password" : "pattern"));
+ credential.isPattern() ? "pattern" : "password"));
return false;
}
- CredentialHash willStore = CredentialHash.create(enrolledHandle, credentialType);
+ CredentialHash willStore = CredentialHash.create(enrolledHandle, credential.getType());
mStorage.writeCredentialHash(willStore, userId);
+ // Still update PASSWORD_TYPE_KEY if we are running in pre-synthetic password code path,
+ // since it forms part of the state that determines the credential type
+ // @see getCredentialTypeInternal
+ setKeyguardStoredQuality(
+ LockPatternUtils.credentialTypeToPasswordQuality(credential.getType()), userId);
// push new secret and auth token to vold
GateKeeperResponse gkResponse;
try {
gkResponse = getGateKeeperService().verifyChallenge(userId, 0, willStore.hash,
- credential);
+ credential.getCredential());
} catch (RemoteException e) {
throw new IllegalStateException("Failed to verify current credential", e);
}
setUserKeyProtection(userId, credential, convertResponse(gkResponse));
fixateNewestUserKeyAuth(userId);
// Refresh the auth token
- doVerifyCredential(credential, credentialType, CHALLENGE_FROM_CALLER, 0, userId,
+ doVerifyCredential(credential, CHALLENGE_FROM_CALLER, 0, userId,
null /* progressCallback */);
synchronizeUnifiedWorkChallengeForProfiles(userId, null);
- sendCredentialsOnChangeIfRequired(
- credentialType, credential, userId, isLockTiedToParent);
+ sendCredentialsOnChangeIfRequired(credential, userId, isLockTiedToParent);
return true;
}
@@ -1637,8 +1673,8 @@
return VerifyCredentialResponse.fromGateKeeperResponse(gateKeeperResponse);
}
- @VisibleForTesting
- protected void tieProfileLockToParent(int userId, byte[] password) {
+ @VisibleForTesting /** Note: this method is overridden in unit tests */
+ protected void tieProfileLockToParent(int userId, LockscreenCredential password) {
if (DEBUG) Slog.v(TAG, "tieProfileLockToParent for user: " + userId);
byte[] encryptionResult;
byte[] iv;
@@ -1673,7 +1709,7 @@
KeyProperties.KEY_ALGORITHM_AES + "/" + KeyProperties.BLOCK_MODE_GCM + "/"
+ KeyProperties.ENCRYPTION_PADDING_NONE);
cipher.init(Cipher.ENCRYPT_MODE, keyStoreEncryptionKey);
- encryptionResult = cipher.doFinal(password);
+ encryptionResult = cipher.doFinal(password.getCredential());
iv = cipher.getIV();
} finally {
// The original key can now be discarded.
@@ -1728,7 +1764,8 @@
addUserKeyAuth(userId, null, key);
}
- private void setUserKeyProtection(int userId, byte[] credential, VerifyCredentialResponse vcr) {
+ private void setUserKeyProtection(int userId, LockscreenCredential credential,
+ VerifyCredentialResponse vcr) {
if (DEBUG) Slog.d(TAG, "setUserKeyProtection: user=" + userId);
if (vcr == null) {
throw new IllegalArgumentException("Null response verifying a credential we just set");
@@ -1749,7 +1786,7 @@
addUserKeyAuth(userId, null, null);
}
- private static byte[] secretFromCredential(byte[] credential) {
+ private static byte[] secretFromCredential(LockscreenCredential credential) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-512");
// Personalize the hash
@@ -1757,7 +1794,7 @@
// Pad it to the block size of the hash function
personalization = Arrays.copyOf(personalization, 128);
digest.update(personalization);
- digest.update(credential);
+ digest.update(credential.getCredential());
return digest.digest();
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("NoSuchAlgorithmException for SHA-512");
@@ -1768,7 +1805,7 @@
try {
return mStorageManager.isUserKeyUnlocked(userId);
} catch (RemoteException e) {
- Log.e(TAG, "failed to check user key locked state", e);
+ Slog.e(TAG, "failed to check user key locked state", e);
return false;
}
}
@@ -1815,7 +1852,7 @@
checkWritePermission(userId);
if (DEBUG) Slog.v(TAG, "Reset keystore for user: " + userId);
int managedUserId = -1;
- byte[] managedUserDecryptedPassword = null;
+ LockscreenCredential managedUserDecryptedPassword = null;
final List<UserInfo> profiles = mUserManager.getProfiles(userId);
for (UserInfo pi : profiles) {
// Unlock managed profile with unified lock
@@ -1852,30 +1889,30 @@
tieProfileLockToParent(managedUserId, managedUserDecryptedPassword);
}
}
- if (managedUserDecryptedPassword != null && managedUserDecryptedPassword.length > 0) {
- Arrays.fill(managedUserDecryptedPassword, (byte) 0);
+ if (managedUserDecryptedPassword != null) {
+ managedUserDecryptedPassword.zeroize();
}
}
@Override
- public VerifyCredentialResponse checkCredential(byte[] credential, int type, int userId,
+ public VerifyCredentialResponse checkCredential(LockscreenCredential credential, int userId,
ICheckCredentialProgressCallback progressCallback) {
checkPasswordReadPermission(userId);
- return doVerifyCredential(credential, type, CHALLENGE_NONE, 0, userId, progressCallback);
+ return doVerifyCredential(credential, CHALLENGE_NONE, 0, userId, progressCallback);
}
@Override
- public VerifyCredentialResponse verifyCredential(byte[] credential, int type, long challenge,
- int userId) {
+ public VerifyCredentialResponse verifyCredential(LockscreenCredential credential,
+ long challenge, int userId) {
checkPasswordReadPermission(userId);
- return doVerifyCredential(credential, type, CHALLENGE_FROM_CALLER, challenge, userId,
+ return doVerifyCredential(credential, CHALLENGE_FROM_CALLER, challenge, userId,
null /* progressCallback */);
}
- private VerifyCredentialResponse doVerifyCredential(byte[] credential, int credentialType,
+ private VerifyCredentialResponse doVerifyCredential(LockscreenCredential credential,
@ChallengeType int challengeType, long challenge, int userId,
ICheckCredentialProgressCallback progressCallback) {
- return doVerifyCredential(credential, credentialType, challengeType, challenge, userId,
+ return doVerifyCredential(credential, challengeType, challenge, userId,
progressCallback, null /* resetLockouts */);
}
@@ -1883,25 +1920,25 @@
* Verify user credential and unlock the user. Fix pattern bug by deprecating the old base zero
* format.
*/
- private VerifyCredentialResponse doVerifyCredential(byte[] credential, int credentialType,
+ private VerifyCredentialResponse doVerifyCredential(LockscreenCredential credential,
@ChallengeType int challengeType, long challenge, int userId,
ICheckCredentialProgressCallback progressCallback,
@Nullable ArrayList<PendingResetLockout> resetLockouts) {
- if (credential == null || credential.length == 0) {
+ if (credential == null || credential.isNone()) {
throw new IllegalArgumentException("Credential can't be null or empty");
}
- if (userId == USER_FRP && Settings.Global.getInt(mContext.getContentResolver(),
+ if (userId == USER_FRP && mInjector.settingsGlobalGetInt(mContext.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
Slog.e(TAG, "FRP credential can only be verified prior to provisioning.");
return VerifyCredentialResponse.ERROR;
}
VerifyCredentialResponse response = null;
- response = spBasedDoVerifyCredential(credential, credentialType, challengeType, challenge,
+ response = spBasedDoVerifyCredential(credential, challengeType, challenge,
userId, progressCallback, resetLockouts);
// The user employs synthetic password based credential.
if (response != null) {
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
- sendCredentialsOnUnlockIfRequired(credentialType, credential, userId);
+ sendCredentialsOnUnlockIfRequired(credential, userId);
}
return response;
}
@@ -1912,9 +1949,9 @@
}
final CredentialHash storedHash = mStorage.readCredentialHash(userId);
- if (storedHash.type != credentialType) {
+ if (!credential.checkAgainstStoredType(storedHash.type)) {
Slog.wtf(TAG, "doVerifyCredential type mismatch with stored credential??"
- + " stored: " + storedHash.type + " passed in: " + credentialType);
+ + " stored: " + storedHash.type + " passed in: " + credential.getType());
return VerifyCredentialResponse.ERROR;
}
@@ -1929,7 +1966,7 @@
}
@Override
- public VerifyCredentialResponse verifyTiedProfileChallenge(byte[] credential, int type,
+ public VerifyCredentialResponse verifyTiedProfileChallenge(LockscreenCredential credential,
long challenge, int userId) {
checkPasswordReadPermission(userId);
if (!isManagedProfileWithUnifiedLock(userId)) {
@@ -1939,7 +1976,6 @@
// Unlock parent by using parent's challenge
final VerifyCredentialResponse parentResponse = doVerifyCredential(
credential,
- type,
CHALLENGE_FROM_CALLER,
challenge,
parentProfileId,
@@ -1952,7 +1988,6 @@
try {
// Unlock work profile, and work profile with unified lock must use password only
return doVerifyCredential(getDecryptedPasswordForTiedProfile(userId),
- CREDENTIAL_TYPE_PASSWORD,
CHALLENGE_FROM_CALLER,
challenge,
userId, null /* progressCallback */);
@@ -1971,15 +2006,14 @@
* hash to GK.
*/
private VerifyCredentialResponse verifyCredential(int userId, CredentialHash storedHash,
- byte[] credential, @ChallengeType int challengeType, long challenge,
+ LockscreenCredential credential, @ChallengeType int challengeType, long challenge,
ICheckCredentialProgressCallback progressCallback) {
- if ((storedHash == null || storedHash.hash.length == 0)
- && (credential == null || credential.length == 0)) {
+ if ((storedHash == null || storedHash.hash.length == 0) && credential.isNone()) {
// don't need to pass empty credentials to GateKeeper
return VerifyCredentialResponse.OK;
}
- if (storedHash == null || credential == null || credential.length == 0) {
+ if (storedHash == null || storedHash.hash.length == 0 || credential.isNone()) {
return VerifyCredentialResponse.ERROR;
}
@@ -1989,8 +2023,8 @@
GateKeeperResponse gateKeeperResponse;
try {
- gateKeeperResponse = getGateKeeperService()
- .verifyChallenge(userId, challenge, storedHash.hash, credential);
+ gateKeeperResponse = getGateKeeperService().verifyChallenge(
+ userId, challenge, storedHash.hash, credential.getCredential());
} catch (RemoteException e) {
Slog.e(TAG, "gatekeeper verify failed", e);
gateKeeperResponse = GateKeeperResponse.ERROR;
@@ -2006,11 +2040,11 @@
try {
progressCallback.onCredentialVerified();
} catch (RemoteException e) {
- Log.w(TAG, "progressCallback throws exception", e);
+ Slog.w(TAG, "progressCallback throws exception", e);
}
}
- setUserPasswordMetrics(storedHash.type, credential, userId);
- unlockKeystore(credential, userId);
+ setUserPasswordMetrics(credential, userId);
+ unlockKeystore(credential.getCredential(), userId);
Slog.i(TAG, "Unlocking user " + userId + " with token length "
+ response.getPayload().length);
@@ -2019,27 +2053,22 @@
if (isManagedProfileWithSeparatedLock(userId)) {
setDeviceUnlockedForUser(userId);
}
- int reEnrollQuality = storedHash.type == CREDENTIAL_TYPE_PATTERN
- ? DevicePolicyManager.PASSWORD_QUALITY_SOMETHING
- : DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
- /* TODO(roosa): keep the same password quality */;
if (shouldReEnroll) {
- setLockCredentialInternal(credential, storedHash.type, credential,
- reEnrollQuality, userId, false, /* isLockTiedToParent= */ false);
+ setLockCredentialInternal(credential, credential,
+ userId, false, /* isLockTiedToParent= */ false);
} else {
// Now that we've cleared of all required GK migration, let's do the final
// migration to synthetic password.
synchronized (mSpManager) {
if (shouldMigrateToSyntheticPasswordLocked(userId)) {
AuthenticationToken auth = initializeSyntheticPasswordLocked(
- storedHash.hash, credential, storedHash.type, reEnrollQuality,
- userId);
+ storedHash.hash, credential, userId);
activateEscrowTokens(auth, userId);
}
}
}
// Use credentials to create recoverable keystore snapshot.
- sendCredentialsOnUnlockIfRequired(storedHash.type, credential, userId);
+ sendCredentialsOnUnlockIfRequired(credential, userId);
} else if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_RETRY) {
if (response.getTimeout() > 0) {
@@ -2055,12 +2084,9 @@
* when the user is authenticating or when a new password is being set. In comparison,
* {@link #notifyPasswordChanged} only needs to be called when the user changes the password.
*/
- private void setUserPasswordMetrics(@CredentialType int credentialType, byte[] password,
- @UserIdInt int userHandle) {
+ private void setUserPasswordMetrics(LockscreenCredential password, @UserIdInt int userHandle) {
synchronized (this) {
- mUserPasswordMetrics.put(userHandle,
- PasswordMetrics.computeForCredential(
- LockscreenCredential.createRaw(credentialType, password)));
+ mUserPasswordMetrics.put(userHandle, PasswordMetrics.computeForCredential(password));
}
}
@@ -2089,6 +2115,14 @@
});
}
+ private LockscreenCredential createPattern(String patternString) {
+ final byte[] patternBytes = patternString.getBytes();
+ LockscreenCredential pattern = LockscreenCredential.createPattern(
+ LockPatternUtils.byteArrayToPattern(patternBytes));
+ Arrays.fill(patternBytes, (byte) 0);
+ return pattern;
+ }
+
@Override
public boolean checkVoldPassword(int userId) {
if (!mFirstCallToVold) {
@@ -2119,30 +2153,34 @@
} finally {
Binder.restoreCallingIdentity(identity);
}
- if (password == null) {
+ if (TextUtils.isEmpty(password)) {
return false;
}
try {
- if (mLockPatternUtils.isLockPatternEnabled(userId)) {
- if (checkCredential(password.getBytes(), CREDENTIAL_TYPE_PATTERN,
- userId, null /* progressCallback */)
- .getResponseCode() == GateKeeperResponse.RESPONSE_OK) {
- return true;
- }
+ final LockscreenCredential credential;
+ switch (getCredentialTypeInternal(userId)) {
+ case CREDENTIAL_TYPE_PATTERN:
+ credential = createPattern(password);
+ break;
+ case CREDENTIAL_TYPE_PIN:
+ credential = LockscreenCredential.createPin(password);
+ break;
+ case CREDENTIAL_TYPE_PASSWORD:
+ credential = LockscreenCredential.createPassword(password);
+ break;
+ default:
+ credential = null;
+ Slog.e(TAG, "Unknown credential type");
}
- } catch (Exception e) {
- }
- try {
- if (mLockPatternUtils.isLockPasswordEnabled(userId)) {
- if (checkCredential(password.getBytes(), CREDENTIAL_TYPE_PASSWORD,
- userId, null /* progressCallback */)
+ if (credential != null
+ && checkCredential(credential, userId, null /* progressCallback */)
.getResponseCode() == GateKeeperResponse.RESPONSE_OK) {
- return true;
- }
+ return true;
}
} catch (Exception e) {
+ Slog.e(TAG, "checkVoldPassword failed: ", e);
}
return false;
@@ -2524,7 +2562,7 @@
@GuardedBy("mSpManager")
@VisibleForTesting
protected AuthenticationToken initializeSyntheticPasswordLocked(byte[] credentialHash,
- byte[] credential, int credentialType, int requestedQuality, int userId) {
+ LockscreenCredential credential, int userId) {
Slog.i(TAG, "Initialize SyntheticPassword for user: " + userId);
final AuthenticationToken auth = mSpManager.newSyntheticPasswordAndSid(
getGateKeeperService(), credentialHash, credential, userId);
@@ -2534,8 +2572,8 @@
return null;
}
long handle = mSpManager.createPasswordBasedSyntheticPassword(getGateKeeperService(),
- credential, credentialType, auth, requestedQuality, userId);
- if (credential != null) {
+ credential, auth, userId);
+ if (!credential.isNone()) {
if (credentialHash == null) {
// Since when initializing SP, we didn't provide an existing password handle
// for it to migrate SID, we need to create a new SID for the user.
@@ -2567,6 +2605,13 @@
}
+ @VisibleForTesting
+ boolean isSyntheticPasswordBasedCredential(int userId) {
+ synchronized (mSpManager) {
+ return isSyntheticPasswordBasedCredentialLocked(userId);
+ }
+ }
+
private boolean isSyntheticPasswordBasedCredentialLocked(int userId) {
if (userId == USER_FRP) {
final int type = mStorage.readPersistentDataBlock().type;
@@ -2592,8 +2637,8 @@
setLong(SYNTHETIC_PASSWORD_ENABLED_KEY, 1, UserHandle.USER_SYSTEM);
}
- private VerifyCredentialResponse spBasedDoVerifyCredential(byte[] userCredential,
- @CredentialType int credentialType, @ChallengeType int challengeType, long challenge,
+ private VerifyCredentialResponse spBasedDoVerifyCredential(LockscreenCredential userCredential,
+ @ChallengeType int challengeType, long challenge,
int userId, ICheckCredentialProgressCallback progressCallback,
@Nullable ArrayList<PendingResetLockout> resetLockouts) {
@@ -2601,9 +2646,6 @@
Slog.d(TAG, "spBasedDoVerifyCredential: user=" + userId + " challengeType=" + challengeType
+ " hasEnrolledBiometrics=" + hasEnrolledBiometrics);
- if (credentialType == CREDENTIAL_TYPE_NONE) {
- userCredential = null;
- }
final PackageManager pm = mContext.getPackageManager();
// TODO: When lockout is handled under the HAL for all biometrics (fingerprint),
@@ -2625,17 +2667,13 @@
}
if (userId == USER_FRP) {
return mSpManager.verifyFrpCredential(getGateKeeperService(),
- userCredential, credentialType, progressCallback);
+ userCredential, progressCallback);
}
long handle = getSyntheticPasswordHandleLocked(userId);
authResult = mSpManager.unwrapPasswordBasedSyntheticPassword(
getGateKeeperService(), handle, userCredential, userId, progressCallback);
- if (authResult.credentialType != credentialType) {
- Slog.e(TAG, "Credential type mismatch.");
- return VerifyCredentialResponse.ERROR;
- }
response = authResult.gkResponse;
// credential has matched
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
@@ -2653,7 +2691,7 @@
}
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
- setUserPasswordMetrics(credentialType, userCredential, userId);
+ setUserPasswordMetrics(userCredential, userId);
unlockKeystore(authResult.authToken.deriveKeyStorePassword(), userId);
// Do resetLockout / revokeChallenge when all profiles are unlocked
@@ -2700,14 +2738,13 @@
* added back when new password is set in future.
*/
@GuardedBy("mSpManager")
- private long setLockCredentialWithAuthTokenLocked(byte[] credential,
- @CredentialType int credentialType, AuthenticationToken auth, int requestedQuality,
- int userId) {
+ private long setLockCredentialWithAuthTokenLocked(LockscreenCredential credential,
+ AuthenticationToken auth, int userId) {
if (DEBUG) Slog.d(TAG, "setLockCredentialWithAuthTokenLocked: user=" + userId);
long newHandle = mSpManager.createPasswordBasedSyntheticPassword(getGateKeeperService(),
- credential, credentialType, auth, requestedQuality, userId);
- final Map<Integer, byte[]> profilePasswords;
- if (credential != null) {
+ credential, auth, userId);
+ final Map<Integer, LockscreenCredential> profilePasswords;
+ if (!credential.isNone()) {
// not needed by synchronizeUnifiedWorkChallengeForProfiles()
profilePasswords = null;
@@ -2748,11 +2785,11 @@
setSyntheticPasswordHandleLocked(newHandle, userId);
synchronizeUnifiedWorkChallengeForProfiles(userId, profilePasswords);
- setUserPasswordMetrics(credentialType, credential, userId);
+ setUserPasswordMetrics(credential, userId);
if (profilePasswords != null) {
- for (Map.Entry<Integer, byte[]> entry : profilePasswords.entrySet()) {
- Arrays.fill(entry.getValue(), (byte) 0);
+ for (Map.Entry<Integer, LockscreenCredential> entry : profilePasswords.entrySet()) {
+ entry.getValue().zeroize();
}
}
@@ -2838,12 +2875,17 @@
};
}
+ /**
+ * @param savedCredential if the user is a managed profile with unified challenge and
+ * savedCredential is empty, LSS will try to re-derive the profile password internally.
+ * TODO (b/80170828): Fix this so profile password is always passed in.
+ */
@GuardedBy("mSpManager")
- private boolean spBasedSetLockCredentialInternalLocked(byte[] credential, int credentialType,
- byte[] savedCredential, int requestedQuality, int userId,
+ private boolean spBasedSetLockCredentialInternalLocked(LockscreenCredential credential,
+ LockscreenCredential savedCredential, int userId,
boolean allowUntrustedChange, boolean isLockTiedToParent) {
if (DEBUG) Slog.d(TAG, "spBasedSetLockCredentialInternalLocked: user=" + userId);
- if (isManagedProfileWithUnifiedLock(userId)) {
+ if (savedCredential.isNone() && isManagedProfileWithUnifiedLock(userId)) {
// get credential from keystore when managed profile has unified lock
try {
savedCredential = getDecryptedPasswordForTiedProfile(userId);
@@ -2863,9 +2905,8 @@
AuthenticationToken auth = authResult.authToken;
// If existing credential is provided, the existing credential must match.
- if (savedCredential != null && auth == null) {
- Slog.w(TAG, String.format("Failed to enroll %s: incorrect credential",
- credentialType == CREDENTIAL_TYPE_PASSWORD ? "password" : "pattern"));
+ if (!savedCredential.isNone() && auth == null) {
+ Slog.w(TAG, "Failed to enroll: incorrect credential");
return false;
}
boolean untrustedReset = false;
@@ -2898,8 +2939,7 @@
// setLockCredentialWithAuthTokenLocked next
mSpManager.newSidForUser(getGateKeeperService(), auth, userId);
}
- setLockCredentialWithAuthTokenLocked(credential, credentialType, auth, requestedQuality,
- userId);
+ setLockCredentialWithAuthTokenLocked(credential, auth, userId);
mSpManager.destroyPasswordBasedSyntheticPassword(handle, userId);
} else {
throw new IllegalStateException(
@@ -2908,7 +2948,7 @@
// requestedQuality, userId) instead if we still allow untrusted reset that changes
// synthetic password. That would invalidate existing escrow tokens though.
}
- sendCredentialsOnChangeIfRequired(credentialType, credential, userId, isLockTiedToParent);
+ sendCredentialsOnChangeIfRequired(credential, userId, isLockTiedToParent);
return true;
}
@@ -2919,11 +2959,8 @@
* If user is a managed profile with unified challenge, currentCredential is ignored.
*/
@Override
- public byte[] getHashFactor(byte[] currentCredential, int userId) {
+ public byte[] getHashFactor(LockscreenCredential currentCredential, int userId) {
checkPasswordReadPermission(userId);
- if (currentCredential == null || currentCredential.length == 0) {
- currentCredential = null;
- }
if (isManagedProfileWithUnifiedLock(userId)) {
try {
currentCredential = getDecryptedPasswordForTiedProfile(userId);
@@ -2957,13 +2994,12 @@
AuthenticationToken auth = null;
if (!isUserSecure(userId)) {
if (shouldMigrateToSyntheticPasswordLocked(userId)) {
- auth = initializeSyntheticPasswordLocked(null, null,
- CREDENTIAL_TYPE_NONE,
- DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId);
+ auth = initializeSyntheticPasswordLocked(
+ /* credentialHash */ null, LockscreenCredential.createNone(), userId);
} else /* isSyntheticPasswordBasedCredentialLocked(userId) */ {
long pwdHandle = getSyntheticPasswordHandleLocked(userId);
auth = mSpManager.unwrapPasswordBasedSyntheticPassword(getGateKeeperService(),
- pwdHandle, null, userId, null).authToken;
+ pwdHandle, LockscreenCredential.createNone(), userId, null).authToken;
}
}
if (isSyntheticPasswordBasedCredentialLocked(userId)) {
@@ -3023,21 +3059,21 @@
}
}
- private boolean setLockCredentialWithToken(byte[] credential, int type, long tokenHandle,
- byte[] token, int requestedQuality, int userId) {
+ private boolean setLockCredentialWithToken(LockscreenCredential credential, long tokenHandle,
+ byte[] token, int userId) {
boolean result;
synchronized (mSpManager) {
if (!mSpManager.hasEscrowData(userId)) {
throw new SecurityException("Escrow token is disabled on the current user");
}
- result = setLockCredentialWithTokenInternalLocked(credential, type, tokenHandle, token,
- requestedQuality, userId);
+ result = setLockCredentialWithTokenInternalLocked(
+ credential, tokenHandle, token, userId);
}
if (result) {
synchronized (mSeparateChallengeLock) {
- setSeparateProfileChallengeEnabledLocked(userId, true, null);
+ setSeparateProfileChallengeEnabledLocked(userId, true, /* unused */ null);
}
- if (credential == null) {
+ if (credential.isNone()) {
// If clearing credential, unlock the user manually in order to progress user start
// Call unlockUser() on a handler thread so no lock is held (either by LSS or by
// the caller like DPMS), otherwise it can lead to deadlock.
@@ -3050,8 +3086,8 @@
}
@GuardedBy("mSpManager")
- private boolean setLockCredentialWithTokenInternalLocked(byte[] credential, int type,
- long tokenHandle, byte[] token, int requestedQuality, int userId) {
+ private boolean setLockCredentialWithTokenInternalLocked(LockscreenCredential credential,
+ long tokenHandle, byte[] token, int userId) {
final AuthenticationResult result;
result = mSpManager.unwrapTokenBasedSyntheticPassword(
getGateKeeperService(), tokenHandle, token, userId);
@@ -3066,11 +3102,8 @@
+ "verification.");
return false;
}
- // TODO: refactor usage of PASSWORD_TYPE_KEY b/65239740
- setLong(LockPatternUtils.PASSWORD_TYPE_KEY, requestedQuality, userId);
long oldHandle = getSyntheticPasswordHandleLocked(userId);
- setLockCredentialWithAuthTokenLocked(credential, type, result.authToken,
- requestedQuality, userId);
+ setLockCredentialWithAuthTokenLocked(credential, result.authToken, userId);
mSpManager.destroyPasswordBasedSyntheticPassword(oldHandle, userId);
onAuthTokenKnownForUser(userId, result.authToken);
@@ -3132,11 +3165,10 @@
}
// It's OK to dump the password type since anyone with physical access can just
// observe it from the keyguard directly.
- pw.println("PasswordType: " + getLong(LockPatternUtils.PASSWORD_TYPE_KEY, 0, userId));
- pw.println("hasPassword: " + havePassword(userId));
- pw.println("hasPattern: " + havePattern(userId)); // print raw credential type instead?
- pw.println("SeparateChallenge: " + getSeparateProfileChallengeEnabled(userId));
- pw.println(String.format("metrics: %s",
+ pw.println("Quality: " + getKeyguardStoredQuality(userId));
+ pw.println("CredentialType: " + getCredentialTypeInternal(userId));
+ pw.println("SeparateChallenge: " + getSeparateProfileChallengeEnabledInternal(userId));
+ pw.println(String.format("Metrics: %s",
getUserPasswordMetrics(userId) != null ? "known" : "unknown"));
pw.decreaseIndent();
}
@@ -3298,14 +3330,14 @@
}
@Override
- public boolean setLockCredentialWithToken(byte[] credential, int type,
- long tokenHandle, byte[] token, int requestedQuality, int userId) {
+ public boolean setLockCredentialWithToken(LockscreenCredential credential, long tokenHandle,
+ byte[] token, int userId) {
if (!mLockPatternUtils.hasSecureLockScreen()) {
throw new UnsupportedOperationException(
"This operation requires secure lock screen feature.");
}
- return LockSettingsService.this.setLockCredentialWithToken(credential, type,
- tokenHandle, token, requestedQuality, userId);
+ return LockSettingsService.this.setLockCredentialWithToken(
+ credential, tokenHandle, token, userId);
}
@Override
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
index 0a8e5bd..0f8561e 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
@@ -16,14 +16,22 @@
package com.android.server.locksettings;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
+
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
+
import android.app.ActivityManager;
+import android.app.admin.PasswordMetrics;
import android.os.ShellCommand;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
import com.android.internal.widget.LockscreenCredential;
+import com.android.internal.widget.PasswordValidationError;
import java.io.PrintWriter;
+import java.util.List;
class LockSettingsShellCommand extends ShellCommand {
@@ -70,18 +78,19 @@
if (!checkCredential()) {
return -1;
}
+ boolean success = true;
switch (cmd) {
case COMMAND_SET_PATTERN:
- runSetPattern();
+ success = runSetPattern();
break;
case COMMAND_SET_PASSWORD:
- runSetPassword();
+ success = runSetPassword();
break;
case COMMAND_SET_PIN:
- runSetPin();
+ success = runSetPin();
break;
case COMMAND_CLEAR:
- runClear();
+ success = runClear();
break;
case COMMAND_SP:
runChangeSp();
@@ -102,7 +111,7 @@
getErrPrintWriter().println("Unknown command: " + cmd);
break;
}
- return 0;
+ return success ? 0 : -1;
} catch (Exception e) {
getErrPrintWriter().println("Error while executing command: " + cmd);
e.printStackTrace(getErrPrintWriter());
@@ -201,34 +210,66 @@
}
}
- private void runSetPattern() {
- mLockPatternUtils.setLockCredential(
- LockscreenCredential.createPattern(LockPatternUtils.byteArrayToPattern(
- mNew.getBytes())),
- getOldCredential(),
- mCurrentUserId);
+ private boolean runSetPattern() {
+ final LockscreenCredential pattern = LockscreenCredential.createPattern(
+ LockPatternUtils.byteArrayToPattern(mNew.getBytes()));
+ if (!isNewCredentialSufficient(pattern)) {
+ return false;
+ }
+ mLockPatternUtils.setLockCredential(pattern, getOldCredential(), mCurrentUserId);
getOutPrintWriter().println("Pattern set to '" + mNew + "'");
+ return true;
}
- private void runSetPassword() {
- mLockPatternUtils.setLockCredential(LockscreenCredential.createPassword(mNew),
- getOldCredential(),
- mCurrentUserId);
+ private boolean runSetPassword() {
+ final LockscreenCredential password = LockscreenCredential.createPassword(mNew);
+ if (!isNewCredentialSufficient(password)) {
+ return false;
+ }
+ mLockPatternUtils.setLockCredential(password, getOldCredential(), mCurrentUserId);
getOutPrintWriter().println("Password set to '" + mNew + "'");
+ return true;
}
- private void runSetPin() {
- mLockPatternUtils.setLockCredential(LockscreenCredential.createPin(mNew),
- getOldCredential(),
- mCurrentUserId);
+ private boolean runSetPin() {
+ final LockscreenCredential pin = LockscreenCredential.createPin(mNew);
+ if (!isNewCredentialSufficient(pin)) {
+ return false;
+ }
+ mLockPatternUtils.setLockCredential(pin, getOldCredential(), mCurrentUserId);
getOutPrintWriter().println("Pin set to '" + mNew + "'");
+ return true;
}
- private void runClear() {
- mLockPatternUtils.setLockCredential(LockscreenCredential.createNone(),
- getOldCredential(),
- mCurrentUserId);
+ private boolean runClear() {
+ LockscreenCredential none = LockscreenCredential.createNone();
+ if (!isNewCredentialSufficient(none)) {
+ return false;
+ }
+ mLockPatternUtils.setLockCredential(none, getOldCredential(), mCurrentUserId);
getOutPrintWriter().println("Lock credential cleared");
+ return true;
+ }
+
+ private boolean isNewCredentialSufficient(LockscreenCredential credential) {
+ final PasswordMetrics requiredMetrics =
+ mLockPatternUtils.getRequestedPasswordMetrics(mCurrentUserId);
+ final List<PasswordValidationError> errors;
+ if (credential.isPassword() || credential.isPin()) {
+ errors = PasswordMetrics.validatePassword(requiredMetrics, PASSWORD_COMPLEXITY_NONE,
+ credential.isPin(), credential.getCredential());
+ } else {
+ PasswordMetrics metrics = new PasswordMetrics(
+ credential.isPattern() ? CREDENTIAL_TYPE_PATTERN : CREDENTIAL_TYPE_NONE);
+ errors = PasswordMetrics.validatePasswordMetrics(
+ requiredMetrics, PASSWORD_COMPLEXITY_NONE, false /* isPin */, metrics);
+ }
+ if (!errors.isEmpty()) {
+ getOutPrintWriter().println(
+ "New credential doesn't satisfy admin policies: " + errors.get(0));
+ return false;
+ }
+ return true;
}
private void runSetDisabled() {
@@ -243,9 +284,7 @@
}
private boolean checkCredential() {
- final boolean havePassword = mLockPatternUtils.isLockPasswordEnabled(mCurrentUserId);
- final boolean havePattern = mLockPatternUtils.isLockPatternEnabled(mCurrentUserId);
- if (havePassword || havePattern) {
+ if (mLockPatternUtils.isSecure(mCurrentUserId)) {
if (mLockPatternUtils.isManagedProfileWithUnifiedChallenge(mCurrentUserId)) {
getOutPrintWriter().println("Profile uses unified challenge");
return false;
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
index f4cad63..3dab3ce 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
@@ -30,7 +30,6 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.util.ArrayMap;
-import android.util.Log;
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
@@ -214,7 +213,7 @@
private CredentialHash readPasswordHashIfExists(int userId) {
byte[] stored = readFile(getLockPasswordFilename(userId));
if (!ArrayUtils.isEmpty(stored)) {
- return new CredentialHash(stored, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD);
+ return new CredentialHash(stored, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN);
}
return null;
}
@@ -270,10 +269,6 @@
return hasFile(getLockPatternFilename(userId));
}
- public boolean hasCredential(int userId) {
- return hasPassword(userId) || hasPattern(userId);
- }
-
private boolean hasFile(String name) {
byte[] contents = readFile(name);
return contents != null && contents.length > 0;
@@ -360,11 +355,15 @@
public void writeCredentialHash(CredentialHash hash, int userId) {
byte[] patternHash = null;
byte[] passwordHash = null;
-
- if (hash.type == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD) {
+ if (hash.type == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN
+ || hash.type == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD
+ || hash.type == LockPatternUtils.CREDENTIAL_TYPE_PIN) {
passwordHash = hash.hash;
} else if (hash.type == LockPatternUtils.CREDENTIAL_TYPE_PATTERN) {
patternHash = hash.hash;
+ } else {
+ Preconditions.checkArgument(hash.type == LockPatternUtils.CREDENTIAL_TYPE_NONE,
+ "Unknown credential type");
}
writeFile(getLockPasswordFilename(userId), passwordHash);
writeFile(getLockPatternFilename(userId), patternHash);
@@ -523,8 +522,8 @@
mCache.clear();
}
- @Nullable
- public PersistentDataBlockManagerInternal getPersistentDataBlock() {
+ @Nullable @VisibleForTesting
+ PersistentDataBlockManagerInternal getPersistentDataBlockManager() {
if (mPersistentDataBlockManagerInternal == null) {
mPersistentDataBlockManagerInternal =
LocalServices.getService(PersistentDataBlockManagerInternal.class);
@@ -534,7 +533,7 @@
public void writePersistentDataBlock(int persistentType, int userId, int qualityForUi,
byte[] payload) {
- PersistentDataBlockManagerInternal persistentDataBlock = getPersistentDataBlock();
+ PersistentDataBlockManagerInternal persistentDataBlock = getPersistentDataBlockManager();
if (persistentDataBlock == null) {
return;
}
@@ -543,7 +542,7 @@
}
public PersistentData readPersistentDataBlock() {
- PersistentDataBlockManagerInternal persistentDataBlock = getPersistentDataBlock();
+ PersistentDataBlockManagerInternal persistentDataBlock = getPersistentDataBlockManager();
if (persistentDataBlock == null) {
return PersistentData.NONE;
}
@@ -699,7 +698,7 @@
}
if (upgradeVersion != DATABASE_VERSION) {
- Log.w(TAG, "Failed to upgrade database!");
+ Slog.w(TAG, "Failed to upgrade database!");
}
}
}
diff --git a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
index 955a9aa..53d922b 100644
--- a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
+++ b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
@@ -20,7 +20,6 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.pm.UserInfo;
import android.hardware.weaver.V1_0.IWeaver;
@@ -35,13 +34,13 @@
import android.service.gatekeeper.GateKeeperResponse;
import android.service.gatekeeper.IGateKeeperService;
import android.util.ArrayMap;
-import android.util.Log;
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.widget.ICheckCredentialProgressCallback;
import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.server.locksettings.LockSettingsStorage.PersistentData;
@@ -138,7 +137,6 @@
static class AuthenticationResult {
public AuthenticationToken authToken;
public VerifyCredentialResponse gkResponse;
- public int credentialType;
}
static class AuthenticationToken {
@@ -220,7 +218,7 @@
byte scryptN;
byte scryptR;
byte scryptP;
- public int passwordType;
+ public int credentialType;
byte[] salt;
// For GateKeeper-based credential, this is the password handle returned by GK,
// for weaver-based credential, this is empty.
@@ -231,7 +229,7 @@
result.scryptN = PASSWORD_SCRYPT_N;
result.scryptR = PASSWORD_SCRYPT_R;
result.scryptP = PASSWORD_SCRYPT_P;
- result.passwordType = passwordType;
+ result.credentialType = passwordType;
result.salt = secureRandom(PASSWORD_SALT_LENGTH);
return result;
}
@@ -241,7 +239,7 @@
ByteBuffer buffer = ByteBuffer.allocate(data.length);
buffer.put(data, 0, data.length);
buffer.flip();
- result.passwordType = buffer.getInt();
+ result.credentialType = buffer.getInt();
result.scryptN = buffer.get();
result.scryptR = buffer.get();
result.scryptP = buffer.get();
@@ -263,7 +261,7 @@
ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES + 3 * Byte.BYTES
+ Integer.BYTES + salt.length + Integer.BYTES +
(passwordHandle != null ? passwordHandle.length : 0));
- buffer.putInt(passwordType);
+ buffer.putInt(credentialType);
buffer.put(scryptN);
buffer.put(scryptR);
buffer.put(scryptP);
@@ -366,11 +364,11 @@
try {
int writeStatus = mWeaver.write(slot, toByteArrayList(key), toByteArrayList(value));
if (writeStatus != WeaverStatus.OK) {
- Log.e(TAG, "weaver write failed, slot: " + slot + " status: " + writeStatus);
+ Slog.e(TAG, "weaver write failed, slot: " + slot + " status: " + writeStatus);
return null;
}
} catch (RemoteException e) {
- Log.e(TAG, "weaver write failed", e);
+ Slog.e(TAG, "weaver write failed", e);
return null;
}
return value;
@@ -401,31 +399,31 @@
break;
case WeaverReadStatus.THROTTLE:
response[0] = new VerifyCredentialResponse(readResponse.timeout);
- Log.e(TAG, "weaver read failed (THROTTLE), slot: " + slot);
+ Slog.e(TAG, "weaver read failed (THROTTLE), slot: " + slot);
break;
case WeaverReadStatus.INCORRECT_KEY:
if (readResponse.timeout == 0) {
response[0] = VerifyCredentialResponse.ERROR;
- Log.e(TAG, "weaver read failed (INCORRECT_KEY), slot: " + slot);
+ Slog.e(TAG, "weaver read failed (INCORRECT_KEY), slot: " + slot);
} else {
response[0] = new VerifyCredentialResponse(readResponse.timeout);
- Log.e(TAG, "weaver read failed (INCORRECT_KEY/THROTTLE), slot: "
+ Slog.e(TAG, "weaver read failed (INCORRECT_KEY/THROTTLE), slot: "
+ slot);
}
break;
case WeaverReadStatus.FAILED:
response[0] = VerifyCredentialResponse.ERROR;
- Log.e(TAG, "weaver read failed (FAILED), slot: " + slot);
+ Slog.e(TAG, "weaver read failed (FAILED), slot: " + slot);
break;
default:
response[0] = VerifyCredentialResponse.ERROR;
- Log.e(TAG, "weaver read unknown status " + status + ", slot: " + slot);
+ Slog.e(TAG, "weaver read unknown status " + status + ", slot: " + slot);
break;
}
});
} catch (RemoteException e) {
response[0] = VerifyCredentialResponse.ERROR;
- Log.e(TAG, "weaver read failed, slot: " + slot, e);
+ Slog.e(TAG, "weaver read failed, slot: " + slot, e);
}
return response[0];
}
@@ -437,13 +435,20 @@
}
}
- public int getCredentialType(long handle, int userId) {
+ int getCredentialType(long handle, int userId) {
byte[] passwordData = loadState(PASSWORD_DATA_NAME, handle, userId);
if (passwordData == null) {
- Log.w(TAG, "getCredentialType: encountered empty password data for user " + userId);
+ Slog.w(TAG, "getCredentialType: encountered empty password data for user " + userId);
return LockPatternUtils.CREDENTIAL_TYPE_NONE;
}
- return PasswordData.fromBytes(passwordData).passwordType;
+ return PasswordData.fromBytes(passwordData).credentialType;
+ }
+
+ static int getFrpCredentialType(byte[] payload) {
+ if (payload == null) {
+ return LockPatternUtils.CREDENTIAL_TYPE_NONE;
+ }
+ return PasswordData.fromBytes(payload).credentialType;
}
/**
@@ -469,17 +474,18 @@
*
*/
public AuthenticationToken newSyntheticPasswordAndSid(IGateKeeperService gatekeeper,
- byte[] hash, byte[] credential, int userId) {
+ byte[] hash, LockscreenCredential credential, int userId) {
AuthenticationToken result = AuthenticationToken.create();
GateKeeperResponse response;
if (hash != null) {
try {
- response = gatekeeper.enroll(userId, hash, credential, result.deriveGkPassword());
+ response = gatekeeper.enroll(userId, hash, credential.getCredential(),
+ result.deriveGkPassword());
} catch (RemoteException e) {
throw new IllegalStateException("Failed to enroll credential duing SP init", e);
}
if (response.getResponseCode() != GateKeeperResponse.RESPONSE_OK) {
- Log.w(TAG, "Fail to migrate SID, assuming no SID, user " + userId);
+ Slog.w(TAG, "Fail to migrate SID, assuming no SID, user " + userId);
clearSidForUser(userId);
} else {
saveSyntheticPasswordHandle(response.getPayload(), userId);
@@ -504,7 +510,7 @@
throw new IllegalStateException("Failed to create new SID for user", e);
}
if (response.getResponseCode() != GateKeeperResponse.RESPONSE_OK) {
- Log.e(TAG, "Fail to create new SID for user " + userId);
+ Slog.e(TAG, "Fail to create new SID for user " + userId);
return;
}
saveSyntheticPasswordHandle(response.getPayload(), userId);
@@ -561,7 +567,7 @@
buffer.put(data, 0, data.length);
buffer.flip();
if (buffer.get() != WEAVER_VERSION) {
- Log.e(TAG, "Invalid weaver slot version of handle " + handle);
+ Slog.e(TAG, "Invalid weaver slot version of handle " + handle);
return INVALID_WEAVER_SLOT;
}
return buffer.getInt();
@@ -580,11 +586,11 @@
if (slot != INVALID_WEAVER_SLOT) {
Set<Integer> usedSlots = getUsedWeaverSlots();
if (!usedSlots.contains(slot)) {
- Log.i(TAG, "Destroy weaver slot " + slot + " for user " + userId);
+ Slog.i(TAG, "Destroy weaver slot " + slot + " for user " + userId);
weaverEnroll(slot, null, null);
mPasswordSlotManager.markSlotDeleted(slot);
} else {
- Log.w(TAG, "Skip destroying reused weaver slot " + slot + " for user " + userId);
+ Slog.w(TAG, "Skip destroying reused weaver slot " + slot + " for user " + userId);
}
}
}
@@ -638,15 +644,9 @@
* @throw IllegalStateException if creation fails.
*/
public long createPasswordBasedSyntheticPassword(IGateKeeperService gatekeeper,
- byte[] credential, int credentialType, AuthenticationToken authToken,
- int requestedQuality, int userId) {
- if (credential == null || credentialType == LockPatternUtils.CREDENTIAL_TYPE_NONE) {
- credentialType = LockPatternUtils.CREDENTIAL_TYPE_NONE;
- credential = DEFAULT_PASSWORD;
- }
-
+ LockscreenCredential credential, AuthenticationToken authToken, int userId) {
long handle = generateHandle();
- PasswordData pwd = PasswordData.create(credentialType);
+ PasswordData pwd = PasswordData.create(credential.getType());
byte[] pwdToken = computePasswordToken(credential, pwd);
final long sid;
final byte[] applicationId;
@@ -654,7 +654,7 @@
if (isWeaverAvailable()) {
// Weaver based user password
int weaverSlot = getNextAvailableWeaverSlot();
- Log.i(TAG, "Weaver enroll password to slot " + weaverSlot + " for user " + userId);
+ Slog.i(TAG, "Weaver enroll password to slot " + weaverSlot + " for user " + userId);
byte[] weaverSecret = weaverEnroll(weaverSlot, passwordTokenToWeaverKey(pwdToken),
null);
if (weaverSecret == null) {
@@ -663,7 +663,8 @@
}
saveWeaverSlot(weaverSlot, handle, userId);
mPasswordSlotManager.markSlotInUse(weaverSlot);
- synchronizeWeaverFrpPassword(pwd, requestedQuality, userId, weaverSlot);
+ // No need to pass in quality since the credential type already encodes sufficient info
+ synchronizeWeaverFrpPassword(pwd, 0, userId, weaverSlot);
pwd.passwordHandle = null;
sid = GateKeeper.INVALID_SECURE_USER_ID;
@@ -674,7 +675,7 @@
try {
gatekeeper.clearSecureUserId(fakeUid(userId));
} catch (RemoteException ignore) {
- Log.w(TAG, "Failed to clear SID from gatekeeper");
+ Slog.w(TAG, "Failed to clear SID from gatekeeper");
}
// GateKeeper based user password
GateKeeperResponse response;
@@ -692,7 +693,8 @@
sid = sidFromPasswordHandle(pwd.passwordHandle);
applicationId = transformUnderSecdiscardable(pwdToken,
createSecdiscardable(handle, userId));
- synchronizeFrpPassword(pwd, requestedQuality, userId);
+ // No need to pass in quality since the credential type already encodes sufficient info
+ synchronizeFrpPassword(pwd, 0, userId);
}
saveState(PASSWORD_DATA_NAME, pwd.toBytes(), handle, userId);
@@ -702,7 +704,7 @@
}
public VerifyCredentialResponse verifyFrpCredential(IGateKeeperService gatekeeper,
- byte[] userCredential, int credentialType,
+ LockscreenCredential userCredential,
ICheckCredentialProgressCallback progressCallback) {
PersistentData persistentData = mStorage.readPersistentDataBlock();
if (persistentData.type == PersistentData.TYPE_SP) {
@@ -714,7 +716,7 @@
response = gatekeeper.verifyChallenge(fakeUid(persistentData.userId),
0 /* challenge */, pwd.passwordHandle, passwordTokenToGkInput(pwdToken));
} catch (RemoteException e) {
- Log.e(TAG, "FRP verifyChallenge failed", e);
+ Slog.e(TAG, "FRP verifyChallenge failed", e);
return VerifyCredentialResponse.ERROR;
}
return VerifyCredentialResponse.fromGateKeeperResponse(response);
@@ -725,7 +727,7 @@
return weaverVerify(weaverSlot, passwordTokenToWeaverKey(pwdToken)).stripPayload();
} else {
- Log.e(TAG, "persistentData.type must be TYPE_SP or TYPE_SP_WEAVER, but is "
+ Slog.e(TAG, "persistentData.type must be TYPE_SP or TYPE_SP_WEAVER, but is "
+ persistentData.type);
return VerifyCredentialResponse.ERROR;
}
@@ -733,11 +735,11 @@
public void migrateFrpPasswordLocked(long handle, UserInfo userInfo, int requestedQuality) {
- if (mStorage.getPersistentDataBlock() != null
+ if (mStorage.getPersistentDataBlockManager() != null
&& LockPatternUtils.userOwnsFrpCredential(mContext, userInfo)) {
PasswordData pwd = PasswordData.fromBytes(loadState(PASSWORD_DATA_NAME, handle,
userInfo.id));
- if (pwd.passwordType != LockPatternUtils.CREDENTIAL_TYPE_NONE) {
+ if (pwd.credentialType != LockPatternUtils.CREDENTIAL_TYPE_NONE) {
int weaverSlot = loadWeaverSlot(handle, userInfo.id);
if (weaverSlot != INVALID_WEAVER_SLOT) {
synchronizeWeaverFrpPassword(pwd, requestedQuality, userInfo.id, weaverSlot);
@@ -750,10 +752,10 @@
private void synchronizeFrpPassword(PasswordData pwd,
int requestedQuality, int userId) {
- if (mStorage.getPersistentDataBlock() != null
+ if (mStorage.getPersistentDataBlockManager() != null
&& LockPatternUtils.userOwnsFrpCredential(mContext,
mUserManager.getUserInfo(userId))) {
- if (pwd.passwordType != LockPatternUtils.CREDENTIAL_TYPE_NONE) {
+ if (pwd.credentialType != LockPatternUtils.CREDENTIAL_TYPE_NONE) {
mStorage.writePersistentDataBlock(PersistentData.TYPE_SP, userId, requestedQuality,
pwd.toBytes());
} else {
@@ -764,10 +766,10 @@
private void synchronizeWeaverFrpPassword(PasswordData pwd, int requestedQuality, int userId,
int weaverSlot) {
- if (mStorage.getPersistentDataBlock() != null
+ if (mStorage.getPersistentDataBlockManager() != null
&& LockPatternUtils.userOwnsFrpCredential(mContext,
mUserManager.getUserInfo(userId))) {
- if (pwd.passwordType != LockPatternUtils.CREDENTIAL_TYPE_NONE) {
+ if (pwd.credentialType != LockPatternUtils.CREDENTIAL_TYPE_NONE) {
mStorage.writePersistentDataBlock(PersistentData.TYPE_SP_WEAVER, weaverSlot,
requestedQuality, pwd.toBytes());
} else {
@@ -829,14 +831,14 @@
return false;
}
if (!loadEscrowData(authToken, userId)) {
- Log.w(TAG, "User is not escrowable");
+ Slog.w(TAG, "User is not escrowable");
return false;
}
if (isWeaverAvailable()) {
int slot = getNextAvailableWeaverSlot();
- Log.i(TAG, "Weaver enroll token to slot " + slot + " for user " + userId);
+ Slog.i(TAG, "Weaver enroll token to slot " + slot + " for user " + userId);
if (weaverEnroll(slot, null, tokenData.weaverSecret) == null) {
- Log.e(TAG, "Failed to enroll weaver secret when activating token");
+ Slog.e(TAG, "Failed to enroll weaver secret when activating token");
return false;
}
saveWeaverSlot(slot, handle, userId);
@@ -881,18 +883,20 @@
* Decrypt a synthetic password by supplying the user credential and corresponding password
* blob handle generated previously. If the decryption is successful, initiate a GateKeeper
* verification to referesh the SID & Auth token maintained by the system.
- * Note: the credential type is not validated here since there are call sites where the type is
- * unknown. Caller might choose to validate it by examining AuthenticationResult.credentialType
*/
public AuthenticationResult unwrapPasswordBasedSyntheticPassword(IGateKeeperService gatekeeper,
- long handle, byte[] credential, int userId,
+ long handle, @NonNull LockscreenCredential credential, int userId,
ICheckCredentialProgressCallback progressCallback) {
- if (credential == null) {
- credential = DEFAULT_PASSWORD;
- }
AuthenticationResult result = new AuthenticationResult();
PasswordData pwd = PasswordData.fromBytes(loadState(PASSWORD_DATA_NAME, handle, userId));
- result.credentialType = pwd.passwordType;
+
+ if (!credential.checkAgainstStoredType(pwd.credentialType)) {
+ Slog.e(TAG, String.format("Credential type mismatch: expected %d actual %d",
+ pwd.credentialType, credential.getType()));
+ result.gkResponse = VerifyCredentialResponse.ERROR;
+ return result;
+ }
+
byte[] pwdToken = computePasswordToken(credential, pwd);
final byte[] applicationId;
@@ -901,7 +905,7 @@
if (weaverSlot != INVALID_WEAVER_SLOT) {
// Weaver based user password
if (!isWeaverAvailable()) {
- Log.e(TAG, "No weaver service to unwrap password based SP");
+ Slog.e(TAG, "No weaver service to unwrap password based SP");
result.gkResponse = VerifyCredentialResponse.ERROR;
return result;
}
@@ -918,7 +922,7 @@
response = gatekeeper.verifyChallenge(fakeUid(userId), 0L,
pwd.passwordHandle, gkPwdToken);
} catch (RemoteException e) {
- Log.e(TAG, "gatekeeper verify failed", e);
+ Slog.e(TAG, "gatekeeper verify failed", e);
result.gkResponse = VerifyCredentialResponse.ERROR;
return result;
}
@@ -931,21 +935,19 @@
reenrollResponse = gatekeeper.enroll(fakeUid(userId),
pwd.passwordHandle, gkPwdToken, gkPwdToken);
} catch (RemoteException e) {
- Log.w(TAG, "Fail to invoke gatekeeper.enroll", e);
+ Slog.w(TAG, "Fail to invoke gatekeeper.enroll", e);
reenrollResponse = GateKeeperResponse.ERROR;
// continue the flow anyway
}
if (reenrollResponse.getResponseCode() == GateKeeperResponse.RESPONSE_OK) {
pwd.passwordHandle = reenrollResponse.getPayload();
+ // Use the reenrollment opportunity to update credential type
+ // (getting rid of CREDENTIAL_TYPE_PASSWORD_OR_PIN)
+ pwd.credentialType = credential.getType();
saveState(PASSWORD_DATA_NAME, pwd.toBytes(), handle, userId);
- synchronizeFrpPassword(pwd,
- pwd.passwordType == LockPatternUtils.CREDENTIAL_TYPE_PATTERN
- ? DevicePolicyManager.PASSWORD_QUALITY_SOMETHING
- : DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
- /* TODO(roosa): keep the same password quality */,
- userId);
+ synchronizeFrpPassword(pwd, 0, userId);
} else {
- Log.w(TAG, "Fail to re-enroll user password for user " + userId);
+ Slog.w(TAG, "Fail to re-enroll user password for user " + userId);
// continue the flow anyway
}
}
@@ -966,7 +968,7 @@
try {
progressCallback.onCredentialVerified();
} catch (RemoteException e) {
- Log.w(TAG, "progressCallback throws exception", e);
+ Slog.w(TAG, "progressCallback throws exception", e);
}
}
result.authToken = unwrapSyntheticPasswordBlob(handle, SYNTHETIC_PASSWORD_PASSWORD_BASED,
@@ -989,14 +991,14 @@
int slotId = loadWeaverSlot(handle, userId);
if (slotId != INVALID_WEAVER_SLOT) {
if (!isWeaverAvailable()) {
- Log.e(TAG, "No weaver service to unwrap token based SP");
+ Slog.e(TAG, "No weaver service to unwrap token based SP");
result.gkResponse = VerifyCredentialResponse.ERROR;
return result;
}
VerifyCredentialResponse response = weaverVerify(slotId, null);
if (response.getResponseCode() != VerifyCredentialResponse.RESPONSE_OK ||
response.getPayload() == null) {
- Log.e(TAG, "Failed to retrieve weaver secret when unwrapping token");
+ Slog.e(TAG, "Failed to retrieve weaver secret when unwrapping token");
result.gkResponse = VerifyCredentialResponse.ERROR;
return result;
}
@@ -1043,13 +1045,13 @@
Arrays.copyOfRange(blob, 2, blob.length), applicationId);
}
if (secret == null) {
- Log.e(TAG, "Fail to decrypt SP for user " + userId);
+ Slog.e(TAG, "Fail to decrypt SP for user " + userId);
return null;
}
AuthenticationToken result = new AuthenticationToken(version);
if (type == SYNTHETIC_PASSWORD_TOKEN_BASED) {
if (!loadEscrowData(result, userId)) {
- Log.e(TAG, "User is not escrowable: " + userId);
+ Slog.e(TAG, "User is not escrowable: " + userId);
return null;
}
result.recreate(secret);
@@ -1057,7 +1059,7 @@
result.syntheticPassword = new String(secret);
}
if (version == SYNTHETIC_PASSWORD_VERSION_V1) {
- Log.i(TAG, "Upgrade v1 SP blob for user " + userId + ", type = " + type);
+ Slog.i(TAG, "Upgrade v1 SP blob for user " + userId + ", type = " + type);
createSyntheticPasswordBlob(handle, type, result, applicationId, sid, userId);
}
return result;
@@ -1084,7 +1086,7 @@
response = gatekeeper.verifyChallenge(userId, challenge,
spHandle, auth.deriveGkPassword());
} catch (RemoteException e) {
- Log.e(TAG, "Fail to verify with gatekeeper " + userId, e);
+ Slog.e(TAG, "Fail to verify with gatekeeper " + userId, e);
return VerifyCredentialResponse.ERROR;
}
int responseCode = response.getResponseCode();
@@ -1095,7 +1097,7 @@
response = gatekeeper.enroll(userId, spHandle, spHandle,
auth.deriveGkPassword());
} catch (RemoteException e) {
- Log.e(TAG, "Failed to invoke gatekeeper.enroll", e);
+ Slog.e(TAG, "Failed to invoke gatekeeper.enroll", e);
response = GateKeeperResponse.ERROR;
}
if (response.getResponseCode() == GateKeeperResponse.RESPONSE_OK) {
@@ -1105,7 +1107,7 @@
return verifyChallenge(gatekeeper, auth, challenge, userId);
} else {
// Fall through, return result from the previous verification attempt.
- Log.w(TAG, "Fail to re-enroll SP handle for user " + userId);
+ Slog.w(TAG, "Fail to re-enroll SP handle for user " + userId);
}
}
return result;
@@ -1225,7 +1227,8 @@
return String.format("%s%x", LockPatternUtils.SYNTHETIC_PASSWORD_KEY_PREFIX, handle);
}
- private byte[] computePasswordToken(byte[] password, PasswordData data) {
+ private byte[] computePasswordToken(LockscreenCredential credential, PasswordData data) {
+ final byte[] password = credential.isNone() ? DEFAULT_PASSWORD : credential.getCredential();
return scrypt(password, data.salt, 1 << data.scryptN, 1 << data.scryptR, 1 << data.scryptP,
PASSWORD_TOKEN_LENGTH);
}
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java
index 5676da2..29338ba0 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java
@@ -18,7 +18,6 @@
import static android.security.keystore.recovery.KeyChainProtectionParams.TYPE_LOCKSCREEN;
-import android.annotation.Nullable;
import android.content.Context;
import android.os.RemoteException;
import android.security.Scrypt;
@@ -193,6 +192,7 @@
private boolean isCustomLockScreen() {
return mCredentialType != LockPatternUtils.CREDENTIAL_TYPE_NONE
&& mCredentialType != LockPatternUtils.CREDENTIAL_TYPE_PATTERN
+ && mCredentialType != LockPatternUtils.CREDENTIAL_TYPE_PIN
&& mCredentialType != LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
}
@@ -345,7 +345,7 @@
}
KeyChainProtectionParams keyChainProtectionParams = new KeyChainProtectionParams.Builder()
.setUserSecretType(TYPE_LOCKSCREEN)
- .setLockScreenUiFormat(getUiFormat(mCredentialType, mCredential))
+ .setLockScreenUiFormat(getUiFormat(mCredentialType))
.setKeyDerivationParams(keyDerivationParams)
.setSecret(new byte[0])
.build();
@@ -449,11 +449,10 @@
* @return The format - either pattern, pin, or password.
*/
@VisibleForTesting
- @KeyChainProtectionParams.LockScreenUiFormat static int getUiFormat(
- int credentialType, byte[] credential) {
+ @KeyChainProtectionParams.LockScreenUiFormat static int getUiFormat(int credentialType) {
if (credentialType == LockPatternUtils.CREDENTIAL_TYPE_PATTERN) {
return KeyChainProtectionParams.UI_FORMAT_PATTERN;
- } else if (isPin(credential)) {
+ } else if (credentialType == LockPatternUtils.CREDENTIAL_TYPE_PIN) {
return KeyChainProtectionParams.UI_FORMAT_PIN;
} else {
return KeyChainProtectionParams.UI_FORMAT_PASSWORD;
@@ -472,23 +471,6 @@
}
/**
- * Returns {@code true} if {@code credential} looks like a pin.
- */
- @VisibleForTesting
- static boolean isPin(@Nullable byte[] credential) {
- if (credential == null) {
- return false;
- }
- int length = credential.length;
- for (int i = 0; i < length; i++) {
- if (!Character.isDigit((char) credential[i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
* Hashes {@code credentials} with the given {@code salt}.
*
* @return The SHA-256 hash.
@@ -541,6 +523,7 @@
}
private boolean shouldUseScryptToHashCredential() {
- return mCredentialType == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+ return mCredentialType == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD
+ || mCredentialType == LockPatternUtils.CREDENTIAL_TYPE_PIN;
}
}
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/TestOnlyInsecureCertificateHelper.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/TestOnlyInsecureCertificateHelper.java
index 90a36723..c963f79 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/TestOnlyInsecureCertificateHelper.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/TestOnlyInsecureCertificateHelper.java
@@ -97,7 +97,8 @@
if (credential == null) {
return false;
}
- if (credentialType != LockPatternUtils.CREDENTIAL_TYPE_PASSWORD) {
+ if (credentialType != LockPatternUtils.CREDENTIAL_TYPE_PASSWORD
+ && credentialType != LockPatternUtils.CREDENTIAL_TYPE_PIN) {
return false;
}
byte[] insecurePasswordPrefixBytes =
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 09be474..388214b 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -229,6 +229,8 @@
import com.android.server.LocalServices;
import com.android.server.ServiceThread;
import com.android.server.SystemConfig;
+import com.android.server.usage.AppStandbyInternal;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import libcore.io.IoUtils;
@@ -363,7 +365,7 @@
"com.android.server.net.action.SNOOZE_RAPID";
/**
- * Indicates the maximum wait time for admin data to be available;
+ * Indicates the maximum wait time for admin data to be available.
*/
private static final long WAIT_FOR_ADMIN_DATA_TIMEOUT_MS = 10_000;
@@ -396,6 +398,7 @@
private NetworkStatsManagerInternal mNetworkStats;
private final INetworkManagementService mNetworkManager;
private UsageStatsManagerInternal mUsageStats;
+ private AppStandbyInternal mAppStandby;
private final Clock mClock;
private final UserManager mUserManager;
private final CarrierConfigManager mCarrierConfigManager;
@@ -734,6 +737,7 @@
}
mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class);
+ mAppStandby = LocalServices.getService(AppStandbyInternal.class);
mNetworkStats = LocalServices.getService(NetworkStatsManagerInternal.class);
synchronized (mUidRulesFirstLock) {
@@ -868,7 +872,7 @@
mContext.getSystemService(ConnectivityManager.class).registerNetworkCallback(
new NetworkRequest.Builder().build(), mNetworkCallback);
- mUsageStats.addAppIdleStateChangeListener(new AppIdleStateChangeListener());
+ mAppStandby.addListener(new NetPolicyAppIdleStateChangeListener());
// Listen for subscriber changes
mContext.getSystemService(SubscriptionManager.class).addOnSubscriptionsChangedListener(
@@ -4375,9 +4379,7 @@
return newUidRules;
}
- private class AppIdleStateChangeListener
- extends UsageStatsManagerInternal.AppIdleStateChangeListener {
-
+ private class NetPolicyAppIdleStateChangeListener extends AppIdleStateChangeListener {
@Override
public void onAppIdleStateChanged(String packageName, int userId, boolean idle, int bucket,
int reason) {
diff --git a/services/core/java/com/android/server/net/TEST_MAPPING b/services/core/java/com/android/server/net/TEST_MAPPING
new file mode 100644
index 0000000..9f04260
--- /dev/null
+++ b/services/core/java/com/android/server/net/TEST_MAPPING
@@ -0,0 +1,31 @@
+{
+ "presubmit": [
+ {
+ "name": "CtsHostsideNetworkTests",
+ "file_patterns": ["(/|^)NetworkPolicy[^/]*\\.java"],
+ "options": [
+ {
+ "include-filter": "com.android.cts.net.HostsideRestrictBackgroundNetworkTests"
+ },
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ }
+ ]
+ },
+ {
+ "name": "FrameworksServicesTests",
+ "file_patterns": ["(/|^)NetworkPolicy[^/]*\\.java"],
+ "options": [
+ {
+ "include-filter": "com.android.server.net."
+ },
+ {
+ "include-annotation": "android.platform.test.annotations.Presubmit"
+ },
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ }
+ ]
+ }
+ ]
+}
diff --git a/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java b/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java
new file mode 100644
index 0000000..99b1ef4
--- /dev/null
+++ b/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java
@@ -0,0 +1,300 @@
+/*
+ * 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.notification;
+
+import android.app.NotificationHistory;
+import android.app.NotificationHistory.HistoricalNotification;
+import android.os.Handler;
+import android.util.AtomicFile;
+import android.util.Slog;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * Provides an interface to write and query for notification history data for a user from a Protocol
+ * Buffer database.
+ *
+ * Periodically writes the buffered history to disk but can also accept force writes based on
+ * outside changes (like a pending shutdown).
+ */
+public class NotificationHistoryDatabase {
+ private static final int DEFAULT_CURRENT_VERSION = 1;
+
+ private static final String TAG = "NotiHistoryDatabase";
+ private static final boolean DEBUG = NotificationManagerService.DBG;
+ private static final int HISTORY_RETENTION_DAYS = 2;
+ private static final long WRITE_BUFFER_INTERVAL_MS = 1000 * 60 * 20;
+
+ private final Object mLock = new Object();
+ private Handler mFileWriteHandler;
+ @VisibleForTesting
+ // List of files holding history information, sorted newest to oldest
+ final LinkedList<AtomicFile> mHistoryFiles;
+ private final GregorianCalendar mCal;
+ private final File mHistoryDir;
+ private final File mVersionFile;
+ // Current version of the database files schema
+ private int mCurrentVersion;
+ private final WriteBufferRunnable mWriteBufferRunnable;
+
+ // Object containing posted notifications that have not yet been written to disk
+ @VisibleForTesting
+ NotificationHistory mBuffer;
+
+ public NotificationHistoryDatabase(File dir) {
+ mCurrentVersion = DEFAULT_CURRENT_VERSION;
+ mVersionFile = new File(dir, "version");
+ mHistoryDir = new File(dir, "history");
+ mHistoryFiles = new LinkedList<>();
+ mCal = new GregorianCalendar();
+ mBuffer = new NotificationHistory();
+ mWriteBufferRunnable = new WriteBufferRunnable();
+ }
+
+ public void init(Handler fileWriteHandler) {
+ synchronized (mLock) {
+ mFileWriteHandler = fileWriteHandler;
+
+ try {
+ mHistoryDir.mkdir();
+ mVersionFile.createNewFile();
+ } catch (Exception e) {
+ Slog.e(TAG, "could not create needed files", e);
+ }
+
+ checkVersionAndBuildLocked();
+ indexFilesLocked();
+ prune(HISTORY_RETENTION_DAYS, System.currentTimeMillis());
+ }
+ }
+
+ private void indexFilesLocked() {
+ mHistoryFiles.clear();
+ final File[] files = mHistoryDir.listFiles();
+ if (files == null) {
+ return;
+ }
+
+ // Sort with newest files first
+ Arrays.sort(files, (lhs, rhs) -> Long.compare(rhs.lastModified(), lhs.lastModified()));
+
+ for (File file : files) {
+ mHistoryFiles.addLast(new AtomicFile(file));
+ }
+ }
+
+ private void checkVersionAndBuildLocked() {
+ int version;
+ try (BufferedReader reader = new BufferedReader(new FileReader(mVersionFile))) {
+ version = Integer.parseInt(reader.readLine());
+ } catch (NumberFormatException | IOException e) {
+ version = 0;
+ }
+
+ if (version != mCurrentVersion && mVersionFile.exists()) {
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(mVersionFile))) {
+ writer.write(Integer.toString(mCurrentVersion));
+ writer.write("\n");
+ writer.flush();
+ } catch (IOException e) {
+ Slog.e(TAG, "Failed to write new version");
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ void forceWriteToDisk() {
+ if (!mFileWriteHandler.hasCallbacks(mWriteBufferRunnable)) {
+ mFileWriteHandler.post(mWriteBufferRunnable);
+ }
+ }
+
+ void onPackageRemoved(String packageName) {
+ RemovePackageRunnable rpr = new RemovePackageRunnable(packageName);
+ mFileWriteHandler.post(rpr);
+ }
+
+ public void addNotification(final HistoricalNotification notification) {
+ synchronized (mLock) {
+ mBuffer.addNotificationToWrite(notification);
+ // Each time we have new history to write to disk, schedule a write in [interval] ms
+ if (mBuffer.getHistoryCount() == 1) {
+ mFileWriteHandler.postDelayed(mWriteBufferRunnable, WRITE_BUFFER_INTERVAL_MS);
+ }
+ }
+ }
+
+ public NotificationHistory readNotificationHistory() {
+ synchronized (mLock) {
+ NotificationHistory notifications = new NotificationHistory();
+
+ for (AtomicFile file : mHistoryFiles) {
+ try {
+ readLocked(
+ file, notifications, new NotificationHistoryFilter.Builder().build());
+ } catch (Exception e) {
+ Slog.e(TAG, "error reading " + file.getBaseFile().getName(), e);
+ }
+ }
+
+ return notifications;
+ }
+ }
+
+ public NotificationHistory readNotificationHistory(String packageName, String channelId,
+ int maxNotifications) {
+ synchronized (mLock) {
+ NotificationHistory notifications = new NotificationHistory();
+
+ for (AtomicFile file : mHistoryFiles) {
+ try {
+ readLocked(file, notifications,
+ new NotificationHistoryFilter.Builder()
+ .setPackage(packageName)
+ .setChannel(packageName, channelId)
+ .setMaxNotifications(maxNotifications)
+ .build());
+ if (maxNotifications == notifications.getHistoryCount()) {
+ // No need to read any more files
+ break;
+ }
+ } catch (Exception e) {
+ Slog.e(TAG, "error reading " + file.getBaseFile().getName(), e);
+ }
+ }
+
+ return notifications;
+ }
+ }
+
+ /**
+ * Remove any files that are too old.
+ */
+ public void prune(final int retentionDays, final long currentTimeMillis) {
+ synchronized (mLock) {
+ mCal.setTimeInMillis(currentTimeMillis);
+ mCal.add(Calendar.DATE, -1 * retentionDays);
+
+ while (!mHistoryFiles.isEmpty()) {
+ final AtomicFile currentOldestFile = mHistoryFiles.getLast();
+ final long age = currentTimeMillis
+ - currentOldestFile.getBaseFile().lastModified();
+ if (age > mCal.getTimeInMillis()) {
+ if (DEBUG) {
+ Slog.d(TAG, "Removed " + currentOldestFile.getBaseFile().getName());
+ }
+ currentOldestFile.delete();
+ mHistoryFiles.removeLast();
+ } else {
+ // all remaining files are newer than the cut off
+ return;
+ }
+ }
+ }
+ }
+
+ private void writeLocked(AtomicFile file, NotificationHistory notifications)
+ throws IOException {
+ FileOutputStream fos = file.startWrite();
+ try {
+ NotificationHistoryProtoHelper.write(fos, notifications, mCurrentVersion);
+ file.finishWrite(fos);
+ fos = null;
+ } finally {
+ // When fos is null (successful write), this will no-op
+ file.failWrite(fos);
+ }
+ }
+
+ private static void readLocked(AtomicFile file, NotificationHistory notificationsOut,
+ NotificationHistoryFilter filter) throws IOException {
+ try (FileInputStream in = file.openRead()) {
+ NotificationHistoryProtoHelper.read(in, notificationsOut, filter);
+ } catch (FileNotFoundException e) {
+ Slog.e(TAG, "Cannot file " + file.getBaseFile().getName(), e);
+ throw e;
+ }
+ }
+
+ private final class WriteBufferRunnable implements Runnable {
+ @Override
+ public void run() {
+ if (DEBUG) Slog.d(TAG, "WriteBufferRunnable");
+ synchronized (mLock) {
+ final AtomicFile latestNotificationsFiles = new AtomicFile(
+ new File(mHistoryDir, String.valueOf(System.currentTimeMillis())));
+ try {
+ writeLocked(latestNotificationsFiles, mBuffer);
+ mHistoryFiles.addFirst(latestNotificationsFiles);
+ mBuffer = new NotificationHistory();
+ } catch (IOException e) {
+ Slog.e(TAG, "Failed to write buffer to disk. not flushing buffer", e);
+ }
+ }
+ }
+ }
+
+ private final class RemovePackageRunnable implements Runnable {
+ private String mPkg;
+
+ public RemovePackageRunnable(String pkg) {
+ mPkg = pkg;
+ }
+
+ @Override
+ public void run() {
+ if (DEBUG) Slog.d(TAG, "RemovePackageRunnable");
+ synchronized (mLock) {
+ // Remove packageName entries from pending history
+ mBuffer.removeNotificationsFromWrite(mPkg);
+
+ // Remove packageName entries from files on disk, and rewrite them to disk
+ // Since we sort by modified date, we have to update the files oldest to newest to
+ // maintain the original ordering
+ Iterator<AtomicFile> historyFileItr = mHistoryFiles.descendingIterator();
+ while (historyFileItr.hasNext()) {
+ final AtomicFile af = historyFileItr.next();
+ try {
+ final NotificationHistory notifications = new NotificationHistory();
+ readLocked(af, notifications,
+ new NotificationHistoryFilter.Builder().build());
+ notifications.removeNotificationsFromWrite(mPkg);
+ writeLocked(af, notifications);
+ } catch (Exception e) {
+ Slog.e(TAG, "Cannot clean up file on pkg removal "
+ + af.getBaseFile().getName(), e);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/notification/NotificationHistoryFilter.java b/services/core/java/com/android/server/notification/NotificationHistoryFilter.java
new file mode 100644
index 0000000..c3b2e73
--- /dev/null
+++ b/services/core/java/com/android/server/notification/NotificationHistoryFilter.java
@@ -0,0 +1,125 @@
+/*
+ * 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.notification;
+
+import android.annotation.NonNull;
+import android.app.NotificationHistory;
+import android.app.NotificationHistory.HistoricalNotification;
+import android.text.TextUtils;
+
+import com.android.internal.util.Preconditions;
+
+public final class NotificationHistoryFilter {
+ private String mPackage;
+ private String mChannel;
+ private int mNotificationCount;
+
+ private NotificationHistoryFilter() {}
+
+ public String getPackage() {
+ return mPackage;
+ }
+
+ public String getChannel() {
+ return mChannel;
+ }
+
+ public int getMaxNotifications() {
+ return mNotificationCount;
+ }
+
+ /**
+ * Returns whether any of the filtering conditions are set
+ */
+ public boolean isFiltering() {
+ return getPackage() != null || getChannel() != null
+ || mNotificationCount < Integer.MAX_VALUE;
+ }
+
+ /**
+ * Returns true if this notification passes the package and channel name filter, false
+ * otherwise.
+ */
+ public boolean matchesPackageAndChannelFilter(HistoricalNotification notification) {
+ if (!TextUtils.isEmpty(getPackage())) {
+ if (!getPackage().equals(notification.getPackage())) {
+ return false;
+ } else {
+ if (!TextUtils.isEmpty(getChannel())
+ && !getChannel().equals(notification.getChannelId())) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns true if the NotificationHistory can accept another notification.
+ */
+ public boolean matchesCountFilter(NotificationHistory notifications) {
+ return notifications.getHistoryCount() < mNotificationCount;
+ }
+
+ public static final class Builder {
+ private String mPackage = null;
+ private String mChannel = null;
+ private int mNotificationCount = Integer.MAX_VALUE;
+
+ /**
+ * Constructor
+ */
+ public Builder() {}
+
+ /**
+ * Sets a package name filter
+ */
+ public Builder setPackage(String aPackage) {
+ mPackage = aPackage;
+ return this;
+ }
+
+ /**
+ * Sets a channel name filter. Only valid if there is also a package name filter
+ */
+ public Builder setChannel(String pkg, String channel) {
+ setPackage(pkg);
+ mChannel = channel;
+ return this;
+ }
+
+ /**
+ * Sets the max historical notifications
+ */
+ public Builder setMaxNotifications(int notificationCount) {
+ mNotificationCount = notificationCount;
+ return this;
+ }
+
+ /**
+ * Makes a NotificationHistoryFilter
+ */
+ public NotificationHistoryFilter build() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter();
+ filter.mPackage = mPackage;
+ filter.mChannel = mChannel;
+ filter.mNotificationCount = mNotificationCount;
+ return filter;
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/notification/NotificationHistoryProtoHelper.java b/services/core/java/com/android/server/notification/NotificationHistoryProtoHelper.java
new file mode 100644
index 0000000..2831d37
--- /dev/null
+++ b/services/core/java/com/android/server/notification/NotificationHistoryProtoHelper.java
@@ -0,0 +1,321 @@
+/*
+ * 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.notification;
+
+import android.app.NotificationHistory;
+import android.app.NotificationHistory.HistoricalNotification;
+import android.content.res.Resources;
+import android.graphics.drawable.Icon;
+import android.util.Slog;
+import android.util.proto.ProtoInputStream;
+import android.util.proto.ProtoOutputStream;
+
+import com.android.server.notification.NotificationHistoryProto.Notification;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Notification history reader/writer for Protocol Buffer format
+ */
+final class NotificationHistoryProtoHelper {
+ private static final String TAG = "NotifHistoryProto";
+
+ // Static-only utility class.
+ private NotificationHistoryProtoHelper() {}
+
+ private static List<String> readStringPool(ProtoInputStream proto) throws IOException {
+ final long token = proto.start(NotificationHistoryProto.STRING_POOL);
+ List<String> stringPool;
+ if (proto.nextField(NotificationHistoryProto.StringPool.SIZE)) {
+ stringPool = new ArrayList(proto.readInt(NotificationHistoryProto.StringPool.SIZE));
+ } else {
+ stringPool = new ArrayList();
+ }
+ while (proto.nextField() != ProtoInputStream.NO_MORE_FIELDS) {
+ switch (proto.getFieldNumber()) {
+ case (int) NotificationHistoryProto.StringPool.STRINGS:
+ stringPool.add(proto.readString(NotificationHistoryProto.StringPool.STRINGS));
+ break;
+ }
+ }
+ proto.end(token);
+ return stringPool;
+ }
+
+ private static void writeStringPool(ProtoOutputStream proto,
+ final NotificationHistory notifications) {
+ final long token = proto.start(NotificationHistoryProto.STRING_POOL);
+ final String[] pooledStrings = notifications.getPooledStringsToWrite();
+ proto.write(NotificationHistoryProto.StringPool.SIZE, pooledStrings.length);
+ for (int i = 0; i < pooledStrings.length; i++) {
+ proto.write(NotificationHistoryProto.StringPool.STRINGS, pooledStrings[i]);
+ }
+ proto.end(token);
+ }
+
+ private static void readNotification(ProtoInputStream proto, List<String> stringPool,
+ NotificationHistory notifications, NotificationHistoryFilter filter)
+ throws IOException {
+ final long token = proto.start(NotificationHistoryProto.NOTIFICATION);
+ try {
+ HistoricalNotification notification = readNotification(proto, stringPool);
+ if (filter.matchesPackageAndChannelFilter(notification)
+ && filter.matchesCountFilter(notifications)) {
+ notifications.addNotificationToWrite(notification);
+ }
+ } catch (Exception e) {
+ Slog.e(TAG, "Error reading notification", e);
+ } finally {
+ proto.end(token);
+ }
+ }
+
+ private static HistoricalNotification readNotification(ProtoInputStream parser,
+ List<String> stringPool) throws IOException {
+ final HistoricalNotification.Builder notification = new HistoricalNotification.Builder();
+ String pkg = null;
+ while (true) {
+ switch (parser.nextField()) {
+ case (int) NotificationHistoryProto.Notification.PACKAGE:
+ pkg = parser.readString(Notification.PACKAGE);
+ notification.setPackage(pkg);
+ stringPool.add(pkg);
+ break;
+ case (int) Notification.PACKAGE_INDEX:
+ pkg = stringPool.get(parser.readInt(Notification.PACKAGE_INDEX) - 1);
+ notification.setPackage(pkg);
+ break;
+ case (int) Notification.CHANNEL_NAME:
+ String channelName = parser.readString(Notification.CHANNEL_NAME);
+ notification.setChannelName(channelName);
+ stringPool.add(channelName);
+ break;
+ case (int) Notification.CHANNEL_NAME_INDEX:
+ notification.setChannelName(stringPool.get(parser.readInt(
+ Notification.CHANNEL_NAME_INDEX) - 1));
+ break;
+ case (int) Notification.CHANNEL_ID:
+ String channelId = parser.readString(Notification.CHANNEL_ID);
+ notification.setChannelId(channelId);
+ stringPool.add(channelId);
+ break;
+ case (int) Notification.CHANNEL_ID_INDEX:
+ notification.setChannelId(stringPool.get(parser.readInt(
+ Notification.CHANNEL_ID_INDEX) - 1));
+ break;
+ case (int) Notification.UID:
+ notification.setUid(parser.readInt(Notification.UID));
+ break;
+ case (int) Notification.USER_ID:
+ notification.setUserId(parser.readInt(Notification.USER_ID));
+ break;
+ case (int) Notification.POSTED_TIME_MS:
+ notification.setPostedTimeMs(parser.readLong(Notification.POSTED_TIME_MS));
+ break;
+ case (int) Notification.TITLE:
+ notification.setTitle(parser.readString(Notification.TITLE));
+ break;
+ case (int) Notification.TEXT:
+ notification.setText(parser.readString(Notification.TEXT));
+ break;
+ case (int) Notification.ICON:
+ final long iconToken = parser.start(Notification.ICON);
+ loadIcon(parser, notification, pkg);
+ parser.end(iconToken);
+ break;
+ case ProtoInputStream.NO_MORE_FIELDS:
+ return notification.build();
+ }
+ }
+ }
+
+ private static void loadIcon(ProtoInputStream parser,
+ HistoricalNotification.Builder notification, String pkg) throws IOException {
+ int iconType = Notification.TYPE_UNKNOWN;
+ String imageBitmapFileName = null;
+ int imageResourceId = Resources.ID_NULL;
+ String imageResourceIdPackage = null;
+ byte[] imageByteData = null;
+ int imageByteDataLength = 0;
+ int imageByteDataOffset = 0;
+ String imageUri = null;
+
+ while (true) {
+ switch (parser.nextField()) {
+ case (int) Notification.Icon.IMAGE_TYPE:
+ iconType = parser.readInt(Notification.Icon.IMAGE_TYPE);
+ break;
+ case (int) Notification.Icon.IMAGE_DATA:
+ imageByteData = parser.readBytes(Notification.Icon.IMAGE_DATA);
+ break;
+ case (int) Notification.Icon.IMAGE_DATA_LENGTH:
+ imageByteDataLength = parser.readInt(Notification.Icon.IMAGE_DATA_LENGTH);
+ break;
+ case (int) Notification.Icon.IMAGE_DATA_OFFSET:
+ imageByteDataOffset = parser.readInt(Notification.Icon.IMAGE_DATA_OFFSET);
+ break;
+ case (int) Notification.Icon.IMAGE_BITMAP_FILENAME:
+ imageBitmapFileName = parser.readString(
+ Notification.Icon.IMAGE_BITMAP_FILENAME);
+ break;
+ case (int) Notification.Icon.IMAGE_RESOURCE_ID:
+ imageResourceId = parser.readInt(Notification.Icon.IMAGE_RESOURCE_ID);
+ break;
+ case (int) Notification.Icon.IMAGE_RESOURCE_ID_PACKAGE:
+ imageResourceIdPackage = parser.readString(
+ Notification.Icon.IMAGE_RESOURCE_ID_PACKAGE);
+ break;
+ case (int) Notification.Icon.IMAGE_URI:
+ imageUri = parser.readString(Notification.Icon.IMAGE_URI);
+ break;
+ case ProtoInputStream.NO_MORE_FIELDS:
+ if (iconType == Icon.TYPE_DATA) {
+
+ if (imageByteData != null) {
+ notification.setIcon(Icon.createWithData(
+ imageByteData, imageByteDataOffset, imageByteDataLength));
+ }
+ } else if (iconType == Icon.TYPE_RESOURCE) {
+ if (imageResourceId != Resources.ID_NULL) {
+ notification.setIcon(Icon.createWithResource(
+ imageResourceIdPackage != null
+ ? imageResourceIdPackage
+ : pkg,
+ imageResourceId));
+ }
+ } else if (iconType == Icon.TYPE_URI) {
+ if (imageUri != null) {
+ notification.setIcon(Icon.createWithContentUri(imageUri));
+ }
+ } else if (iconType == Icon.TYPE_BITMAP) {
+ // TODO: read file from disk
+ }
+ return;
+ }
+ }
+ }
+
+ private static void writeIcon(ProtoOutputStream proto, HistoricalNotification notification) {
+ final long token = proto.start(Notification.ICON);
+
+ proto.write(Notification.Icon.IMAGE_TYPE, notification.getIcon().getType());
+ switch (notification.getIcon().getType()) {
+ case Icon.TYPE_DATA:
+ proto.write(Notification.Icon.IMAGE_DATA, notification.getIcon().getDataBytes());
+ proto.write(Notification.Icon.IMAGE_DATA_LENGTH,
+ notification.getIcon().getDataLength());
+ proto.write(Notification.Icon.IMAGE_DATA_OFFSET,
+ notification.getIcon().getDataOffset());
+ break;
+ case Icon.TYPE_RESOURCE:
+ proto.write(Notification.Icon.IMAGE_RESOURCE_ID, notification.getIcon().getResId());
+ if (!notification.getPackage().equals(notification.getIcon().getResPackage())) {
+ proto.write(Notification.Icon.IMAGE_RESOURCE_ID_PACKAGE,
+ notification.getIcon().getResPackage());
+ }
+ break;
+ case Icon.TYPE_URI:
+ proto.write(Notification.Icon.IMAGE_URI, notification.getIcon().getUriString());
+ break;
+ case Icon.TYPE_BITMAP:
+ // TODO: write file to disk
+ break;
+ }
+
+ proto.end(token);
+ }
+
+ private static void writeNotification(ProtoOutputStream proto,
+ final String[] stringPool, final HistoricalNotification notification) {
+ final long token = proto.start(NotificationHistoryProto.NOTIFICATION);
+ final int packageIndex = Arrays.binarySearch(stringPool, notification.getPackage());
+ if (packageIndex >= 0) {
+ proto.write(Notification.PACKAGE_INDEX, packageIndex + 1);
+ } else {
+ // Package not in Stringpool for some reason, write full string instead
+ Slog.w(TAG, "notification package name (" + notification.getPackage()
+ + ") not found in string cache");
+ proto.write(Notification.PACKAGE, notification.getPackage());
+ }
+ final int channelNameIndex = Arrays.binarySearch(stringPool, notification.getChannelName());
+ if (channelNameIndex >= 0) {
+ proto.write(Notification.CHANNEL_NAME_INDEX, channelNameIndex + 1);
+ } else {
+ Slog.w(TAG, "notification channel name (" + notification.getChannelName()
+ + ") not found in string cache");
+ proto.write(Notification.CHANNEL_NAME, notification.getChannelName());
+ }
+ final int channelIdIndex = Arrays.binarySearch(stringPool, notification.getChannelId());
+ if (channelIdIndex >= 0) {
+ proto.write(Notification.CHANNEL_ID_INDEX, channelIdIndex + 1);
+ } else {
+ Slog.w(TAG, "notification channel id (" + notification.getChannelId()
+ + ") not found in string cache");
+ proto.write(Notification.CHANNEL_ID, notification.getChannelId());
+ }
+ proto.write(Notification.UID, notification.getUid());
+ proto.write(Notification.USER_ID, notification.getUserId());
+ proto.write(Notification.POSTED_TIME_MS, notification.getPostedTimeMs());
+ proto.write(Notification.TITLE, notification.getTitle());
+ proto.write(Notification.TEXT, notification.getText());
+ writeIcon(proto, notification);
+ proto.end(token);
+ }
+
+ public static void read(InputStream in, NotificationHistory notifications,
+ NotificationHistoryFilter filter) throws IOException {
+ final ProtoInputStream proto = new ProtoInputStream(in);
+ List<String> stringPool = new ArrayList<>();
+ while (true) {
+ switch (proto.nextField()) {
+ case (int) NotificationHistoryProto.STRING_POOL:
+ stringPool = readStringPool(proto);
+ break;
+ case (int) NotificationHistoryProto.NOTIFICATION:
+ readNotification(proto, stringPool, notifications, filter);
+ break;
+ case ProtoInputStream.NO_MORE_FIELDS:
+ if (filter.isFiltering()) {
+ notifications.poolStringsFromNotifications();
+ } else {
+ notifications.addPooledStrings(stringPool);
+ }
+ return;
+ }
+ }
+ }
+
+ public static void write(OutputStream out, NotificationHistory notifications, int version) {
+ final ProtoOutputStream proto = new ProtoOutputStream(out);
+ proto.write(NotificationHistoryProto.MAJOR_VERSION, version);
+ // String pool should be written before the history itself
+ writeStringPool(proto, notifications);
+
+ List<HistoricalNotification> notificationsToWrite = notifications.getNotificationsToWrite();
+ final int count = notificationsToWrite.size();
+ for (int i = 0; i < count; i++) {
+ writeNotification(proto, notifications.getPooledStringsToWrite(),
+ notificationsToWrite.get(i));
+ }
+
+ proto.flush();
+ }
+}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index cd3343b..0fc1718 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -7826,6 +7826,7 @@
R.array.config_allowedManagedServicesOnLowRamDevices)) {
if (whitelisted.equals(pkg)) {
canUseManagedServices = true;
+ break;
}
}
diff --git a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
index 714bbb9..9a1b30d 100644
--- a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
+++ b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
@@ -25,7 +25,6 @@
import android.os.BugreportParams;
import android.os.IDumpstate;
import android.os.IDumpstateListener;
-import android.os.IDumpstateToken;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
@@ -64,13 +63,6 @@
@Override
@RequiresPermission(android.Manifest.permission.DUMP)
- public IDumpstateToken setListener(String name, IDumpstateListener listener,
- boolean getSectionDetails) {
- throw new UnsupportedOperationException("setListener is not allowed on this service");
- }
-
- @Override
- @RequiresPermission(android.Manifest.permission.DUMP)
public void startBugreport(int callingUidUnused, String callingPackage,
FileDescriptor bugreportFd, FileDescriptor screenshotFd,
int bugreportMode, IDumpstateListener listener) {
diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java
index dc00cb4..12e8069 100644
--- a/services/core/java/com/android/server/pm/ApexManager.java
+++ b/services/core/java/com/android/server/pm/ApexManager.java
@@ -32,12 +32,14 @@
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.PackageParser;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.sysprop.ApexProperties;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.IndentingPrintWriter;
@@ -46,6 +48,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -63,9 +66,9 @@
static final int MATCH_FACTORY_PACKAGE = 1 << 1;
/**
- * Returns an instance of either {@link ApexManagerImpl} or {@link ApexManagerNoOp} depending
- * on whenever this device supports APEX, i.e. {@link ApexProperties#updatable()} evaluates to
- * {@code true}.
+ * Returns an instance of either {@link ApexManagerImpl} or {@link ApexManagerFlattenedApex}
+ * depending on whether this device supports APEX, i.e. {@link ApexProperties#updatable()}
+ * evaluates to {@code true}.
*/
static ApexManager create(Context systemContext) {
if (ApexProperties.updatable().orElse(false)) {
@@ -76,10 +79,28 @@
throw new IllegalStateException("Required service apexservice not available");
}
} else {
- return new ApexManagerNoOp();
+ return new ApexManagerFlattenedApex();
}
}
+ /**
+ * Minimal information about APEX mount points and the original APEX package they refer to.
+ */
+ static class ActiveApexInfo {
+ public final File apexDirectory;
+ public final File preinstalledApexPath;
+
+ private ActiveApexInfo(File apexDirectory, File preinstalledApexPath) {
+ this.apexDirectory = apexDirectory;
+ this.preinstalledApexPath = preinstalledApexPath;
+ }
+ }
+
+ /**
+ * Returns {@link ActiveApexInfo} records relative to all active APEX packages.
+ */
+ abstract List<ActiveApexInfo> getActiveApexInfos();
+
abstract void systemReady();
/**
@@ -217,7 +238,8 @@
* An implementation of {@link ApexManager} that should be used in case device supports updating
* APEX packages.
*/
- private static class ApexManagerImpl extends ApexManager {
+ @VisibleForTesting
+ static class ApexManagerImpl extends ApexManager {
private final IApexService mApexService;
private final Context mContext;
private final Object mLock = new Object();
@@ -257,6 +279,22 @@
}
@Override
+ List<ActiveApexInfo> getActiveApexInfos() {
+ try {
+ return Arrays.stream(mApexService.getActivePackages())
+ .map(apexInfo -> new ActiveApexInfo(
+ new File(
+ Environment.getApexDirectory() + File.separator
+ + apexInfo.moduleName),
+ new File(apexInfo.modulePath))).collect(
+ Collectors.toList());
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Unable to retrieve packages from apexservice", e);
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
void systemReady() {
mContext.registerReceiver(new BroadcastReceiver() {
@Override
@@ -335,8 +373,8 @@
if (!packageInfo.packageName.equals(packageName)) {
continue;
}
- if ((!matchActive || isActive(packageInfo))
- && (!matchFactory || isFactory(packageInfo))) {
+ if ((matchActive && isActive(packageInfo))
+ || (matchFactory && isFactory(packageInfo))) {
return packageInfo;
}
}
@@ -547,7 +585,40 @@
* An implementation of {@link ApexManager} that should be used in case device does not support
* updating APEX packages.
*/
- private static final class ApexManagerNoOp extends ApexManager {
+ private static final class ApexManagerFlattenedApex extends ApexManager {
+
+ @Override
+ List<ActiveApexInfo> getActiveApexInfos() {
+ // There is no apexd running in case of flattened apex
+ // We look up the /apex directory and identify the active APEX modules from there.
+ // As "preinstalled" path, we just report /system since in the case of flattened APEX
+ // the /apex directory is just a symlink to /system/apex.
+ List<ActiveApexInfo> result = new ArrayList<>();
+ File apexDir = Environment.getApexDirectory();
+ // In flattened configuration, init special-case the art directory and bind-mounts
+ // com.android.art.{release|debug} to com.android.art. At the time of writing, these
+ // directories are copied from the kArtApexDirNames variable in
+ // system/core/init/mount_namespace.cpp.
+ String[] skipDirs = {"com.android.art.release", "com.android.art.debug"};
+ if (apexDir.isDirectory()) {
+ File[] files = apexDir.listFiles();
+ // listFiles might be null if system server doesn't have permission to read
+ // a directory.
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory() && !file.getName().contains("@")) {
+ for (String skipDir : skipDirs) {
+ if (file.getName().equals(skipDir)) {
+ continue;
+ }
+ }
+ result.add(new ActiveApexInfo(file, Environment.getRootDirectory()));
+ }
+ }
+ }
+ }
+ return result;
+ }
@Override
void systemReady() {
diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java
index c8179a7..dc0cd18 100644
--- a/services/core/java/com/android/server/pm/AppsFilter.java
+++ b/services/core/java/com/android/server/pm/AppsFilter.java
@@ -41,7 +41,6 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.FgThread;
-import com.android.server.compat.CompatConfig;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -131,11 +130,11 @@
private static class FeatureConfigImpl implements FeatureConfig {
private static final String FILTERING_ENABLED_NAME = "package_query_filtering_enabled";
+ private final PackageManagerService.Injector mInjector;
private volatile boolean mFeatureEnabled = false;
- private CompatConfig mCompatibility;
private FeatureConfigImpl(PackageManagerService.Injector injector) {
- mCompatibility = injector.getCompatibility();
+ mInjector = injector;
}
@Override
@@ -158,7 +157,7 @@
@Override
public boolean packageIsEnabled(PackageParser.Package pkg) {
- return mCompatibility.isChangeEnabled(
+ return mInjector.getCompatibility().isChangeEnabled(
PackageManager.FILTER_APPLICATION_QUERY, pkg.applicationInfo);
}
}
@@ -263,10 +262,10 @@
* Grants access based on an interaction between a calling and target package, granting
* visibility of the caller from the target.
*
- * @param callingPackage the package initiating the interaction
- * @param targetPackage the package being interacted with and thus gaining visibility of the
- * initiating package.
- * @param userId the user in which this interaction was taking place
+ * @param callingPackage the package initiating the interaction
+ * @param targetPackage the package being interacted with and thus gaining visibility of the
+ * initiating package.
+ * @param userId the user in which this interaction was taking place
*/
public void grantImplicitAccess(
String callingPackage, String targetPackage, int userId) {
diff --git a/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java b/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java
index 1d3d24c..259200b 100644
--- a/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java
+++ b/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java
@@ -67,6 +67,15 @@
codeRoot = Environment.getSystemExtDirectory();
} else if (FileUtils.contains(Environment.getOdmDirectory(), codePath)) {
codeRoot = Environment.getOdmDirectory();
+ } else if (FileUtils.contains(Environment.getApexDirectory(), codePath)) {
+ String fullPath = codePath.getAbsolutePath();
+ String[] parts = fullPath.split(File.separator);
+ if (parts.length > 2) {
+ codeRoot = new File(parts[1] + File.separator + parts[2]);
+ } else {
+ Slog.w(PackageManagerService.TAG, "Can't canonicalize code path " + codePath);
+ codeRoot = Environment.getApexDirectory();
+ }
} else {
// Unrecognized code path; take its top real segment as the apk root:
// e.g. /something/app/blah.apk => /something
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 00c0566..ed2bb3d5 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -259,7 +259,7 @@
// Don't hold mSessions lock when calling restoreSession, since it might trigger an APK
// atomic install which needs to query sessions, which requires lock on mSessions.
for (PackageInstallerSession session : stagedSessionsToRestore) {
- if (mPm.isDeviceUpgrading()) {
+ if (mPm.isDeviceUpgrading() && !session.isStagedAndInTerminalState()) {
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
"Build fingerprint has changed");
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 0a4415b..b36958a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -299,7 +299,7 @@
import com.android.server.SystemConfig;
import com.android.server.SystemServerInitThreadPool;
import com.android.server.Watchdog;
-import com.android.server.compat.CompatConfig;
+import com.android.server.compat.PlatformCompat;
import com.android.server.net.NetworkPolicyManagerInternal;
import com.android.server.pm.Installer.InstallerException;
import com.android.server.pm.Settings.DatabaseVersion;
@@ -370,6 +370,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
+import java.util.stream.Collectors;
/**
* Keep track of all those APKs everywhere.
@@ -762,6 +763,8 @@
new SystemPartition(Environment.getSystemExtDirectory(), SCAN_AS_SYSTEM_EXT,
true /* hasPriv */, true /* hasOverlays */)));
+ private final List<SystemPartition> mDirsToScanAsSystem;
+
/**
* Unit tests will instantiate, extend and/or mock to mock dependencies / behaviors.
*
@@ -834,7 +837,7 @@
private final Singleton<StorageManager> mStorageManagerProducer;
private final Singleton<AppOpsManager> mAppOpsManagerProducer;
private final Singleton<AppsFilter> mAppsFilterProducer;
- private final Singleton<CompatConfig> mPlatformCompatProducer;
+ private final Singleton<PlatformCompat> mPlatformCompatProducer;
Injector(Context context, Object lock, Installer installer,
Object installLock, PackageAbiHelper abiHelper,
@@ -852,7 +855,7 @@
Producer<StorageManager> storageManagerProducer,
Producer<AppOpsManager> appOpsManagerProducer,
Producer<AppsFilter> appsFilterProducer,
- Producer<CompatConfig> platformCompatProducer) {
+ Producer<PlatformCompat> platformCompatProducer) {
mContext = context;
mLock = lock;
mInstaller = installer;
@@ -963,7 +966,7 @@
return mAppsFilterProducer.get(this, mPackageManager);
}
- public CompatConfig getCompatibility() {
+ public PlatformCompat getCompatibility() {
return mPlatformCompatProducer.get(this, mPackageManager);
}
}
@@ -1562,8 +1565,8 @@
}
// Send broadcasts
for (int i = 0; i < size; i++) {
- sendPackageChangedBroadcast(packages[i], true, components[i], uids[i],
- null);
+ sendPackageChangedBroadcast(packages[i], true /* dontKillApp */,
+ components[i], uids[i], null /* reason */);
}
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
break;
@@ -2049,7 +2052,7 @@
for (int i = 0; i < res.libraryConsumers.size(); i++) {
PackageParser.Package pkg = res.libraryConsumers.get(i);
// send broadcast that all consumers of the static shared library have changed
- sendPackageChangedBroadcast(pkg.packageName, false /*killFlag*/,
+ sendPackageChangedBroadcast(pkg.packageName, false /* dontKillApp */,
new ArrayList<>(Collections.singletonList(pkg.packageName)),
pkg.applicationInfo.uid, null);
}
@@ -2353,7 +2356,7 @@
new Injector.SystemServiceProducer<>(StorageManager.class),
new Injector.SystemServiceProducer<>(AppOpsManager.class),
(i, pm) -> AppsFilter.create(i),
- (i, pm) -> CompatConfig.get());
+ (i, pm) -> (PlatformCompat) ServiceManager.getService("platform_compat"));
PackageManagerService m = new PackageManagerService(injector, factoryTest, onlyCore);
t.traceEnd(); // "create package manager"
@@ -2552,6 +2555,16 @@
mApexManager = ApexManager.create(mContext);
mAppsFilter = mInjector.getAppsFilter();
+ mDirsToScanAsSystem = new ArrayList<>();
+ mDirsToScanAsSystem.addAll(SYSTEM_PARTITIONS);
+ mDirsToScanAsSystem.addAll(mApexManager.getActiveApexInfos().stream()
+ .map(ai -> resolveApexToSystemPartition(ai))
+ .filter(Objects::nonNull).collect(Collectors.toList()));
+ Slog.d(TAG,
+ "Directories scanned as system partitions: [" + mDirsToScanAsSystem.stream().map(
+ d -> (d.folder.getAbsolutePath() + ":" + d.scanFlag))
+ .collect(Collectors.joining(",")) + "]");
+
// CHECKSTYLE:OFF IndentationCheck
synchronized (mInstallLock) {
// writer
@@ -2684,8 +2697,8 @@
// reside in the right directory.
final int systemParseFlags = mDefParseFlags | PackageParser.PARSE_IS_SYSTEM_DIR;
final int systemScanFlags = scanFlags | SCAN_AS_SYSTEM;
- for (int i = SYSTEM_PARTITIONS.size() - 1; i >= 0; i--) {
- final SystemPartition partition = SYSTEM_PARTITIONS.get(i);
+ for (int i = mDirsToScanAsSystem.size() - 1; i >= 0; i--) {
+ final SystemPartition partition = mDirsToScanAsSystem.get(i);
if (partition.overlayFolder == null) {
continue;
}
@@ -2699,8 +2712,8 @@
throw new IllegalStateException(
"Failed to load frameworks package; check log for warnings");
}
- for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
- final SystemPartition partition = SYSTEM_PARTITIONS.get(i);
+ for (int i = 0, size = mDirsToScanAsSystem.size(); i < size; i++) {
+ final SystemPartition partition = mDirsToScanAsSystem.get(i);
if (partition.privAppFolder != null) {
scanDirTracedLI(partition.privAppFolder, systemParseFlags,
systemScanFlags | SCAN_AS_PRIVILEGED | partition.scanFlag, 0);
@@ -2878,8 +2891,8 @@
@ParseFlags int reparseFlags = 0;
@ScanFlags int rescanFlags = 0;
- for (int i1 = 0, size = SYSTEM_PARTITIONS.size(); i1 < size; i1++) {
- SystemPartition partition = SYSTEM_PARTITIONS.get(i1);
+ for (int i1 = 0, size = mDirsToScanAsSystem.size(); i1 < size; i1++) {
+ SystemPartition partition = mDirsToScanAsSystem.get(i1);
if (partition.containsPrivApp(scanFile)) {
reparseFlags = systemParseFlags;
rescanFlags = systemScanFlags | SCAN_AS_PRIVILEGED
@@ -4092,7 +4105,7 @@
}
return generatePackageInfo(ps, flags, userId);
}
- if (!matchFactoryOnly && (flags & MATCH_APEX) != 0) {
+ if ((flags & MATCH_APEX) != 0) {
return mApexManager.getPackageInfo(packageName, ApexManager.MATCH_ACTIVE_PACKAGE);
}
}
@@ -17778,6 +17791,7 @@
}
static boolean locationIsPrivileged(String path) {
+ // TODO(dariofreni): include APEX partitions when they will support priv apps.
for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
SystemPartition partition = SYSTEM_PARTITIONS.get(i);
if (partition.containsPrivPath(path)) {
@@ -17787,6 +17801,18 @@
return false;
}
+ private static @Nullable SystemPartition resolveApexToSystemPartition(
+ ApexManager.ActiveApexInfo apexInfo) {
+ for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
+ SystemPartition sp = SYSTEM_PARTITIONS.get(i);
+ if (apexInfo.preinstalledApexPath.getAbsolutePath().startsWith(
+ sp.folder.getAbsolutePath())) {
+ return new SystemPartition(apexInfo.apexDirectory, sp.scanFlag,
+ false /* hasPriv */, false /* hasOverlays */);
+ }
+ }
+ return null;
+ }
/*
* Tries to delete system package.
@@ -17897,8 +17923,8 @@
| PackageParser.PARSE_MUST_BE_APK
| PackageParser.PARSE_IS_SYSTEM_DIR;
@ScanFlags int scanFlags = SCAN_AS_SYSTEM;
- for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
- SystemPartition partition = SYSTEM_PARTITIONS.get(i);
+ for (int i = 0, size = mDirsToScanAsSystem.size(); i < size; i++) {
+ SystemPartition partition = mDirsToScanAsSystem.get(i);
if (partition.containsPath(codePathString)) {
scanFlags |= partition.scanFlag;
if (partition.containsPrivPath(codePathString)) {
@@ -19999,7 +20025,7 @@
}
private void sendPackageChangedBroadcast(String packageName,
- boolean killFlag, ArrayList<String> componentNames, int packageUid,
+ boolean dontKillApp, ArrayList<String> componentNames, int packageUid,
String reason) {
if (DEBUG_INSTALL)
Log.v(TAG, "Sending package changed: package=" + packageName + " components="
@@ -20009,7 +20035,7 @@
String nameList[] = new String[componentNames.size()];
componentNames.toArray(nameList);
extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST, nameList);
- extras.putBoolean(Intent.EXTRA_DONT_KILL_APP, killFlag);
+ extras.putBoolean(Intent.EXTRA_DONT_KILL_APP, dontKillApp);
extras.putInt(Intent.EXTRA_UID, packageUid);
if (reason != null) {
extras.putString(Intent.EXTRA_REASON, reason);
@@ -20282,7 +20308,7 @@
return;
}
sendPackageChangedBroadcast(pkg.packageName,
- false /* killFlag */,
+ true /* dontKillApp */,
new ArrayList<>(Collections.singletonList(pkg.packageName)),
pkg.applicationInfo.uid,
Intent.ACTION_OVERLAY_CHANGED);
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index cfc5ca0..a2aeaf1 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -871,7 +871,7 @@
"target should only be specified when we are disabling quiet mode.");
}
- ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), target != null);
+ ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), userId, target != null);
final long identity = Binder.clearCallingIdentity();
try {
boolean result = false;
@@ -903,13 +903,15 @@
* <li>Has system UID or root UID</li>
* <li>Has {@link Manifest.permission#MODIFY_QUIET_MODE}</li>
* <li>Has {@link Manifest.permission#MANAGE_USERS}</li>
+ * <li>Is the foreground default launcher app</li>
* </ul>
* <p>
- * If caller wants to start an intent after disabling the quiet mode, it must has
+ * If caller wants to start an intent after disabling the quiet mode, or if it is targeting a
+ * user in a different profile group from the caller, it must have
* {@link Manifest.permission#MANAGE_USERS}.
*/
private void ensureCanModifyQuietMode(String callingPackage, int callingUid,
- boolean startIntent) {
+ @UserIdInt int targetUserId, boolean startIntent) {
if (hasManageUsersPermission()) {
return;
}
@@ -917,6 +919,10 @@
throw new SecurityException("MANAGE_USERS permission is required to start intent "
+ "after disabling quiet mode.");
}
+ if (!isSameProfileGroupNoChecks(UserHandle.getUserId(callingUid), targetUserId)) {
+ throw new SecurityException("MANAGE_USERS permission is required to modify quiet mode "
+ + "for a different profile group.");
+ }
final boolean hasModifyQuietModePermission = hasPermissionGranted(
Manifest.permission.MODIFY_QUIET_MODE, callingUid);
if (hasModifyQuietModePermission) {
@@ -2986,8 +2992,8 @@
// Must start user (which will be stopped right away, through
// UserController.finishUserUnlockedCompleted) so services can properly
// intialize it.
- // TODO(b/140750212): in the long-term, we should add a onCreateUser() callback
- // on SystemService instead.
+ // TODO(b/143092698): in the long-term, it might be better to add a onCreateUser()
+ // callback on SystemService instead.
Slog.i(LOG_TAG, "starting pre-created user " + userInfo.toFullString());
final IActivityManager am = ActivityManager.getService();
try {
@@ -3003,7 +3009,7 @@
Binder.restoreCallingIdentity(ident);
}
- // TODO(b/140750212): it's possible to reach "max users overflow" when the user is created
+ // TODO(b/143092698): it's possible to reach "max users overflow" when the user is created
// "from scratch" (i.e., not from a pre-created user) and reaches the maximum number of
// users without counting the pre-created one. Then when the pre-created is converted, the
// "effective" number of max users is exceeds. Example:
@@ -3048,7 +3054,7 @@
* <p>Should be used only during user creation, so the pre-created user can be used (instead of
* creating and initializing a new user from scratch).
*/
- // TODO(b/140750212): add unit test
+ // TODO(b/143092698): add unit test
@GuardedBy("mUsersLock")
private @Nullable UserData getPreCreatedUserLU(@UserInfoFlag int flags) {
if (DBG) {
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index 9e88d0c..bb3388c 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -53,7 +53,6 @@
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
-import android.app.AppOpsManager;
import android.app.ApplicationPackageManager;
import android.app.IActivityManager;
import android.content.Context;
@@ -1542,7 +1541,6 @@
}
};
- final AppOpsManager appOpsManager = mContext.getSystemService(AppOpsManager.class);
for (int i = 0; i < permissionCount; i++) {
final String permName = pkg.requestedPermissions.get(i);
final BasePermission bp;
@@ -1608,16 +1606,9 @@
// If this permission was granted by default, make sure it is.
if ((oldFlags & FLAG_PERMISSION_GRANTED_BY_DEFAULT) != 0) {
+ // PermissionPolicyService will handle the app op for runtime permissions later.
grantRuntimePermissionInternal(permName, packageName, false,
Process.SYSTEM_UID, userId, delayingPermCallback);
- // Allow app op later as we are holding mPackages
- // PermissionPolicyService will handle the app op for foreground/background
- // permissions.
- String appOp = AppOpsManager.permissionToOp(permName);
- if (appOp != null) {
- mHandler.post(() -> appOpsManager.setUidMode(appOp, uid,
- AppOpsManager.MODE_ALLOWED));
- }
// If permission review is enabled the permissions for a legacy apps
// are represented as constantly granted runtime ones, so don't revoke.
} else if ((flags & FLAG_PERMISSION_REVIEW_REQUIRED) == 0) {
@@ -4233,8 +4224,8 @@
}
@Override
- public @NonNull ArrayList<PermissionInfo> getAllPermissionWithProtectionLevel(
- @PermissionInfo.Protection int protectionLevel) {
+ public @NonNull ArrayList<PermissionInfo> getAllPermissionWithProtection(
+ @PermissionInfo.Protection int protection) {
ArrayList<PermissionInfo> matchingPermissions = new ArrayList<>();
synchronized (PermissionManagerService.this.mLock) {
@@ -4244,7 +4235,7 @@
BasePermission bp = mSettings.mPermissions.valueAt(i);
if (bp.perm != null && bp.perm.info != null
- && bp.protectionLevel == protectionLevel) {
+ && bp.perm.info.getProtection() == protection) {
matchingPermissions.add(bp.perm.info);
}
}
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java
index 04ec5ba..a807a7e 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java
@@ -291,8 +291,8 @@
public abstract @Nullable BasePermission getPermissionTEMP(@NonNull String permName);
/** Get all permission that have a certain protection level */
- public abstract @NonNull ArrayList<PermissionInfo> getAllPermissionWithProtectionLevel(
- @PermissionInfo.Protection int protectionLevel);
+ public abstract @NonNull ArrayList<PermissionInfo> getAllPermissionWithProtection(
+ @PermissionInfo.Protection int protection);
/**
* Returns the delegate used to influence permission checking.
diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java
index b892360..9b9f93f 100644
--- a/services/core/java/com/android/server/policy/PermissionPolicyService.java
+++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java
@@ -48,12 +48,12 @@
import android.permission.PermissionControllerManager;
import android.provider.Telephony;
import android.telecom.TelecomManager;
+import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.LongSparseLongArray;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseBooleanArray;
-import android.util.SparseIntArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IAppOpsCallback;
@@ -67,6 +67,7 @@
import com.android.server.policy.PermissionPolicyInternal.OnInitializedCallback;
import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
/**
@@ -144,7 +145,7 @@
};
final ArrayList<PermissionInfo> dangerousPerms =
- permManagerInternal.getAllPermissionWithProtectionLevel(
+ permManagerInternal.getAllPermissionWithProtection(
PermissionInfo.PROTECTION_DANGEROUS);
try {
@@ -152,7 +153,7 @@
for (int i = 0; i < numDangerousPerms; i++) {
PermissionInfo perm = dangerousPerms.get(i);
- if (perm.isRestricted() || perm.backgroundPermission != null) {
+ if (perm.isRuntime()) {
appOpsService.startWatchingMode(getSwitchOp(perm.name), null, appOpsListener);
}
if (perm.isSoftRestricted()) {
@@ -389,8 +390,7 @@
private final @NonNull PackageManager mPackageManager;
private final @NonNull AppOpsManager mAppOpsManager;
- /** All uid that need to be synchronized */
- private final @NonNull SparseIntArray mAllUids = new SparseIntArray();
+ private final @NonNull ArrayMap<String, PermissionInfo> mRuntimePermissionInfos;
/**
* All ops that need to be flipped to allow.
@@ -428,6 +428,18 @@
mContext = context;
mPackageManager = context.getPackageManager();
mAppOpsManager = context.getSystemService(AppOpsManager.class);
+
+ mRuntimePermissionInfos = new ArrayMap<>();
+ PermissionManagerServiceInternal permissionManagerInternal = LocalServices.getService(
+ PermissionManagerServiceInternal.class);
+ List<PermissionInfo> permissionInfos =
+ permissionManagerInternal.getAllPermissionWithProtection(
+ PermissionInfo.PROTECTION_DANGEROUS);
+ int permissionInfosSize = permissionInfos.size();
+ for (int i = 0; i < permissionInfosSize; i++) {
+ PermissionInfo permissionInfo = permissionInfos.get(i);
+ mRuntimePermissionInfos.put(permissionInfo.name, permissionInfo);
+ }
}
/**
@@ -489,7 +501,7 @@
* Note: Called with the package lock held. Do <u>not</u> call into app-op manager.
*/
private void addAppOps(@NonNull PackageInfo packageInfo, @NonNull String permissionName) {
- PermissionInfo permissionInfo = getPermissionInfo(permissionName);
+ PermissionInfo permissionInfo = mRuntimePermissionInfos.get(permissionName);
if (permissionInfo == null) {
return;
}
@@ -499,8 +511,7 @@
private void addPermissionAppOp(@NonNull PackageInfo packageInfo,
@NonNull PermissionInfo permissionInfo) {
- // TODO: Sync all permissions in the future.
- if (!permissionInfo.isRestricted() && permissionInfo.backgroundPermission == null) {
+ if (!permissionInfo.isRuntime()) {
return;
}
@@ -525,7 +536,7 @@
boolean shouldGrantAppOp = shouldGrantAppOp(packageInfo, permissionInfo);
if (shouldGrantAppOp) {
if (permissionInfo.backgroundPermission != null) {
- PermissionInfo backgroundPermissionInfo = getPermissionInfo(
+ PermissionInfo backgroundPermissionInfo = mRuntimePermissionInfos.get(
permissionInfo.backgroundPermission);
boolean shouldGrantBackgroundAppOp = backgroundPermissionInfo != null
&& shouldGrantAppOp(packageInfo, backgroundPermissionInfo);
@@ -552,15 +563,6 @@
}
}
- @Nullable
- private PermissionInfo getPermissionInfo(@NonNull String permissionName) {
- try {
- return mPackageManager.getPermissionInfo(permissionName, 0);
- } catch (PackageManager.NameNotFoundException e) {
- return null;
- }
- }
-
private boolean shouldGrantAppOp(@NonNull PackageInfo packageInfo,
@NonNull PermissionInfo permissionInfo) {
String permissionName = permissionInfo.name;
@@ -638,8 +640,6 @@
return;
}
- mAllUids.put(pkg.applicationInfo.uid, pkg.applicationInfo.uid);
-
if (pkg.requestedPermissions == null) {
return;
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 2593c38..5e1d93f 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -386,6 +386,7 @@
BurnInProtectionHelper mBurnInProtectionHelper;
private DisplayFoldController mDisplayFoldController;
AppOpsManager mAppOpsManager;
+ PackageManager mPackageManager;
private boolean mHasFeatureAuto;
private boolean mHasFeatureWatch;
private boolean mHasFeatureLeanback;
@@ -1555,10 +1556,9 @@
private void launchAllAppsAction() {
Intent intent = new Intent(Intent.ACTION_ALL_APPS);
if (mHasFeatureLeanback) {
- final PackageManager pm = mContext.getPackageManager();
Intent intentLauncher = new Intent(Intent.ACTION_MAIN);
intentLauncher.addCategory(Intent.CATEGORY_HOME);
- ResolveInfo resolveInfo = pm.resolveActivityAsUser(intentLauncher,
+ ResolveInfo resolveInfo = mPackageManager.resolveActivityAsUser(intentLauncher,
PackageManager.MATCH_SYSTEM_ONLY,
mCurrentUserId);
if (resolveInfo != null) {
@@ -1753,10 +1753,11 @@
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
mAppOpsManager = mContext.getSystemService(AppOpsManager.class);
mDisplayManager = mContext.getSystemService(DisplayManager.class);
- mHasFeatureWatch = mContext.getPackageManager().hasSystemFeature(FEATURE_WATCH);
- mHasFeatureLeanback = mContext.getPackageManager().hasSystemFeature(FEATURE_LEANBACK);
- mHasFeatureAuto = mContext.getPackageManager().hasSystemFeature(FEATURE_AUTOMOTIVE);
- mHasFeatureHdmiCec = mContext.getPackageManager().hasSystemFeature(FEATURE_HDMI_CEC);
+ mPackageManager = mContext.getPackageManager();
+ mHasFeatureWatch = mPackageManager.hasSystemFeature(FEATURE_WATCH);
+ mHasFeatureLeanback = mPackageManager.hasSystemFeature(FEATURE_LEANBACK);
+ mHasFeatureAuto = mPackageManager.hasSystemFeature(FEATURE_AUTOMOTIVE);
+ mHasFeatureHdmiCec = mPackageManager.hasSystemFeature(FEATURE_HDMI_CEC);
mAccessibilityShortcutController =
new AccessibilityShortcutController(mContext, new Handler(), mCurrentUserId);
mLogger = new MetricsLogger();
@@ -1994,7 +1995,7 @@
}
mShortPressOnWindowBehavior = SHORT_PRESS_WINDOW_NOTHING;
- if (mContext.getPackageManager().hasSystemFeature(FEATURE_PICTURE_IN_PICTURE)) {
+ if (mPackageManager.hasSystemFeature(FEATURE_PICTURE_IN_PICTURE)) {
mShortPressOnWindowBehavior = SHORT_PRESS_WINDOW_PICTURE_IN_PICTURE;
}
}
@@ -2138,7 +2139,7 @@
ApplicationInfo appInfo;
try {
- appInfo = mContext.getPackageManager().getApplicationInfoAsUser(
+ appInfo = mPackageManager.getApplicationInfoAsUser(
attrs.packageName,
0 /* flags */,
UserHandle.getUserId(callingUid));
@@ -4914,7 +4915,7 @@
@Override public void run() {
if (mBootMsgDialog == null) {
int theme;
- if (mContext.getPackageManager().hasSystemFeature(FEATURE_LEANBACK)) {
+ if (mPackageManager.hasSystemFeature(FEATURE_LEANBACK)) {
theme = com.android.internal.R.style.Theme_Leanback_Dialog_Alert;
} else {
theme = 0;
@@ -4943,7 +4944,7 @@
return true;
}
};
- if (mContext.getPackageManager().isDeviceUpgrading()) {
+ if (mPackageManager.isDeviceUpgrading()) {
mBootMsgDialog.setTitle(R.string.android_upgrading_title);
} else {
mBootMsgDialog.setTitle(R.string.android_start_title);
@@ -5203,7 +5204,7 @@
}
ActivityInfo ai = null;
- ResolveInfo info = mContext.getPackageManager().resolveActivityAsUser(
+ ResolveInfo info = mPackageManager.resolveActivityAsUser(
intent,
PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA,
mCurrentUserId);
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index edf0cbf..b67d9b2 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -94,16 +94,16 @@
private static final int MSG_PROFILE_TIMED_OUT = 5;
private static final int MSG_WIRED_CHARGING_STARTED = 6;
- private static final long[] WIRELESS_VIBRATION_TIME = {
+ private static final long[] CHARGING_VIBRATION_TIME = {
40, 40, 40, 40, 40, 40, 40, 40, 40, // ramp-up sampling rate = 40ms
40, 40, 40, 40, 40, 40, 40 // ramp-down sampling rate = 40ms
};
- private static final int[] WIRELESS_VIBRATION_AMPLITUDE = {
+ private static final int[] CHARGING_VIBRATION_AMPLITUDE = {
1, 4, 11, 25, 44, 67, 91, 114, 123, // ramp-up amplitude (from 0 to 50%)
103, 79, 55, 34, 17, 7, 2 // ramp-up amplitude
};
- private static final VibrationEffect WIRELESS_CHARGING_VIBRATION_EFFECT =
- VibrationEffect.createWaveform(WIRELESS_VIBRATION_TIME, WIRELESS_VIBRATION_AMPLITUDE,
+ private static final VibrationEffect CHARGING_VIBRATION_EFFECT =
+ VibrationEffect.createWaveform(CHARGING_VIBRATION_TIME, CHARGING_VIBRATION_AMPLITUDE,
-1);
private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
@@ -130,6 +130,10 @@
// True if the device should suspend when the screen is off due to proximity.
private final boolean mSuspendWhenScreenOffDueToProximityConfig;
+ // True if the device should show the wireless charging animation when the device
+ // begins charging wirelessly
+ private final boolean mShowWirelessChargingAnimationConfig;
+
// The current interactive state. This is set as soon as an interactive state
// transition begins so as to capture the reason that it happened. At some point
// this state will propagate to the pending state then eventually to the
@@ -182,6 +186,8 @@
mSuspendWhenScreenOffDueToProximityConfig = context.getResources().getBoolean(
com.android.internal.R.bool.config_suspendWhenScreenOffDueToProximity);
+ mShowWirelessChargingAnimationConfig = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_showBuiltinWirelessChargingAnim);
// Initialize interactive state for battery stats.
try {
@@ -755,35 +761,45 @@
}
};
- /**
- * If enabled, plays a sound and/or vibration when wireless or non-wireless charging has started
- */
- private void playChargingStartedFeedback(@UserIdInt int userId) {
- playChargingStartedVibration(userId);
+ private void playChargingStartedFeedback(@UserIdInt int userId, boolean wireless) {
+ if (!isChargingFeedbackEnabled(userId)) {
+ return;
+ }
+
+ // vibrate
+ final boolean vibrate = Settings.Secure.getIntForUser(mContext.getContentResolver(),
+ Settings.Secure.CHARGING_VIBRATION_ENABLED, 1, userId) != 0;
+ if (vibrate) {
+ mVibrator.vibrate(CHARGING_VIBRATION_EFFECT, VIBRATION_ATTRIBUTES);
+ }
+
+ // play sound
final String soundPath = Settings.Global.getString(mContext.getContentResolver(),
- Settings.Global.CHARGING_STARTED_SOUND);
- if (isChargingFeedbackEnabled(userId) && soundPath != null) {
- final Uri soundUri = Uri.parse("file://" + soundPath);
- if (soundUri != null) {
- final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
- if (sfx != null) {
- sfx.setStreamType(AudioManager.STREAM_SYSTEM);
- sfx.play();
- }
+ wireless ? Settings.Global.WIRELESS_CHARGING_STARTED_SOUND
+ : Settings.Global.CHARGING_STARTED_SOUND);
+ final Uri soundUri = Uri.parse("file://" + soundPath);
+ if (soundUri != null) {
+ final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
+ if (sfx != null) {
+ sfx.setStreamType(AudioManager.STREAM_SYSTEM);
+ sfx.play();
}
}
}
private void showWirelessChargingStarted(int batteryLevel, @UserIdInt int userId) {
- playChargingStartedFeedback(userId);
- if (mStatusBarManagerInternal != null) {
+ // play sounds + haptics
+ playChargingStartedFeedback(userId, true /* wireless */);
+
+ // show animation
+ if (mShowWirelessChargingAnimationConfig && mStatusBarManagerInternal != null) {
mStatusBarManagerInternal.showChargingAnimation(batteryLevel);
}
mSuspendBlocker.release();
}
private void showWiredChargingStarted(@UserIdInt int userId) {
- playChargingStartedFeedback(userId);
+ playChargingStartedFeedback(userId, false /* wireless */);
mSuspendBlocker.release();
}
@@ -791,14 +807,6 @@
mTrustManager.setDeviceLockedForUser(userId, true /*locked*/);
}
- private void playChargingStartedVibration(@UserIdInt int userId) {
- final boolean vibrateEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.CHARGING_VIBRATION_ENABLED, 1, userId) != 0;
- if (vibrateEnabled && isChargingFeedbackEnabled(userId)) {
- mVibrator.vibrate(WIRELESS_CHARGING_VIBRATION_EFFECT, VIBRATION_ATTRIBUTES);
- }
- }
-
private boolean isChargingFeedbackEnabled(@UserIdInt int userId) {
final boolean enabled = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.CHARGING_SOUNDS_ENABLED, 1, userId) != 0;
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index 3c1a6af..489c343 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -655,11 +655,11 @@
}
@Override
- public void onBiometricAuthenticated(boolean authenticated, String failureReason) {
+ public void onBiometricAuthenticated() {
enforceBiometricDialog();
if (mBar != null) {
try {
- mBar.onBiometricAuthenticated(authenticated, failureReason);
+ mBar.onBiometricAuthenticated();
} catch (RemoteException ex) {
}
}
@@ -677,11 +677,11 @@
}
@Override
- public void onBiometricError(int errorCode, String error) {
+ public void onBiometricError(int modality, int error, int vendorCode) {
enforceBiometricDialog();
if (mBar != null) {
try {
- mBar.onBiometricError(errorCode, error);
+ mBar.onBiometricError(modality, error, vendorCode);
} catch (RemoteException ex) {
}
}
diff --git a/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java b/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java
index 5493afd..403d342 100644
--- a/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java
+++ b/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java
@@ -30,6 +30,7 @@
import android.service.textclassifier.ITextClassifierCallback;
import android.service.textclassifier.ITextClassifierService;
import android.service.textclassifier.TextClassifierService;
+import android.service.textclassifier.TextClassifierService.ConnectionState;
import android.util.ArrayMap;
import android.util.Slog;
import android.util.SparseArray;
@@ -130,6 +131,10 @@
}
@Override
+ public void onConnectedStateChanged(@ConnectionState int connected) {
+ }
+
+ @Override
public void onSuggestSelection(
@Nullable TextClassificationSessionId sessionId,
TextSelection.Request request, ITextClassifierCallback callback)
@@ -579,6 +584,11 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
init(ITextClassifierService.Stub.asInterface(service));
+ try {
+ mService.onConnectedStateChanged(TextClassifierService.CONNECTED);
+ } catch (RemoteException e) {
+ Slog.e(LOG_TAG, "error in onConnectedStateChanged");
+ }
}
@Override
diff --git a/services/core/java/com/android/server/timedetector/SimpleTimeDetectorStrategy.java b/services/core/java/com/android/server/timedetector/SimpleTimeDetectorStrategy.java
index 7bdc8a3..9dbbf16 100644
--- a/services/core/java/com/android/server/timedetector/SimpleTimeDetectorStrategy.java
+++ b/services/core/java/com/android/server/timedetector/SimpleTimeDetectorStrategy.java
@@ -19,7 +19,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AlarmManager;
-import android.app.timedetector.TimeSignal;
+import android.app.timedetector.PhoneTimeSuggestion;
import android.content.Intent;
import android.util.Slog;
import android.util.TimestampedValue;
@@ -48,9 +48,8 @@
// @NonNull after initialize()
private Callback mCallback;
- // NITZ state.
- @Nullable private TimestampedValue<Long> mLastNitzTime;
-
+ // Last phone suggestion.
+ @Nullable private PhoneTimeSuggestion mLastPhoneSuggestion;
// Information about the last time signal received: Used when toggling auto-time.
@Nullable private TimestampedValue<Long> mLastSystemClockTime;
@@ -65,46 +64,40 @@
}
@Override
- public void suggestTime(@NonNull TimeSignal timeSignal) {
- if (!TimeSignal.SOURCE_ID_NITZ.equals(timeSignal.getSourceId())) {
- Slog.w(TAG, "Ignoring signal from unsupported source: " + timeSignal);
- return;
- }
-
+ public void suggestPhoneTime(@NonNull PhoneTimeSuggestion timeSuggestion) {
// NITZ logic
- TimestampedValue<Long> newNitzUtcTime = timeSignal.getUtcTime();
- boolean nitzTimeIsValid = validateNewNitzTime(newNitzUtcTime, mLastNitzTime);
- if (!nitzTimeIsValid) {
+ boolean timeSuggestionIsValid =
+ validateNewPhoneSuggestion(timeSuggestion, mLastPhoneSuggestion);
+ if (!timeSuggestionIsValid) {
return;
}
// Always store the last NITZ value received, regardless of whether we go on to use it to
// update the system clock. This is so that we can validate future NITZ signals.
- mLastNitzTime = newNitzUtcTime;
+ mLastPhoneSuggestion = timeSuggestion;
// System clock update logic.
// Historically, Android has sent a telephony broadcast only when setting the time using
// NITZ.
- final boolean sendNetworkBroadcast =
- TimeSignal.SOURCE_ID_NITZ.equals(timeSignal.getSourceId());
+ final boolean sendNetworkBroadcast = true;
- final TimestampedValue<Long> newUtcTime = newNitzUtcTime;
+ final TimestampedValue<Long> newUtcTime = timeSuggestion.getUtcTime();
setSystemClockIfRequired(newUtcTime, sendNetworkBroadcast);
}
- private static boolean validateNewNitzTime(TimestampedValue<Long> newNitzUtcTime,
- TimestampedValue<Long> lastNitzTime) {
+ private static boolean validateNewPhoneSuggestion(@NonNull PhoneTimeSuggestion newSuggestion,
+ @Nullable PhoneTimeSuggestion lastSuggestion) {
- if (lastNitzTime != null) {
- long referenceTimeDifference =
- TimestampedValue.referenceTimeDifference(newNitzUtcTime, lastNitzTime);
+ if (lastSuggestion != null) {
+ long referenceTimeDifference = TimestampedValue.referenceTimeDifference(
+ newSuggestion.getUtcTime(), lastSuggestion.getUtcTime());
if (referenceTimeDifference < 0 || referenceTimeDifference > Integer.MAX_VALUE) {
// Out of order or bogus.
Slog.w(TAG, "validateNewNitzTime: Bad NITZ signal received."
+ " referenceTimeDifference=" + referenceTimeDifference
- + " lastNitzTime=" + lastNitzTime
- + " newNitzUtcTime=" + newNitzUtcTime);
+ + " lastSuggestion=" + lastSuggestion
+ + " newSuggestion=" + newSuggestion);
return false;
}
}
@@ -182,7 +175,7 @@
@Override
public void dump(@NonNull PrintWriter pw, @Nullable String[] args) {
- pw.println("mLastNitzTime=" + mLastNitzTime);
+ pw.println("mLastPhoneSuggestion=" + mLastPhoneSuggestion);
pw.println("mLastSystemClockTimeSet=" + mLastSystemClockTimeSet);
pw.println("mLastSystemClockTime=" + mLastSystemClockTime);
pw.println("mLastSystemClockTimeSendNetworkBroadcast="
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorService.java b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
index 9c83000..ee42279 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorService.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
@@ -19,7 +19,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.timedetector.ITimeDetectorService;
-import android.app.timedetector.TimeSignal;
+import android.app.timedetector.PhoneTimeSuggestion;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
@@ -96,14 +96,14 @@
}
@Override
- public void suggestTime(@NonNull TimeSignal timeSignal) {
+ public void suggestPhoneTime(@NonNull PhoneTimeSuggestion timeSignal) {
enforceSetTimePermission();
Objects.requireNonNull(timeSignal);
long idToken = Binder.clearCallingIdentity();
try {
synchronized (mStrategyLock) {
- mTimeDetectorStrategy.suggestTime(timeSignal);
+ mTimeDetectorStrategy.suggestPhoneTime(timeSignal);
}
} finally {
Binder.restoreCallingIdentity(idToken);
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
index e050865..7c2a945 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
@@ -18,7 +18,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.app.timedetector.TimeSignal;
+import android.app.timedetector.PhoneTimeSuggestion;
import android.content.Intent;
import android.util.TimestampedValue;
@@ -72,7 +72,7 @@
void initialize(@NonNull Callback callback);
/** Process the suggested time. */
- void suggestTime(@NonNull TimeSignal timeSignal);
+ void suggestPhoneTime(@NonNull PhoneTimeSuggestion timeSuggestion);
/** Handle the auto-time setting being toggled on or off. */
void handleAutoTimeDetectionToggle(boolean enabled);
diff --git a/services/core/java/com/android/server/twilight/TwilightService.java b/services/core/java/com/android/server/twilight/TwilightService.java
index e4cb19e..e72ba8d 100644
--- a/services/core/java/com/android/server/twilight/TwilightService.java
+++ b/services/core/java/com/android/server/twilight/TwilightService.java
@@ -17,6 +17,7 @@
package com.android.server.twilight;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.app.AlarmManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -160,8 +161,13 @@
// Request the device's location immediately if a previous location isn't available.
if (mLocationManager.getLastLocation() == null) {
if (mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
- mLocationManager.requestSingleUpdate(
- LocationManager.NETWORK_PROVIDER, this, Looper.getMainLooper());
+ mLocationManager.getCurrentLocation(
+ LocationManager.NETWORK_PROVIDER, null, getContext().getMainExecutor(),
+ this::onLocationChanged);
+ } else if (mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
+ mLocationManager.getCurrentLocation(
+ LocationManager.GPS_PROVIDER, null, getContext().getMainExecutor(),
+ this::onLocationChanged);
}
}
@@ -218,12 +224,7 @@
for (int i = mListeners.size() - 1; i >= 0; --i) {
final TwilightListener listener = mListeners.keyAt(i);
final Handler handler = mListeners.valueAt(i);
- handler.post(new Runnable() {
- @Override
- public void run() {
- listener.onTwilightStateChanged(state);
- }
- });
+ handler.post(() -> listener.onTwilightStateChanged(state));
}
}
}
@@ -243,12 +244,8 @@
}
@Override
- public void onLocationChanged(Location location) {
- // Location providers may erroneously return (0.0, 0.0) when they fail to determine the
- // device's location. These location updates can be safely ignored since the chance of a
- // user actually being at these coordinates is quite low.
- if (location != null
- && !(location.getLongitude() == 0.0 && location.getLatitude() == 0.0)) {
+ public void onLocationChanged(@Nullable Location location) {
+ if (location != null) {
Slog.d(TAG, "onLocationChanged:"
+ " provider=" + location.getProvider()
+ " accuracy=" + location.getAccuracy()
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index b131ab6..5e4f75c 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -116,6 +116,14 @@
return result;
}
+ /**
+ * Sets a callback for observing which windows are touchable for the purposes
+ * of accessibility on specified display.
+ *
+ * @param displayId The logical display id.
+ * @param callback The callback.
+ * @return {@code false} if display id is not valid or an embedded display.
+ */
public boolean setWindowsForAccessibilityCallbackLocked(int displayId,
WindowsForAccessibilityCallback callback) {
if (callback != null) {
@@ -129,7 +137,7 @@
if (display.getType() == Display.TYPE_VIRTUAL && dc.getParentWindow() != null) {
// The window observer of this embedded display had been set from
// window manager after setting its parent window.
- return true;
+ return false;
} else {
throw new IllegalStateException(
"Windows for accessibility callback of display "
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index e6c6b12e..9d41d97 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -187,9 +187,22 @@
private int startingWindowDelayMs = INVALID_DELAY;
private int bindApplicationDelayMs = INVALID_DELAY;
private int reason = APP_TRANSITION_TIMEOUT;
- private boolean loggedWindowsDrawn;
+ // TODO(b/132736359) The number may need to consider the visibility change.
+ private int numUndrawnActivities = 1;
private boolean loggedStartingWindowDrawn;
private boolean launchTraceActive;
+
+ /**
+ * Remembers the latest launched activity to represent the final transition. This also
+ * increments the number of activities that should be drawn, so a consecutive launching
+ * sequence can be coalesced as one event.
+ */
+ void setLatestLaunchedActivity(ActivityRecord r) {
+ if (launchedActivity == r) {
+ return;
+ }
+ launchedActivity = r;
+ }
}
final class WindowingModeTransitionInfoSnapshot {
@@ -400,7 +413,7 @@
// the other attributes.
// Coalesce multiple (trampoline) activities from a single sequence together.
- info.launchedActivity = launchedActivity;
+ info.setLatestLaunchedActivity(launchedActivity);
return;
}
@@ -422,7 +435,7 @@
// A new launch sequence [with the windowingMode] has begun.
// Start tracking it.
final WindowingModeTransitionInfo newInfo = new WindowingModeTransitionInfo();
- newInfo.launchedActivity = launchedActivity;
+ newInfo.setLatestLaunchedActivity(launchedActivity);
newInfo.currentTransitionProcessRunning = processRunning;
newInfo.startResult = resultCode;
mWindowingModeTransitionInfo.put(windowingMode, newInfo);
@@ -448,11 +461,11 @@
if (DEBUG_METRICS) Slog.i(TAG, "notifyWindowsDrawn windowingMode=" + windowingMode);
final WindowingModeTransitionInfo info = mWindowingModeTransitionInfo.get(windowingMode);
- if (info == null || info.loggedWindowsDrawn) {
+ if (info == null || info.numUndrawnActivities == 0) {
return null;
}
info.windowsDrawnDelayMs = calculateDelay(timestampNs);
- info.loggedWindowsDrawn = true;
+ info.numUndrawnActivities--;
final WindowingModeTransitionInfoSnapshot infoSnapshot =
new WindowingModeTransitionInfoSnapshot(info);
if (allWindowsDrawn() && mLoggedTransitionStarting) {
@@ -594,9 +607,10 @@
}
}
- private boolean allWindowsDrawn() {
+ @VisibleForTesting
+ boolean allWindowsDrawn() {
for (int index = mWindowingModeTransitionInfo.size() - 1; index >= 0; index--) {
- if (!mWindowingModeTransitionInfo.valueAt(index).loggedWindowsDrawn) {
+ if (mWindowingModeTransitionInfo.valueAt(index).numUndrawnActivities != 0) {
return false;
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 3853841..ec0900f 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -137,10 +137,8 @@
import static com.android.server.wm.ActivityStack.ActivityState.STARTED;
import static com.android.server.wm.ActivityStack.ActivityState.STOPPED;
import static com.android.server.wm.ActivityStack.ActivityState.STOPPING;
-import static com.android.server.wm.ActivityStack.REMOVE_TASK_MODE_DESTROYING;
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE;
import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS;
-import static com.android.server.wm.ActivityStackSupervisor.REMOVE_FROM_RECENTS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_APP;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CLEANUP;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CONFIGURATION;
@@ -426,8 +424,8 @@
// Last configuration reported to the activity in the client process.
private MergedConfiguration mLastReportedConfiguration;
private int mLastReportedDisplayId;
- private boolean mLastReportedMultiWindowMode;
- private boolean mLastReportedPictureInPictureMode;
+ boolean mLastReportedMultiWindowMode;
+ boolean mLastReportedPictureInPictureMode;
CompatibilityInfo compat;// last used compatibility mode
ActivityRecord resultTo; // who started this entry, so will get our reply
final String resultWho; // additional identifier for use by resultTo.
@@ -490,7 +488,7 @@
long lastLaunchTime; // time of last launch of this activity
ComponentName requestedVrComponent; // the requested component for handling VR mode.
- private boolean inHistory; // are we in the history stack?
+ boolean inHistory; // are we in the history stack?
final ActivityStackSupervisor mStackSupervisor;
final RootActivityContainer mRootActivityContainer;
@@ -530,10 +528,6 @@
// True if we are current in the process of removing this app token from the display
private boolean mRemovingFromDisplay = false;
- // Flag set while reparenting to prevent actions normally triggered by an individual parent
- // change.
- private boolean mReparenting;
-
private RemoteAnimationDefinition mRemoteAnimationDefinition;
private AnimatingActivityRegistry mAnimatingActivityRegistry;
@@ -751,7 +745,7 @@
pw.print(" launchedFromPackage="); pw.print(launchedFromPackage);
pw.print(" userId="); pw.println(mUserId);
pw.print(prefix); pw.print("app="); pw.println(app);
- pw.print(prefix); pw.println(intent.toInsecureStringWithClip());
+ pw.print(prefix); pw.println(intent.toInsecureString());
pw.print(prefix); pw.print("rootOfTask="); pw.print(isRootOfTask());
pw.print(" task="); pw.println(task);
pw.print(prefix); pw.print("taskAffinity="); pw.println(taskAffinity);
@@ -846,7 +840,7 @@
if (intent == null) {
pw.println("null");
} else {
- pw.println(intent.toShortString(false, true, false, true));
+ pw.println(intent.toShortString(false, true, false, false));
}
}
}
@@ -1189,7 +1183,7 @@
}
}
- // TODO: Remove once TaskRecord and Task are unified.
+ // TODO(task-unify): Remove once TaskRecord and Task are unified.
TaskRecord getTaskRecord() {
return task;
}
@@ -1201,16 +1195,8 @@
* {@link ActivityStack}.
* @param task The new parent {@link TaskRecord}.
*/
+ // TODO(task-unify): Can be remove after task level unification. Callers can just use addChild
void setTask(TaskRecord task) {
- setTask(task /* task */, false /* reparenting */);
- }
-
- /**
- * This method should only be called by {@link TaskRecord#removeActivity(ActivityRecord)}.
- * @param task The new parent task.
- * @param reparenting Whether we're in the middle of reparenting.
- */
- void setTask(TaskRecord task, boolean reparenting) {
// Do nothing if the {@link TaskRecord} is the same as the current {@link getTaskRecord}.
if (task != null && task == getTaskRecord()) {
return;
@@ -1222,7 +1208,7 @@
// Inform old stack (if present) of activity removal and new stack (if set) of activity
// addition.
if (oldStack != newStack) {
- if (!reparenting && oldStack != null) {
+ if (oldStack != null) {
oldStack.onActivityRemovedFromStack(this);
}
@@ -1231,39 +1217,18 @@
}
}
+ final TaskRecord oldTask = this.task;
this.task = task;
// This is attaching the activity to the task which we only want to do once.
- // TODO: Need to re-work after unifying the task level since it will already have a parent
- // then. Just need to restructure the re-parent case not to do this. NOTE that the
- // reparenting flag passed in can't be used directly for this as it isn't set in
+ // TODO(task-unify): Need to re-work after unifying the task level since it will already
+ // have a parent then. Just need to restructure the re-parent case not to do this. NOTE that
+ // the reparenting flag passed in can't be used directly for this as it isn't set in
// ActivityRecord#reparent() case that ends up calling this method.
if (task != null && getParent() == null) {
- inHistory = true;
- final Task container = task.getTask();
- if (container != null) {
- onAttachToTask(task.voiceSession != null, container.getDisplayContent(),
- getInputDispatchingTimeoutLocked(this) * 1000000L);
- ProtoLog.v(WM_DEBUG_ADD_REMOVE, "setTask: %s at top.", this);
- container.addChild(this, Integer.MAX_VALUE /* add on top */);
- }
-
- // TODO(b/36505427): Maybe this call should be moved inside
- // updateOverrideConfiguration()
- task.updateOverrideConfigurationFromLaunchBounds();
- // Make sure override configuration is up-to-date before using to create window
- // controller.
- updateOverrideConfiguration();
-
- task.addActivityToTop(this);
-
- // When an activity is started directly into a split-screen fullscreen stack, we need to
- // update the initial multi-window modes so that the callbacks are scheduled correctly
- // when the user leaves that mode.
- mLastReportedMultiWindowMode = inMultiWindowMode();
- mLastReportedPictureInPictureMode = inPinnedWindowingMode();
- } else if (!reparenting) {
- onParentChanged();
+ task.addChild(this);
+ } else {
+ onParentChanged(task, oldTask);
}
}
@@ -1289,24 +1254,46 @@
}
@Override
- void onParentChanged() {
- super.onParentChanged();
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
+ final TaskRecord oldTask = (oldParent != null) ? ((Task) oldParent).mTaskRecord : null;
+ final TaskRecord newTask = (newParent != null) ? ((Task) newParent).mTaskRecord : null;
+ this.task = newTask;
+
+ super.onParentChanged(newParent, oldParent);
final Task task = getTask();
+ if (oldParent == null && newParent != null) {
+ // First time we are adding the activity to the system.
+ // TODO(task-unify): See if mVoiceInteraction variable is really needed after task level
+ // unification.
+ mVoiceInteraction = task.mTaskRecord != null && task.mTaskRecord.voiceSession != null;
+ mInputDispatchingTimeoutNanos = getInputDispatchingTimeoutLocked(this) * 1000000L;
+ onDisplayChanged(task.getDisplayContent());
+ if (task.mTaskRecord != null) {
+ task.mTaskRecord.updateOverrideConfigurationFromLaunchBounds();
+ }
+ // Make sure override configuration is up-to-date before using to create window
+ // controller.
+ updateSizeCompatMode();
+ // When an activity is started directly into a split-screen fullscreen stack, we need to
+ // update the initial multi-window modes so that the callbacks are scheduled correctly
+ // when the user leaves that mode.
+ mLastReportedMultiWindowMode = inMultiWindowMode();
+ mLastReportedPictureInPictureMode = inPinnedWindowingMode();
+ }
+
// When the associated task is {@code null}, the {@link ActivityRecord} can no longer
// access visual elements like the {@link DisplayContent}. We must remove any associations
// such as animations.
- if (!mReparenting) {
- if (task == null) {
- // It is possible we have been marked as a closing app earlier. We must remove ourselves
- // from this list so we do not participate in any future animations.
- if (getDisplayContent() != null) {
- getDisplayContent().mClosingApps.remove(this);
- }
- } else if (mLastParent != null && mLastParent.mStack != null) {
- task.mStack.mExitingActivities.remove(this);
+ if (task == null) {
+ // It is possible we have been marked as a closing app earlier. We must remove ourselves
+ // from this list so we do not participate in any future animations.
+ if (getDisplayContent() != null) {
+ getDisplayContent().mClosingApps.remove(this);
}
+ } else if (mLastParent != null && mLastParent.mStack != null) {
+ task.mStack.mExitingActivities.remove(this);
}
final TaskStack stack = getStack();
@@ -1321,6 +1308,21 @@
mLastParent = task;
updateColorTransform();
+
+ final ActivityStack oldStack = (oldTask != null) ? oldTask.getStack() : null;
+ final ActivityStack newStack = (newTask != null) ? newTask.getStack() : null;
+ // Inform old stack (if present) of activity removal and new stack (if set) of activity
+ // addition.
+ if (oldStack != newStack) {
+ // TODO(task-unify): Might be better to use onChildAdded and onChildRemoved signal for
+ // this once task level is unified.
+ if (oldStack != null) {
+ oldStack.onActivityRemovedFromStack(this);
+ }
+ if (newStack != null) {
+ newStack.onActivityAddedToStack(this);
+ }
+ }
}
private void updateColorTransform() {
@@ -1698,17 +1700,6 @@
return hasProcess() && app.hasThread();
}
- void onAttachToTask(boolean voiceInteraction, DisplayContent dc,
- long inputDispatchingTimeoutNanos) {
- mInputDispatchingTimeoutNanos = inputDispatchingTimeoutNanos;
- mVoiceInteraction = voiceInteraction;
- onDisplayChanged(dc);
-
- // Application tokens start out hidden.
- setHidden(true);
- hiddenRequested = true;
- }
-
boolean addStartingWindow(String pkg, int theme, CompatibilityInfo compatInfo,
CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags,
IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning,
@@ -1968,12 +1959,12 @@
});
}
- void removeWindowContainer() {
+ private void removeAppTokenFromDisplay() {
if (mWmService.mRoot == null) return;
final DisplayContent dc = mWmService.mRoot.getDisplayContent(getDisplayId());
if (dc == null) {
- Slog.w(TAG, "removeWindowContainer: Attempted to remove token: "
+ Slog.w(TAG, "removeAppTokenFromDisplay: Attempted to remove token: "
+ appToken + " from non-existing displayId=" + getDisplayId());
return;
}
@@ -2006,56 +1997,17 @@
+ " r=" + this + " (" + prevTask.getStackId() + ")");
}
- final Task task = newTask.getTask();
- ProtoLog.i(WM_DEBUG_ADD_REMOVE, "reparent: moving app token=%s"
+ ProtoLog.i(WM_DEBUG_ADD_REMOVE, "reparent: moving activity=%s"
+ " to task=%d at %d", this, task.mTaskId, position);
- if (task == null) {
- throw new IllegalArgumentException("reparent: could not find task");
- }
- final Task currentTask = getTask();
- if (task == currentTask) {
- throw new IllegalArgumentException(
- "window token=" + this + " already child of task=" + currentTask);
- }
+ reparent(newTask.getTask(), position);
+ }
- if (currentTask.mStack != task.mStack) {
- throw new IllegalArgumentException(
- "window token=" + this + " current task=" + currentTask
- + " belongs to a different stack than " + task);
- }
-
- ProtoLog.i(WM_DEBUG_ADD_REMOVE, "reParentWindowToken: removing window token=%s"
- + " from task=%s" , this, currentTask);
- final DisplayContent prevDisplayContent = getDisplayContent();
-
- mReparenting = true;
-
- getParent().removeChild(this);
- task.addChild(this, position);
-
- mReparenting = false;
-
- // Relayout display(s).
- final DisplayContent displayContent = task.getDisplayContent();
- displayContent.setLayoutNeeded();
- if (prevDisplayContent != displayContent) {
- onDisplayChanged(displayContent);
- prevDisplayContent.setLayoutNeeded();
- }
- getDisplayContent().layoutAndAssignWindowLayersIfNeeded();
-
- // Reparenting prevents informing the parent stack of activity removal in the case that
- // the new stack has the same parent. we must manually signal here if this is not the case.
- final ActivityStack prevStack = prevTask.getStack();
-
- if (prevStack != newTask.getStack()) {
- prevStack.onActivityRemovedFromStack(this);
- }
- // Remove the activity from the old task and add it to the new task.
- prevTask.removeActivity(this, true /* reparenting */);
-
- newTask.addActivityAtIndex(position, this);
+ // TODO(task-unify): Remove once Task level is unified.
+ void onParentChanged(TaskRecord newParent, TaskRecord oldParent) {
+ onParentChanged(
+ newParent != null ? newParent.mTask : null,
+ oldParent != null ? oldParent.mTask : null);
}
private boolean isHomeIntent(Intent intent) {
@@ -2520,7 +2472,9 @@
}
final ActivityStack stack = getActivityStack();
- final boolean mayAdjustFocus = (isState(RESUMED) || stack.mResumedActivity == null)
+ final boolean mayAdjustTop = (isState(RESUMED) || stack.mResumedActivity == null)
+ && stack.isFocusedStackOnDisplay();
+ final boolean shouldAdjustGlobalFocus = mayAdjustTop
// It must be checked before {@link #makeFinishingLocked} is called, because a stack
// is not visible if it only contains finishing activities.
&& mRootActivityContainer.isTopDisplayFocusedStack(stack);
@@ -2548,9 +2502,21 @@
// We are finishing the top focused activity and its stack has nothing to be focused so
// the next focusable stack should be focused.
- if (mayAdjustFocus
+ if (mayAdjustTop
&& (stack.topRunningActivityLocked() == null || !stack.isFocusable())) {
- stack.adjustFocusToNextFocusableStack("finish-top");
+ if (shouldAdjustGlobalFocus) {
+ // Move the entire hierarchy to top with updating global top resumed activity
+ // and focused application if needed.
+ stack.adjustFocusToNextFocusableStack("finish-top");
+ } else {
+ // Only move the next stack to top in its display.
+ final ActivityDisplay display = stack.getDisplay();
+ final ActivityRecord next = display.topRunningActivity();
+ if (next != null) {
+ display.positionChildAtTop(next.getActivityStack(),
+ false /* includingParents */, "finish-display-top");
+ }
+ }
}
finishActivityResults(resultCode, resultData);
@@ -2680,20 +2646,12 @@
// implied that the current finishing activity should be added into stopping list rather
// than destroy immediately.
final boolean isNextNotYetVisible = next != null && (!next.nowVisible || !next.visible);
- final boolean notGlobalFocusedStack =
- getActivityStack() != mRootActivityContainer.getTopDisplayFocusedStack();
if (isVisible && isNextNotYetVisible) {
// Add this activity to the list of stopping activities. It will be processed and
// destroyed when the next activity reports idle.
addToStopping(false /* scheduleIdle */, false /* idleDelayed */,
"completeFinishing");
setState(STOPPING, "completeFinishing");
- if (notGlobalFocusedStack) {
- // Ensuring visibility and configuration only for non-focused stacks since this
- // method call is relatively expensive and not necessary for focused stacks.
- mRootActivityContainer.ensureVisibilityAndConfig(next, getDisplayId(),
- false /* markFrozenIfConfigChanged */, true /* deferResume */);
- }
} else if (addToFinishingAndWaitForIdle()) {
// We added this activity to the finishing list and something else is becoming resumed.
// The activity will complete finishing when the next activity reports idle. No need to
@@ -2896,6 +2854,8 @@
}
/** Note: call {@link #cleanUp(boolean, boolean)} before this method. */
+ // TODO(task-unify): Look into consolidating this with TaskRecord.removeChild once we unify
+ // task level.
void removeFromHistory(String reason) {
finishActivityResults(Activity.RESULT_CANCELED, null /* resultData */);
makeFinishingLocked();
@@ -2913,41 +2873,7 @@
setState(DESTROYED, "removeFromHistory");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during remove for activity " + this);
app = null;
- removeWindowContainer();
- final TaskRecord task = getTaskRecord();
- final boolean lastActivity = task.removeActivity(this);
- // If we are removing the last activity in the task, not including task overlay activities,
- // then fall through into the block below to remove the entire task itself
- final boolean onlyHasTaskOverlays =
- task.onlyHasTaskOverlayActivities(false /* excludingFinishing */);
-
- if (lastActivity || onlyHasTaskOverlays) {
- if (DEBUG_STATES) {
- Slog.i(TAG, "removeFromHistory: last activity removed from " + this
- + " onlyHasTaskOverlays=" + onlyHasTaskOverlays);
- }
-
- // The following block can be executed multiple times if there is more than one overlay.
- // {@link ActivityStackSupervisor#removeTaskByIdLocked} handles this by reverse lookup
- // of the task by id and exiting early if not found.
- if (onlyHasTaskOverlays) {
- // When destroying a task, tell the supervisor to remove it so that any activity it
- // has can be cleaned up correctly. This is currently the only place where we remove
- // a task with the DESTROYING mode, so instead of passing the onlyHasTaskOverlays
- // state into removeTask(), we just clear the task here before the other residual
- // work.
- // TODO: If the callers to removeTask() changes such that we have multiple places
- // where we are destroying the task, move this back into removeTask()
- mStackSupervisor.removeTaskByIdLocked(task.mTaskId, false /* killProcess */,
- !REMOVE_FROM_RECENTS, reason);
- }
-
- // We must keep the task around until all activities are destroyed. The following
- // statement will only execute once since overlays are also considered activities.
- if (lastActivity) {
- stack.removeTask(task, reason, REMOVE_TASK_MODE_DESTROYING);
- }
- }
+ removeAppTokenFromDisplay();
cleanUpActivityServices();
removeUriPermissionsLocked();
@@ -4519,34 +4445,30 @@
removeStartingWindow();
}
- void notifyUnknownVisibilityLaunched() {
-
+ /**
+ * Suppress transition until the new activity becomes ready, otherwise the keyguard can appear
+ * for a short amount of time before the new process with the new activity had the ability to
+ * set its showWhenLocked flags.
+ */
+ void notifyUnknownVisibilityLaunchedForKeyguardTransition() {
// No display activities never add a window, so there is no point in waiting them for
// relayout.
- if (!noDisplay && getDisplayContent() != null) {
- getDisplayContent().mUnknownAppVisibilityController.notifyLaunched(this);
- }
- }
-
- /**
- * @return true if the input activity should be made visible, ignoring any effect Keyguard
- * might have on the visibility
- *
- * TODO(b/123540470): Combine this method and {@link #shouldBeVisible(boolean)}.
- *
- * @see {@link ActivityStack#checkKeyguardVisibility}
- */
- boolean shouldBeVisibleIgnoringKeyguard(boolean behindFullscreenActivity) {
- if (!okToShowLocked()) {
- return false;
+ if (noDisplay || !mStackSupervisor.getKeyguardController().isKeyguardLocked()) {
+ return;
}
- return !behindFullscreenActivity || mLaunchTaskBehind;
+ mDisplayContent.mUnknownAppVisibilityController.notifyLaunched(this);
}
- boolean shouldBeVisible(boolean behindFullscreenActivity) {
+ /** @return {@code true} if this activity should be made visible. */
+ boolean shouldBeVisible(boolean behindFullscreenActivity, boolean ignoringKeyguard) {
// Check whether activity should be visible without Keyguard influence
- visibleIgnoringKeyguard = shouldBeVisibleIgnoringKeyguard(behindFullscreenActivity);
+ visibleIgnoringKeyguard = (!behindFullscreenActivity || mLaunchTaskBehind)
+ && okToShowLocked();
+
+ if (ignoringKeyguard) {
+ return visibleIgnoringKeyguard;
+ }
final ActivityStack stack = getActivityStack();
if (stack == null) {
@@ -4575,9 +4497,9 @@
return false;
}
- // TODO: Use real value of behindFullscreenActivity calculated using the same logic in
- // ActivityStack#ensureActivitiesVisibleLocked().
- return shouldBeVisible(!stack.shouldBeVisible(null /* starting */));
+ final boolean behindFullscreenActivity = stack.checkBehindFullscreenActivity(
+ this, null /* handleBehindFullscreenActivity */);
+ return shouldBeVisible(behindFullscreenActivity, false /* ignoringKeyguard */);
}
void makeVisibleIfNeeded(ActivityRecord starting, boolean reportToClient) {
@@ -5618,12 +5540,26 @@
}
}
- void removeOrphanedStartingWindow(boolean behindFullscreenActivity) {
- if (mStartingWindowState == STARTING_WINDOW_SHOWN && behindFullscreenActivity) {
+ /**
+ * If any activities below the top running one are in the INITIALIZING state and they have a
+ * starting window displayed then remove that starting window. It is possible that the activity
+ * in this state will never resumed in which case that starting window will be orphaned.
+ * <p>
+ * It should only be called if this activity is behind other fullscreen activity.
+ */
+ void cancelInitializing() {
+ if (mStartingWindowState == STARTING_WINDOW_SHOWN) {
+ // Remove orphaned starting window.
if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY, "Found orphaned starting window " + this);
mStartingWindowState = STARTING_WINDOW_REMOVED;
removeStartingWindow();
}
+ if (isState(INITIALIZING) && !shouldBeVisible(
+ true /* behindFullscreenActivity */, true /* ignoringKeyguard */)) {
+ // Remove the unknown visibility record because an invisible activity shouldn't block
+ // the keyguard transition.
+ mDisplayContent.mUnknownAppVisibilityController.appRemovedOrHidden(this);
+ }
}
void postWindowRemoveStartingWindowCleanup(WindowState win) {
@@ -6488,7 +6424,7 @@
* density or bounds from its parent.
*/
boolean inSizeCompatMode() {
- if (!shouldUseSizeCompatMode()) {
+ if (mCompatDisplayInsets == null || !shouldUseSizeCompatMode()) {
return false;
}
final Configuration resolvedConfig = getResolvedOverrideConfiguration();
@@ -6566,58 +6502,54 @@
}
// TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
- private void updateOverrideConfiguration() {
- final Configuration overrideConfig = mTmpConfig;
- overrideConfig.setTo(getRequestedOverrideConfiguration());
-
- if (shouldUseSizeCompatMode()) {
- if (mCompatDisplayInsets != null) {
- // The override configuration is set only once in size compatibility mode.
- return;
- }
- final Configuration parentConfig = getParent().getConfiguration();
- if (!hasProcess() && !isConfigurationCompatible(parentConfig)) {
- // Don't compute when launching in fullscreen and the fixed orientation is not the
- // current orientation. It is more accurately to compute the override bounds from
- // the updated configuration after the fixed orientation is applied.
- return;
- }
-
- // Ensure the screen related fields are set. It is used to prevent activity relaunch
- // when moving between displays. For screenWidthDp and screenWidthDp, because they
- // are relative to bounds and density, they will be calculated in
- // {@link TaskRecord#computeConfigResourceOverrides} and the result will also be
- // relatively fixed.
- overrideConfig.colorMode = parentConfig.colorMode;
- overrideConfig.densityDpi = parentConfig.densityDpi;
- overrideConfig.screenLayout = parentConfig.screenLayout
- & (Configuration.SCREENLAYOUT_LONG_MASK
- | Configuration.SCREENLAYOUT_SIZE_MASK);
- // The smallest screen width is the short side of screen bounds. Because the bounds
- // and density won't be changed, smallestScreenWidthDp is also fixed.
- overrideConfig.smallestScreenWidthDp = parentConfig.smallestScreenWidthDp;
-
- // The role of CompatDisplayInsets is like the override bounds.
- final ActivityDisplay display = getDisplay();
- if (display != null && display.mDisplayContent != null) {
- mCompatDisplayInsets = new CompatDisplayInsets(display.mDisplayContent);
- }
- } else {
- // We must base this on the parent configuration, because we set our override
- // configuration's appBounds based on the result of this method. If we used our own
- // configuration, it would be influenced by past invocations.
- computeBounds(mTmpBounds, getParent().getWindowConfiguration().getAppBounds());
-
- if (mTmpBounds.equals(getRequestedOverrideBounds())) {
- // The bounds is not changed or the activity is resizable (both the 2 bounds are
- // empty).
- return;
- }
-
- overrideConfig.windowConfiguration.setBounds(mTmpBounds);
+ private void updateSizeCompatMode() {
+ if (mCompatDisplayInsets != null || !shouldUseSizeCompatMode()) {
+ // The override configuration is set only once in size compatibility mode.
+ return;
+ }
+ final Configuration parentConfig = getParent().getConfiguration();
+ if (!hasProcess() && !isConfigurationCompatible(parentConfig)) {
+ // Don't compute when launching in fullscreen and the fixed orientation is not the
+ // current orientation. It is more accurately to compute the override bounds from
+ // the updated configuration after the fixed orientation is applied.
+ return;
}
- onRequestedOverrideConfigurationChanged(overrideConfig);
+ Configuration overrideConfig = getRequestedOverrideConfiguration();
+ final Configuration fullConfig = getConfiguration();
+
+ // Ensure the screen related fields are set. It is used to prevent activity relaunch
+ // when moving between displays. For screenWidthDp and screenWidthDp, because they
+ // are relative to bounds and density, they will be calculated in
+ // {@link TaskRecord#computeConfigResourceOverrides} and the result will also be
+ // relatively fixed.
+ overrideConfig.colorMode = fullConfig.colorMode;
+ overrideConfig.densityDpi = fullConfig.densityDpi;
+ overrideConfig.screenLayout = fullConfig.screenLayout
+ & (Configuration.SCREENLAYOUT_LONG_MASK
+ | Configuration.SCREENLAYOUT_SIZE_MASK);
+ // The smallest screen width is the short side of screen bounds. Because the bounds
+ // and density won't be changed, smallestScreenWidthDp is also fixed.
+ overrideConfig.smallestScreenWidthDp = fullConfig.smallestScreenWidthDp;
+ if (info.isFixedOrientation()) {
+ // lock rotation too. When in size-compat, onConfigurationChanged will watch for and
+ // apply runtime rotation changes.
+ overrideConfig.windowConfiguration.setRotation(
+ fullConfig.windowConfiguration.getRotation());
+ }
+
+ // The role of CompatDisplayInsets is like the override bounds.
+ final ActivityDisplay display = getDisplay();
+ if (display != null) {
+ mCompatDisplayInsets = new CompatDisplayInsets(display.mDisplayContent,
+ getWindowConfiguration().getBounds(),
+ getWindowConfiguration().tasksAreFloating());
+ }
+ }
+
+ private void clearSizeCompatMode() {
+ mCompatDisplayInsets = null;
+ onRequestedOverrideConfigurationChanged(EMPTY);
}
@Override
@@ -6638,13 +6570,17 @@
@Override
void resolveOverrideConfiguration(Configuration newParentConfiguration) {
+ Configuration resolvedConfig = getResolvedOverrideConfiguration();
if (mCompatDisplayInsets != null) {
resolveSizeCompatModeConfiguration(newParentConfiguration);
} else {
super.resolveOverrideConfiguration(newParentConfiguration);
+ applyAspectRatio(resolvedConfig.windowConfiguration.getBounds(),
+ newParentConfiguration.windowConfiguration.getAppBounds(),
+ newParentConfiguration.windowConfiguration.getBounds());
// If the activity has override bounds, the relative configuration (e.g. screen size,
// layout) needs to be resolved according to the bounds.
- if (task != null && !matchParentBounds()) {
+ if (task != null && !resolvedConfig.windowConfiguration.getBounds().isEmpty()) {
task.computeConfigResourceOverrides(getResolvedOverrideConfiguration(),
newParentConfiguration);
}
@@ -6662,82 +6598,71 @@
* inheriting the parent bounds.
*/
private void resolveSizeCompatModeConfiguration(Configuration newParentConfiguration) {
+ super.resolveOverrideConfiguration(newParentConfiguration);
final Configuration resolvedConfig = getResolvedOverrideConfiguration();
final Rect resolvedBounds = resolvedConfig.windowConfiguration.getBounds();
- final int parentRotation = newParentConfiguration.windowConfiguration.getRotation();
- final int parentOrientation = newParentConfiguration.orientation;
- int orientation = getConfiguration().orientation;
- if (orientation != parentOrientation && isConfigurationCompatible(newParentConfiguration)) {
- // The activity is compatible to apply the orientation change or it requests different
- // fixed orientation.
- orientation = parentOrientation;
- } else {
- if (!resolvedBounds.isEmpty()
- // The decor insets may be different according to the rotation.
- && getWindowConfiguration().getRotation() == parentRotation) {
- // Keep the computed resolved override configuration.
- return;
- }
- final int requestedOrientation = getRequestedConfigurationOrientation();
- if (requestedOrientation != ORIENTATION_UNDEFINED) {
- orientation = requestedOrientation;
- }
+ Rect parentBounds = new Rect(newParentConfiguration.windowConfiguration.getBounds());
+
+ int orientation = getRequestedConfigurationOrientation();
+ if (orientation == ORIENTATION_UNDEFINED) {
+ orientation = newParentConfiguration.orientation;
+ }
+ int rotation = resolvedConfig.windowConfiguration.getRotation();
+ if (rotation == ROTATION_UNDEFINED) {
+ rotation = newParentConfiguration.windowConfiguration.getRotation();
}
- super.resolveOverrideConfiguration(newParentConfiguration);
-
- boolean useParentOverrideBounds = false;
- final Rect displayBounds = mTmpBounds;
+ // Use compat insets to lock width and height. We should not use the parent width and height
+ // because apps in compat mode should have a constant width and height. The compat insets
+ // are locked when the app is first launched and are never changed after that, so we can
+ // rely on them to contain the original and unchanging width and height of the app.
+ final Rect compatDisplayBounds = mTmpBounds;
+ mCompatDisplayInsets.getDisplayBoundsByRotation(compatDisplayBounds, rotation);
final Rect containingAppBounds = new Rect();
- if (task.handlesOrientationChangeFromDescendant()) {
- // Prefer to use the orientation which is determined by this activity to calculate
- // bounds because the parent will follow the requested orientation.
- mCompatDisplayInsets.getDisplayBoundsByOrientation(displayBounds, orientation);
- } else {
- // The parent hierarchy doesn't handle the orientation changes. This is usually because
- // the aspect ratio of display is close to square or the display rotation is fixed.
- // In this case, task will compute override bounds to fit the app with respect to the
- // requested orientation. So here we perform similar calculation to have consistent
- // bounds even the original parent hierarchies were changed.
- final int baseOrientation = task.getParent().getConfiguration().orientation;
- mCompatDisplayInsets.getDisplayBoundsByOrientation(displayBounds, baseOrientation);
- task.computeFullscreenBounds(containingAppBounds, this, displayBounds, baseOrientation);
- useParentOverrideBounds = !containingAppBounds.isEmpty();
+ mCompatDisplayInsets.getFrameByOrientation(containingAppBounds, orientation);
+
+ // Center containingAppBounds horizontally and aligned to top of parent. Both
+ // are usually the same unless the app was frozen with an orientation letterbox.
+ int left = compatDisplayBounds.left + compatDisplayBounds.width() / 2
+ - containingAppBounds.width() / 2;
+ resolvedBounds.set(left, compatDisplayBounds.top, left + containingAppBounds.width(),
+ compatDisplayBounds.top + containingAppBounds.height());
+
+ if (rotation != ROTATION_UNDEFINED) {
+ // Ensure the parent and container bounds won't overlap with insets.
+ TaskRecord.intersectWithInsetsIfFits(containingAppBounds, compatDisplayBounds,
+ mCompatDisplayInsets.mNonDecorInsets[rotation]);
+ TaskRecord.intersectWithInsetsIfFits(parentBounds, compatDisplayBounds,
+ mCompatDisplayInsets.mNonDecorInsets[rotation]);
}
- // The offsets will be non-zero if the parent has override bounds.
- final int containingOffsetX = containingAppBounds.left;
- final int containingOffsetY = containingAppBounds.top;
- if (!useParentOverrideBounds) {
- containingAppBounds.set(displayBounds);
- }
- if (parentRotation != ROTATION_UNDEFINED) {
- // Ensure the container bounds won't overlap with the decors.
- TaskRecord.intersectWithInsetsIfFits(containingAppBounds, displayBounds,
- mCompatDisplayInsets.mNonDecorInsets[parentRotation]);
- }
+ applyAspectRatio(resolvedBounds, containingAppBounds, compatDisplayBounds);
- computeBounds(resolvedBounds, containingAppBounds);
- if (resolvedBounds.isEmpty()) {
- // Use the entire available bounds because there is no restriction.
- resolvedBounds.set(useParentOverrideBounds ? containingAppBounds : displayBounds);
- } else {
- // The offsets are included in width and height by {@link #computeBounds}, so we have to
- // restore it.
- resolvedBounds.left += containingOffsetX;
- resolvedBounds.top += containingOffsetY;
- }
+ // Center horizontally in parent and align to top of parent - this is a UX choice
+ left = parentBounds.left + parentBounds.width() / 2 - resolvedBounds.width() / 2;
+ resolvedBounds.set(left, parentBounds.top, left + resolvedBounds.width(),
+ parentBounds.top + resolvedBounds.height());
+
+ // We want to get as much of the app on the screen even if insets cover it. This is because
+ // insets change but an app's bounds are more permanent after launch. After computing insets
+ // and horizontally centering resolvedBounds, the resolvedBounds may end up outside parent
+ // bounds. This is okay only if the resolvedBounds exceed their parent on the bottom and
+ // right, because that is clipped when the final bounds are computed. To reach this state,
+ // we first try and push the app as much inside the parent towards the top and left (the
+ // min). The app may then end up outside the parent by going too far left and top, so we
+ // push it back into the parent by taking the max with parent left and top.
+ Rect fullParentBounds = newParentConfiguration.windowConfiguration.getBounds();
+ resolvedBounds.offsetTo(Math.max(fullParentBounds.left,
+ Math.min(fullParentBounds.right - resolvedBounds.width(), resolvedBounds.left)),
+ Math.max(fullParentBounds.top,
+ Math.min(fullParentBounds.bottom - resolvedBounds.height(),
+ resolvedBounds.top)));
+
+ // Use resolvedBounds to compute other override configurations such as appBounds
task.computeConfigResourceOverrides(resolvedConfig, newParentConfiguration,
mCompatDisplayInsets);
- // The horizontal inset included in width is not needed if the activity cannot fill the
- // parent, because the offset will be applied by {@link ActivityRecord#mSizeCompatBounds}.
- final Rect resolvedAppBounds = resolvedConfig.windowConfiguration.getAppBounds();
- final Rect parentAppBounds = newParentConfiguration.windowConfiguration.getAppBounds();
- if (resolvedBounds.width() < parentAppBounds.width()) {
- resolvedBounds.right -= resolvedAppBounds.left;
- }
// Use parent orientation if it cannot be decided by bounds, so the activity can fit inside
// the parent bounds appropriately.
if (resolvedConfig.screenWidthDp == resolvedConfig.screenHeightDp) {
@@ -6812,6 +6737,33 @@
@Override
public void onConfigurationChanged(Configuration newParentConfig) {
+ if (mCompatDisplayInsets != null) {
+ Configuration overrideConfig = getRequestedOverrideConfiguration();
+ // Adapt to changes in orientation locking. The app is still non-resizable, but
+ // it can change which orientation is fixed. If the fixed orientation changes,
+ // update the rotation used on the "compat" display
+ boolean wasFixedOrient =
+ overrideConfig.windowConfiguration.getRotation() != ROTATION_UNDEFINED;
+ int requestedOrient = getRequestedConfigurationOrientation();
+ if (requestedOrient != ORIENTATION_UNDEFINED
+ && requestedOrient != getConfiguration().orientation
+ // The task orientation depends on the top activity orientation, so it
+ // should match. If it doesn't, just wait until it does.
+ && requestedOrient == getParent().getConfiguration().orientation
+ && (overrideConfig.windowConfiguration.getRotation()
+ != getParent().getWindowConfiguration().getRotation())) {
+ overrideConfig.windowConfiguration.setRotation(
+ getParent().getWindowConfiguration().getRotation());
+ onRequestedOverrideConfigurationChanged(overrideConfig);
+ return;
+ } else if (wasFixedOrient && requestedOrient == ORIENTATION_UNDEFINED
+ && (overrideConfig.windowConfiguration.getRotation()
+ != ROTATION_UNDEFINED)) {
+ overrideConfig.windowConfiguration.setRotation(ROTATION_UNDEFINED);
+ onRequestedOverrideConfigurationChanged(overrideConfig);
+ return;
+ }
+ }
final int prevWinMode = getWindowingMode();
mTmpPrevBounds.set(getBounds());
super.onConfigurationChanged(newParentConfig);
@@ -6836,6 +6788,10 @@
mSizeCompatScale = 1f;
updateSurfacePosition();
}
+ } else if (overrideBounds.isEmpty()) {
+ mSizeCompatBounds = null;
+ mSizeCompatScale = 1f;
+ updateSurfacePosition();
}
adjustPinnedStackAndInitChangeTransitionIfNeeded(prevWinMode, getWindowingMode());
@@ -6854,7 +6810,7 @@
if (visible) {
// It may toggle the UI for user to restart the size compatibility mode activity.
display.handleActivitySizeCompatModeIfNeeded(this);
- } else if (shouldUseSizeCompatMode()) {
+ } else if (mCompatDisplayInsets != null) {
// The override changes can only be obtained from display, because we don't have the
// difference of full configuration in each hierarchy.
final int displayChanges = display.getLastOverrideConfigurationChanges();
@@ -6918,22 +6874,21 @@
}
/**
- * Computes the bounds to fit the Activity within the bounds of the {@link Configuration}.
+ * Applies aspect ratio restrictions to outBounds. If no restrictions, then no change is
+ * made to outBounds.
*/
// TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
- private void computeBounds(Rect outBounds, Rect containingAppBounds) {
- outBounds.setEmpty();
+ private void applyAspectRatio(Rect outBounds, Rect containingAppBounds,
+ Rect containingBounds) {
final float maxAspectRatio = info.maxAspectRatio;
final ActivityStack stack = getActivityStack();
final float minAspectRatio = info.minAspectRatio;
- if (task == null || stack == null || task.inMultiWindowMode()
+ if (task == null || stack == null || (inMultiWindowMode() && !shouldUseSizeCompatMode())
|| (maxAspectRatio == 0 && minAspectRatio == 0)
|| isInVrUiMode(getConfiguration())) {
- // We don't set override configuration if that activity task isn't fullscreen. I.e. the
- // activity is in multi-window mode. Or, there isn't a max aspect ratio specified for
- // the activity. This is indicated by an empty {@link outBounds}. We also don't set it
- // if we are in VR mode.
+ // We don't enforce aspect ratio if the activity task is in multiwindow unless it
+ // is in size-compat mode. We also don't set it if we are in VR mode.
return;
}
@@ -6991,12 +6946,6 @@
if (containingAppWidth <= activityWidth && containingAppHeight <= activityHeight) {
// The display matches or is less than the activity aspect ratio, so nothing else to do.
- // Return the existing bounds. If this method is running for the first time,
- // {@link #getRequestedOverrideBounds()} will be empty (representing no override). If
- // the method has run before, then effect of {@link #getRequestedOverrideBounds()} will
- // already have been applied to the value returned from {@link getConfiguration}. Refer
- // to {@link TaskRecord#computeConfigResourceOverrides()}.
- outBounds.set(getRequestedOverrideBounds());
return;
}
@@ -7004,7 +6953,8 @@
// Also account for the left / top insets (e.g. from display cutouts), which will be clipped
// away later in {@link TaskRecord#computeConfigResourceOverrides()}. Otherwise, the app
// bounds would end up too small.
- outBounds.set(0, 0, activityWidth + containingAppBounds.left,
+ outBounds.set(containingBounds.left, containingBounds.top,
+ activityWidth + containingAppBounds.left,
activityHeight + containingAppBounds.top);
}
@@ -7067,7 +7017,7 @@
mLastReportedDisplayId = newDisplayId;
}
// TODO(b/36505427): Is there a better place to do this?
- updateOverrideConfiguration();
+ updateSizeCompatMode();
// Short circuit: if the two full configurations are equal (the common case), then there is
// nothing to do. We test the full configuration instead of the global and merged override
@@ -7358,13 +7308,11 @@
// Reset the existing override configuration so it can be updated according to the latest
// configuration.
- getRequestedOverrideConfiguration().unset();
- getResolvedOverrideConfiguration().unset();
- mCompatDisplayInsets = null;
+ clearSizeCompatMode();
if (visible) {
// Configuration will be ensured when becoming visible, so if it is already visible,
// then the manual update is needed.
- updateOverrideConfiguration();
+ updateSizeCompatMode();
}
if (!attachedToProcess()) {
@@ -7743,8 +7691,10 @@
* compatibility mode activity compute the configuration without relying on its current display.
*/
static class CompatDisplayInsets {
- final int mDisplayWidth;
- final int mDisplayHeight;
+ private final int mDisplayWidth;
+ private final int mDisplayHeight;
+ private final int mWidth;
+ private final int mHeight;
/**
* The nonDecorInsets for each rotation. Includes the navigation bar and cutout insets. It
@@ -7758,9 +7708,23 @@
*/
final Rect[] mStableInsets = new Rect[4];
- CompatDisplayInsets(DisplayContent display) {
+ /**
+ * Sets bounds to {@link TaskRecord} bounds. For apps in freeform, the task bounds are the
+ * parent bounds from the app's perspective. No insets because within a window.
+ */
+ CompatDisplayInsets(DisplayContent display, Rect activityBounds, boolean isFloating) {
mDisplayWidth = display.mBaseDisplayWidth;
mDisplayHeight = display.mBaseDisplayHeight;
+ mWidth = activityBounds.width();
+ mHeight = activityBounds.height();
+ if (isFloating) {
+ Rect emptyRect = new Rect();
+ for (int rotation = 0; rotation < 4; rotation++) {
+ mNonDecorInsets[rotation] = emptyRect;
+ mStableInsets[rotation] = emptyRect;
+ }
+ return;
+ }
final DisplayPolicy policy = display.getDisplayPolicy();
for (int rotation = 0; rotation < 4; rotation++) {
mNonDecorInsets[rotation] = new Rect();
@@ -7783,9 +7747,9 @@
outBounds.set(0, 0, dw, dh);
}
- void getDisplayBoundsByOrientation(Rect outBounds, int orientation) {
- final int longSide = Math.max(mDisplayWidth, mDisplayHeight);
- final int shortSide = Math.min(mDisplayWidth, mDisplayHeight);
+ void getFrameByOrientation(Rect outBounds, int orientation) {
+ final int longSide = Math.max(mWidth, mHeight);
+ final int shortSide = Math.min(mWidth, mHeight);
final boolean isLandscape = orientation == ORIENTATION_LANDSCAPE;
outBounds.set(0, 0, isLandscape ? longSide : shortSide,
isLandscape ? shortSide : longSide);
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index 41c1e4e..8e3995bf 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -162,6 +162,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.function.Consumer;
/**
* State and management of a single stack of activities.
@@ -246,12 +247,13 @@
ActivityDisplay current = getParent();
if (current != parent) {
mDisplayId = parent.mDisplayId;
- onParentChanged();
+ onParentChanged(parent, current);
}
}
@Override
- protected void onParentChanged() {
+ protected void onParentChanged(
+ ConfigurationContainer newParent, ConfigurationContainer oldParent) {
ActivityDisplay display = getParent();
if (display != null) {
// Rotations are relative to the display. This means if there are 2 displays rotated
@@ -264,7 +266,7 @@
getConfiguration().windowConfiguration.setRotation(
display.getWindowConfiguration().getRotation());
}
- super.onParentChanged();
+ super.onParentChanged(newParent, oldParent);
if (display != null && inSplitScreenPrimaryWindowingMode()) {
// If we created a docked stack we want to resize it so it resizes all other stacks
// in the system.
@@ -915,12 +917,13 @@
/** Removes the stack completely. Also calls WindowManager to do the same on its side. */
void remove() {
+ final ActivityDisplay oldDisplay = getDisplay();
removeFromDisplay();
if (mTaskStack != null) {
mTaskStack.removeIfPossible();
mTaskStack = null;
}
- onParentChanged();
+ onParentChanged(null, oldDisplay);
}
ActivityDisplay getDisplay() {
@@ -2116,14 +2119,21 @@
}
aboveTop = false;
+ final boolean reallyVisible = r.shouldBeVisible(behindFullscreenActivity,
+ false /* ignoringKeyguard */);
// Check whether activity should be visible without Keyguard influence
- final boolean visibleIgnoringKeyguard = r.shouldBeVisibleIgnoringKeyguard(
- behindFullscreenActivity);
- final boolean reallyVisible = r.shouldBeVisible(behindFullscreenActivity);
- if (visibleIgnoringKeyguard) {
- behindFullscreenActivity = updateBehindFullscreen(!stackShouldBeVisible,
- behindFullscreenActivity, r);
+ if (r.visibleIgnoringKeyguard) {
+ if (r.occludesParent()) {
+ // At this point, nothing else needs to be shown in this task.
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Fullscreen: at " + r
+ + " stackVisible=" + stackShouldBeVisible
+ + " behindFullscreen=" + behindFullscreenActivity);
+ behindFullscreenActivity = true;
+ } else {
+ behindFullscreenActivity = false;
+ }
}
+
if (reallyVisible) {
if (r.finishing) {
continue;
@@ -2336,18 +2346,6 @@
return false;
}
- private boolean updateBehindFullscreen(boolean stackInvisible, boolean behindFullscreenActivity,
- ActivityRecord r) {
- if (r.occludesParent()) {
- if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Fullscreen: at " + r
- + " stackInvisible=" + stackInvisible
- + " behindFullscreenActivity=" + behindFullscreenActivity);
- // At this point, nothing else needs to be shown in this task.
- behindFullscreenActivity = true;
- }
- return behindFullscreenActivity;
- }
-
void convertActivityToTranslucent(ActivityRecord r) {
mTranslucentActivityWaiting = r;
mUndrawnActivitiesBelowTopTranslucent.clear();
@@ -2398,14 +2396,22 @@
}
}
- /** If any activities below the top running one are in the INITIALIZING state and they have a
- * starting window displayed then remove that starting window. It is possible that the activity
- * in this state will never resumed in which case that starting window will be orphaned. */
+ /** @see ActivityRecord#cancelInitializing() */
void cancelInitializingActivities() {
- final ActivityRecord topActivity = topRunningActivityLocked();
- boolean aboveTop = true;
// We don't want to clear starting window for activities that aren't behind fullscreen
// activities as we need to display their starting window until they are done initializing.
+ checkBehindFullscreenActivity(null /* toCheck */, ActivityRecord::cancelInitializing);
+ }
+
+ /**
+ * If an activity {@param toCheck} is given, this method returns {@code true} if the activity
+ * is occluded by any fullscreen activity. If there is no {@param toCheck} and the handling
+ * function {@param handleBehindFullscreenActivity} is given, this method will pass all occluded
+ * activities to the function.
+ */
+ boolean checkBehindFullscreenActivity(ActivityRecord toCheck,
+ Consumer<ActivityRecord> handleBehindFullscreenActivity) {
+ boolean aboveTop = true;
boolean behindFullscreenActivity = false;
if (!shouldBeVisible(null)) {
@@ -2415,22 +2421,40 @@
behindFullscreenActivity = true;
}
+ final boolean handlingOccluded = toCheck == null && handleBehindFullscreenActivity != null;
+ if (!handlingOccluded && behindFullscreenActivity) {
+ return true;
+ }
+
+ final ActivityRecord topActivity = topRunningActivityLocked();
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final TaskRecord task = mTaskHistory.get(taskNdx);
for (int activityNdx = task.getChildCount() - 1; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = task.getChildAt(activityNdx);
if (aboveTop) {
if (r == topActivity) {
+ if (r == toCheck) {
+ // It is the top activity in a visible stack.
+ return false;
+ }
aboveTop = false;
}
behindFullscreenActivity |= r.occludesParent();
continue;
}
- r.removeOrphanedStartingWindow(behindFullscreenActivity);
+ if (handlingOccluded) {
+ handleBehindFullscreenActivity.accept(r);
+ } else if (r == toCheck) {
+ return behindFullscreenActivity;
+ } else if (behindFullscreenActivity) {
+ // It is occluded before {@param toCheck} is found.
+ return true;
+ }
behindFullscreenActivity |= r.occludesParent();
}
}
+ return behindFullscreenActivity;
}
/**
@@ -4719,12 +4743,13 @@
* {@link #REMOVE_TASK_MODE_MOVING}, {@link #REMOVE_TASK_MODE_MOVING_TO_TOP}.
*/
void removeTask(TaskRecord task, String reason, int mode) {
- final boolean removed = mTaskHistory.remove(task);
-
- if (removed) {
- EventLog.writeEvent(EventLogTags.AM_REMOVE_TASK, task.mTaskId, getStackId());
+ if (!mTaskHistory.remove(task)) {
+ // Not really in this stack anymore...
+ return;
}
+ EventLog.writeEvent(EventLogTags.AM_REMOVE_TASK, task.mTaskId, getStackId());
+
removeActivitiesFromLRUList(task);
updateTaskMovement(task, true);
@@ -4758,7 +4783,7 @@
if (inPinnedWindowingMode()) {
mService.getTaskChangeNotificationController().notifyActivityUnpinned();
}
- if (display.isSingleTaskInstance()) {
+ if (display != null && display.isSingleTaskInstance()) {
mService.notifySingleTaskDisplayEmpty(display.mDisplayId);
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index 1bc36bb..64351fb0 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -752,9 +752,7 @@
andResume = false;
}
- if (getKeyguardController().isKeyguardLocked()) {
- r.notifyUnknownVisibilityLaunched();
- }
+ r.notifyUnknownVisibilityLaunchedForKeyguardTransition();
// Have the window manager re-evaluate the orientation of the screen based on the new
// activity order. Note that as a result of this, it can call back into the activity
@@ -992,12 +990,7 @@
knownToBeDead = true;
}
- // Suppress transition until the new activity becomes ready, otherwise the keyguard can
- // appear for a short amount of time before the new process with the new activity had the
- // ability to set its showWhenLocked flags.
- if (getKeyguardController().isKeyguardLocked()) {
- r.notifyUnknownVisibilityLaunched();
- }
+ r.notifyUnknownVisibilityLaunchedForKeyguardTransition();
final boolean isTop = andResume && r.isTopRunningActivity();
mService.startProcessAsync(r, knownToBeDead, isTop, isTop ? "top-activity" : "activity");
@@ -2086,7 +2079,6 @@
final TaskRecord task = r.getTaskRecord();
final ActivityStack stack = task.getStack();
- r.mLaunchTaskBehind = false;
mRecentTasks.add(task);
mService.getTaskChangeNotificationController().notifyTaskStackChanged();
stack.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
@@ -2248,7 +2240,7 @@
// Complete + brief == give a summary. Isn't that obvious?!?
if (lastTask.intent != null) {
pw.print(prefix); pw.print(" ");
- pw.println(lastTask.intent.toInsecureStringWithClip());
+ pw.println(lastTask.intent.toInsecureString());
}
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityStartController.java b/services/core/java/com/android/server/wm/ActivityStartController.java
index 63cec1a..2c4d893 100644
--- a/services/core/java/com/android/server/wm/ActivityStartController.java
+++ b/services/core/java/com/android/server/wm/ActivityStartController.java
@@ -284,7 +284,7 @@
.setRequestCode(requestCode)
.setStartFlags(startFlags)
.setActivityOptions(options)
- .setMayWait(userId)
+ .setUserId(userId)
.setInTask(inTask)
.setOriginatingPendingIntent(originatingPendingIntent)
.setAllowBackgroundActivityStart(allowBackgroundActivityStart)
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 2ac681c..ff0dc54 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -199,7 +199,7 @@
private IVoiceInteractor mVoiceInteractor;
// Last activity record we attempted to start
- private final ActivityRecord[] mLastStartActivityRecord = new ActivityRecord[1];
+ private ActivityRecord mLastStartActivityRecord;
// The result of the last activity we attempted to start.
private int mLastStartActivityResult;
// Time in milli seconds we attempted to start the last activity.
@@ -212,7 +212,8 @@
* to avoid unnecessarily retaining parameters. Note that the request is ignored when
* {@link #startResolvedActivity} is invoked directly.
*/
- private Request mRequest = new Request();
+ @VisibleForTesting
+ Request mRequest = new Request();
/**
* An interface that to provide {@link ActivityStarter} instances to the controller. This is
@@ -299,7 +300,8 @@
* {@link #dump(PrintWriter, String)} and therefore cannot be cleared immediately after
* execution.
*/
- private static class Request {
+ @VisibleForTesting
+ static class Request {
private static final int DEFAULT_CALLING_UID = -1;
private static final int DEFAULT_CALLING_PID = 0;
static final int DEFAULT_REAL_CALLING_UID = -1;
@@ -307,6 +309,7 @@
IApplicationThread caller;
Intent intent;
+ // A copy of the original requested intent, in case for ephemeral app launch.
Intent ephemeralIntent;
String resolvedType;
ActivityInfo activityInfo;
@@ -344,13 +347,6 @@
boolean allowPendingRemoteAnimationRegistryLookup;
/**
- * Indicates that we should wait for the result of the start request. This flag is set when
- * {@link ActivityStarter#setMayWait(int)} is called.
- * {@see ActivityStarter#startActivityMayWait}.
- */
- boolean mayWait;
-
- /**
* Ensure constructed request matches reset instance.
*/
Request() {
@@ -388,7 +384,6 @@
globalConfig = null;
userId = 0;
waitResult = null;
- mayWait = false;
avoidMoveToFront = false;
allowPendingRemoteAnimationRegistryLookup = true;
filterCallingUid = UserHandle.USER_NULL;
@@ -427,7 +422,6 @@
globalConfig = request.globalConfig;
userId = request.userId;
waitResult = request.waitResult;
- mayWait = request.mayWait;
avoidMoveToFront = request.avoidMoveToFront;
allowPendingRemoteAnimationRegistryLookup
= request.allowPendingRemoteAnimationRegistryLookup;
@@ -435,6 +429,77 @@
originatingPendingIntent = request.originatingPendingIntent;
allowBackgroundActivityStart = request.allowBackgroundActivityStart;
}
+
+ /**
+ * Resolve activity from the given intent for this launch.
+ */
+ void resolveActivity(ActivityStackSupervisor supervisor) {
+ if (realCallingPid == Request.DEFAULT_REAL_CALLING_PID) {
+ realCallingPid = Binder.getCallingPid();
+ }
+ if (realCallingUid == Request.DEFAULT_REAL_CALLING_UID) {
+ realCallingUid = Binder.getCallingUid();
+ }
+
+ if (callingUid >= 0) {
+ callingPid = -1;
+ } else if (caller == null) {
+ callingPid = realCallingPid;
+ callingUid = realCallingUid;
+ } else {
+ callingPid = callingUid = -1;
+ }
+
+ // Save a copy in case ephemeral needs it
+ ephemeralIntent = new Intent(intent);
+ // Don't modify the client's object!
+ intent = new Intent(intent);
+ if (intent.getComponent() != null
+ && !(Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() == null)
+ && !Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE.equals(intent.getAction())
+ && !Intent.ACTION_RESOLVE_INSTANT_APP_PACKAGE.equals(intent.getAction())
+ && supervisor.mService.getPackageManagerInternalLocked()
+ .isInstantAppInstallerComponent(intent.getComponent())) {
+ // Intercept intents targeted directly to the ephemeral installer the ephemeral
+ // installer should never be started with a raw Intent; instead adjust the intent
+ // so it looks like a "normal" instant app launch.
+ intent.setComponent(null /* component */);
+ }
+
+ resolveInfo = supervisor.resolveIntent(intent, resolvedType, userId,
+ 0 /* matchFlags */,
+ computeResolveFilterUid(callingUid, realCallingUid, filterCallingUid));
+ if (resolveInfo == null) {
+ final UserInfo userInfo = supervisor.getUserInfo(userId);
+ if (userInfo != null && userInfo.isManagedProfile()) {
+ // Special case for managed profiles, if attempting to launch non-cryto aware
+ // app in a locked managed profile from an unlocked parent allow it to resolve
+ // as user will be sent via confirm credentials to unlock the profile.
+ final UserManager userManager = UserManager.get(supervisor.mService.mContext);
+ boolean profileLockedAndParentUnlockingOrUnlocked = false;
+ final long token = Binder.clearCallingIdentity();
+ try {
+ final UserInfo parent = userManager.getProfileParent(userId);
+ profileLockedAndParentUnlockingOrUnlocked = (parent != null)
+ && userManager.isUserUnlockingOrUnlocked(parent.id)
+ && !userManager.isUserUnlockingOrUnlocked(userId);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ if (profileLockedAndParentUnlockingOrUnlocked) {
+ resolveInfo = supervisor.resolveIntent(intent, resolvedType, userId,
+ PackageManager.MATCH_DIRECT_BOOT_AWARE
+ | PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
+ computeResolveFilterUid(callingUid, realCallingUid,
+ filterCallingUid));
+ }
+ }
+ }
+
+ // Collect information about the target of the Intent.
+ activityInfo = supervisor.resolveActivity(intent, resolveInfo, startFlags,
+ profilerInfo);
+ }
}
ActivityStarter(ActivityStartController controller, ActivityTaskManagerService service,
@@ -494,46 +559,95 @@
mRequest.set(starter.mRequest);
}
- ActivityRecord getStartActivity() {
- return mStartActivity;
- }
-
boolean relatedToPackage(String packageName) {
- return (mLastStartActivityRecord[0] != null
- && packageName.equals(mLastStartActivityRecord[0].packageName))
+ return (mLastStartActivityRecord != null
+ && packageName.equals(mLastStartActivityRecord.packageName))
|| (mStartActivity != null && packageName.equals(mStartActivity.packageName));
}
/**
- * Starts an activity based on the request parameters provided earlier.
+ * Starts an activity based on the provided {@link ActivityRecord} and environment parameters.
+ * Note that this method is called internally as well as part of {@link #executeRequest}.
+ */
+ void startResolvedActivity(final ActivityRecord r, ActivityRecord sourceRecord,
+ IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
+ int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask) {
+ try {
+ mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(r.intent);
+ mLastStartReason = "startResolvedActivity";
+ mLastStartActivityTimeMs = System.currentTimeMillis();
+ mLastStartActivityRecord = r;
+ mLastStartActivityResult = startActivityUnchecked(r, sourceRecord, voiceSession,
+ voiceInteractor, startFlags, doResume, options, inTask,
+ false /* restrictedBgActivity */);
+ mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(mLastStartActivityResult,
+ mLastStartActivityRecord);
+ } finally {
+ onExecutionComplete();
+ }
+ }
+
+ /**
+ * Resolve necessary information according the request parameters provided earlier, and execute
+ * the request which begin the journey of starting an activity.
* @return The starter result.
*/
int execute() {
try {
- // TODO(b/64750076): Look into passing request directly to these methods to allow
- // for transactional diffs and preprocessing.
- if (mRequest.mayWait) {
- return startActivityMayWait(mRequest.caller, mRequest.callingUid,
- mRequest.callingPackage, mRequest.realCallingPid, mRequest.realCallingUid,
- mRequest.intent, mRequest.resolvedType,
- mRequest.voiceSession, mRequest.voiceInteractor, mRequest.resultTo,
- mRequest.resultWho, mRequest.requestCode, mRequest.startFlags,
- mRequest.profilerInfo, mRequest.waitResult, mRequest.globalConfig,
- mRequest.activityOptions, mRequest.ignoreTargetSecurity, mRequest.userId,
- mRequest.inTask, mRequest.reason,
- mRequest.allowPendingRemoteAnimationRegistryLookup,
- mRequest.originatingPendingIntent, mRequest.allowBackgroundActivityStart);
- } else {
- return startActivity(mRequest.caller, mRequest.intent, mRequest.ephemeralIntent,
- mRequest.resolvedType, mRequest.activityInfo, mRequest.resolveInfo,
- mRequest.voiceSession, mRequest.voiceInteractor, mRequest.resultTo,
- mRequest.resultWho, mRequest.requestCode, mRequest.callingPid,
- mRequest.callingUid, mRequest.callingPackage, mRequest.realCallingPid,
- mRequest.realCallingUid, mRequest.startFlags, mRequest.activityOptions,
- mRequest.ignoreTargetSecurity, mRequest.componentSpecified,
- mRequest.outActivity, mRequest.inTask, mRequest.reason,
- mRequest.allowPendingRemoteAnimationRegistryLookup,
- mRequest.originatingPendingIntent, mRequest.allowBackgroundActivityStart);
+ // Refuse possible leaked file descriptors
+ if (mRequest.intent != null && mRequest.intent.hasFileDescriptors()) {
+ throw new IllegalArgumentException("File descriptors passed in Intent");
+ }
+
+ mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(mRequest.intent);
+
+ if (mRequest.activityInfo == null) {
+ mRequest.resolveActivity(mSupervisor);
+ }
+
+ int res;
+ synchronized (mService.mGlobalLock) {
+ final ActivityStack stack = mRootActivityContainer.getTopDisplayFocusedStack();
+ stack.mConfigWillChange = mRequest.globalConfig != null
+ && mService.getGlobalConfiguration().diff(mRequest.globalConfig) != 0;
+ if (DEBUG_CONFIGURATION) {
+ Slog.v(TAG_CONFIGURATION, "Starting activity when config will change = "
+ + stack.mConfigWillChange);
+ }
+
+ final long origId = Binder.clearCallingIdentity();
+
+ res = resolveToHeavyWeightSwitcherIfNeeded();
+ if (res != START_SUCCESS) {
+ return res;
+ }
+ res = executeRequest(mRequest);
+
+ Binder.restoreCallingIdentity(origId);
+
+ if (stack.mConfigWillChange) {
+ // If the caller also wants to switch to a new configuration, do so now.
+ // This allows a clean switch, as we are waiting for the current activity
+ // to pause (so we will not destroy it), and have not yet started the
+ // next activity.
+ mService.mAmInternal.enforceCallingPermission(
+ android.Manifest.permission.CHANGE_CONFIGURATION,
+ "updateConfiguration()");
+ stack.mConfigWillChange = false;
+ if (DEBUG_CONFIGURATION) {
+ Slog.v(TAG_CONFIGURATION,
+ "Updating to new configuration after starting activity.");
+ }
+ mService.updateConfigurationLocked(mRequest.globalConfig, null, false);
+ }
+
+ // Notify ActivityMetricsLogger that the activity has launched.
+ // ActivityMetricsLogger will then wait for the windows to be drawn and populate
+ // WaitResult.
+ mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(res,
+ mLastStartActivityRecord);
+ return getExternalResult(mRequest.waitResult == null ? res
+ : waitForResult(res, mLastStartActivityRecord));
}
} finally {
onExecutionComplete();
@@ -541,89 +655,167 @@
}
/**
- * Starts an activity based on the provided {@link ActivityRecord} and environment parameters.
- * Note that this method is called internally as well as part of {@link #startActivity}.
- *
- * @return The start result.
+ * Updates the request to heavy-weight switch if this is a heavy-weight process while there
+ * already have another, different heavy-weight process running.
*/
- int startResolvedActivity(final ActivityRecord r, ActivityRecord sourceRecord,
- IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
- int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask) {
- try {
- mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(r.intent);
- mLastStartReason = "startResolvedActivity";
- mLastStartActivityTimeMs = System.currentTimeMillis();
- mLastStartActivityRecord[0] = r;
- mLastStartActivityResult = startActivity(r, sourceRecord, voiceSession, voiceInteractor,
- startFlags, doResume, options, inTask, mLastStartActivityRecord,
- false /* restrictedBgActivity */);
- mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(mLastStartActivityResult,
- mLastStartActivityRecord[0]);
- return mLastStartActivityResult;
- } finally {
- onExecutionComplete();
- }
- }
-
- private int startActivity(IApplicationThread caller, Intent intent, Intent ephemeralIntent,
- String resolvedType, ActivityInfo aInfo, ResolveInfo rInfo,
- IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
- IBinder resultTo, String resultWho, int requestCode, int callingPid, int callingUid,
- String callingPackage, int realCallingPid, int realCallingUid, int startFlags,
- SafeActivityOptions options, boolean ignoreTargetSecurity, boolean componentSpecified,
- ActivityRecord[] outActivity, TaskRecord inTask, String reason,
- boolean allowPendingRemoteAnimationRegistryLookup,
- PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) {
-
- if (TextUtils.isEmpty(reason)) {
- throw new IllegalArgumentException("Need to specify a reason.");
- }
- mLastStartReason = reason;
- mLastStartActivityTimeMs = System.currentTimeMillis();
- mLastStartActivityRecord[0] = null;
-
- mLastStartActivityResult = startActivity(caller, intent, ephemeralIntent, resolvedType,
- aInfo, rInfo, voiceSession, voiceInteractor, resultTo, resultWho, requestCode,
- callingPid, callingUid, callingPackage, realCallingPid, realCallingUid, startFlags,
- options, ignoreTargetSecurity, componentSpecified, mLastStartActivityRecord,
- inTask, allowPendingRemoteAnimationRegistryLookup, originatingPendingIntent,
- allowBackgroundActivityStart);
-
- if (outActivity != null) {
- // mLastStartActivityRecord[0] is set in the call to startActivity above.
- outActivity[0] = mLastStartActivityRecord[0];
+ private int resolveToHeavyWeightSwitcherIfNeeded() {
+ if (mRequest.activityInfo == null || !mService.mHasHeavyWeightFeature
+ || (mRequest.activityInfo.applicationInfo.privateFlags
+ & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) == 0) {
+ return START_SUCCESS;
}
- return getExternalResult(mLastStartActivityResult);
- }
+ if (!mRequest.activityInfo.processName.equals(
+ mRequest.activityInfo.applicationInfo.packageName)) {
+ return START_SUCCESS;
+ }
- static int getExternalResult(int result) {
- // Aborted results are treated as successes externally, but we must track them internally.
- return result != START_ABORTED ? result : START_SUCCESS;
+ final WindowProcessController heavy = mService.mHeavyWeightProcess;
+ if (heavy == null || (heavy.mInfo.uid == mRequest.activityInfo.applicationInfo.uid
+ && heavy.mName.equals(mRequest.activityInfo.processName))) {
+ return START_SUCCESS;
+ }
+
+ int appCallingUid = mRequest.callingUid;
+ if (mRequest.caller != null) {
+ WindowProcessController callerApp = mService.getProcessController(mRequest.caller);
+ if (callerApp != null) {
+ appCallingUid = callerApp.mInfo.uid;
+ } else {
+ Slog.w(TAG, "Unable to find app for caller " + mRequest.caller + " (pid="
+ + mRequest.callingPid + ") when starting: " + mRequest.intent.toString());
+ SafeActivityOptions.abort(mRequest.activityOptions);
+ return ActivityManager.START_PERMISSION_DENIED;
+ }
+ }
+
+ final IIntentSender target = mService.getIntentSenderLocked(
+ ActivityManager.INTENT_SENDER_ACTIVITY, "android" /* packageName */, appCallingUid,
+ mRequest.userId, null /* token */, null /* resultWho*/, 0 /* requestCode*/,
+ new Intent[] { mRequest.intent }, new String[] { mRequest.resolvedType },
+ PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT,
+ null /* bOptions */);
+
+ final Intent newIntent = new Intent();
+ if (mRequest.requestCode >= 0) {
+ // Caller is requesting a result.
+ newIntent.putExtra(HeavyWeightSwitcherActivity.KEY_HAS_RESULT, true);
+ }
+ newIntent.putExtra(HeavyWeightSwitcherActivity.KEY_INTENT, new IntentSender(target));
+ heavy.updateIntentForHeavyWeightActivity(newIntent);
+ newIntent.putExtra(HeavyWeightSwitcherActivity.KEY_NEW_APP,
+ mRequest.activityInfo.packageName);
+ newIntent.setFlags(mRequest.intent.getFlags());
+ newIntent.setClassName("android" /* packageName */,
+ HeavyWeightSwitcherActivity.class.getName());
+ mRequest.intent = newIntent;
+ mRequest.resolvedType = null;
+ mRequest.caller = null;
+ mRequest.callingUid = Binder.getCallingUid();
+ mRequest.callingPid = Binder.getCallingPid();
+ mRequest.componentSpecified = true;
+ mRequest.resolveInfo = mSupervisor.resolveIntent(mRequest.intent, null /* resolvedType */,
+ mRequest.userId, 0 /* matchFlags */,
+ computeResolveFilterUid(mRequest.callingUid, mRequest.realCallingUid,
+ mRequest.filterCallingUid));
+ mRequest.activityInfo =
+ mRequest.resolveInfo != null ? mRequest.resolveInfo.activityInfo : null;
+ if (mRequest.activityInfo != null) {
+ mRequest.activityInfo = mService.mAmInternal.getActivityInfoForUser(
+ mRequest.activityInfo, mRequest.userId);
+ }
+
+ return START_SUCCESS;
}
/**
- * Called when execution is complete. Sets state indicating completion and proceeds with
- * recycling if appropriate.
+ * Wait for activity launch completes.
*/
- private void onExecutionComplete() {
- mController.onExecutionComplete(this);
+ private int waitForResult(int res, ActivityRecord r) {
+ mRequest.waitResult.result = res;
+ switch(res) {
+ case START_SUCCESS: {
+ mSupervisor.mWaitingActivityLaunched.add(mRequest.waitResult);
+ do {
+ try {
+ mService.mGlobalLock.wait();
+ } catch (InterruptedException e) {
+ }
+ } while (mRequest.waitResult.result != START_TASK_TO_FRONT
+ && !mRequest.waitResult.timeout && mRequest.waitResult.who == null);
+ if (mRequest.waitResult.result == START_TASK_TO_FRONT) {
+ res = START_TASK_TO_FRONT;
+ }
+ break;
+ }
+ case START_DELIVERED_TO_TOP: {
+ mRequest.waitResult.timeout = false;
+ mRequest.waitResult.who = r.mActivityComponent;
+ mRequest.waitResult.totalTime = 0;
+ break;
+ }
+ case START_TASK_TO_FRONT: {
+ mRequest.waitResult.launchState =
+ r.attachedToProcess() ? LAUNCH_STATE_HOT : LAUNCH_STATE_COLD;
+ // ActivityRecord may represent a different activity, but it should not be
+ // in the resumed state.
+ if (r.nowVisible && r.isState(RESUMED)) {
+ mRequest.waitResult.timeout = false;
+ mRequest.waitResult.who = r.mActivityComponent;
+ mRequest.waitResult.totalTime = 0;
+ } else {
+ final long startTimeMs = SystemClock.uptimeMillis();
+ mSupervisor.waitActivityVisible(r.mActivityComponent, mRequest.waitResult,
+ startTimeMs);
+ // Note: the timeout variable is not currently not ever set.
+ do {
+ try {
+ mService.mGlobalLock.wait();
+ } catch (InterruptedException e) {
+ }
+ } while (!mRequest.waitResult.timeout && mRequest.waitResult.who == null);
+ }
+ break;
+ }
+ }
+ return res;
}
- private int startActivity(IApplicationThread caller, Intent intent, Intent ephemeralIntent,
- String resolvedType, ActivityInfo aInfo, ResolveInfo rInfo,
- IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
- IBinder resultTo, String resultWho, int requestCode, int callingPid, int callingUid,
- String callingPackage, int realCallingPid, int realCallingUid, int startFlags,
- SafeActivityOptions options,
- boolean ignoreTargetSecurity, boolean componentSpecified, ActivityRecord[] outActivity,
- TaskRecord inTask, boolean allowPendingRemoteAnimationRegistryLookup,
- PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) {
- mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(intent);
+ /**
+ * Executing activity start request and starts the journey of starting an activity. Here
+ * begins with performing several preliminary checks. The normally activity launch flow will
+ * go through {@link #startActivityUnchecked} to {@link #startActivityInner}.
+ */
+ private int executeRequest(Request request) {
+ if (TextUtils.isEmpty(request.reason)) {
+ throw new IllegalArgumentException("Need to specify a reason.");
+ }
+ mLastStartReason = request.reason;
+ mLastStartActivityTimeMs = System.currentTimeMillis();
+ mLastStartActivityRecord = null;
+
+ final IApplicationThread caller = request.caller;
+ Intent intent = request.intent;
+ String resolvedType = request.resolvedType;
+ ActivityInfo aInfo = request.activityInfo;
+ ResolveInfo rInfo = request.resolveInfo;
+ final IVoiceInteractionSession voiceSession = request.voiceSession;
+ final IBinder resultTo = request.resultTo;
+ String resultWho = request.resultWho;
+ int requestCode = request.requestCode;
+ int callingPid = request.callingPid;
+ int callingUid = request.callingUid;
+ String callingPackage = request.callingPackage;
+ final int realCallingPid = request.realCallingPid;
+ final int realCallingUid = request.realCallingUid;
+ final int startFlags = request.startFlags;
+ final SafeActivityOptions options = request.activityOptions;
+ TaskRecord inTask = request.inTask;
+
int err = ActivityManager.START_SUCCESS;
// Pull the optional Ephemeral Installer-only bundle out of the options early.
- final Bundle verificationBundle
- = options != null ? options.popAppVerificationBundle() : null;
+ final Bundle verificationBundle =
+ options != null ? options.popAppVerificationBundle() : null;
WindowProcessController callerApp = null;
if (caller != null) {
@@ -632,16 +824,14 @@
callingPid = callerApp.getPid();
callingUid = callerApp.mInfo.uid;
} else {
- Slog.w(TAG, "Unable to find app for caller " + caller
- + " (pid=" + callingPid + ") when starting: "
- + intent.toString());
+ Slog.w(TAG, "Unable to find app for caller " + caller + " (pid=" + callingPid
+ + ") when starting: " + intent.toString());
err = ActivityManager.START_PERMISSION_DENIED;
}
}
final int userId = aInfo != null && aInfo.applicationInfo != null
? UserHandle.getUserId(aInfo.applicationInfo.uid) : 0;
-
if (err == ActivityManager.START_SUCCESS) {
Slog.i(TAG, "START u" + userId + " {" + intent.toShortString(true, true, true, false)
+ "} from uid " + callingUid);
@@ -651,8 +841,9 @@
ActivityRecord resultRecord = null;
if (resultTo != null) {
sourceRecord = mRootActivityContainer.isInAnyStack(resultTo);
- if (DEBUG_RESULTS) Slog.v(TAG_RESULTS,
- "Will send result to " + resultTo + " " + sourceRecord);
+ if (DEBUG_RESULTS) {
+ Slog.v(TAG_RESULTS, "Will send result to " + resultTo + " " + sourceRecord);
+ }
if (sourceRecord != null) {
if (requestCode >= 0 && !sourceRecord.finishing) {
resultRecord = sourceRecord;
@@ -661,10 +852,9 @@
}
final int launchFlags = intent.getFlags();
-
if ((launchFlags & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0 && sourceRecord != null) {
- // Transfer the result target from the source activity to the new
- // one being started, including any failures.
+ // Transfer the result target from the source activity to the new one being started,
+ // including any failures.
if (requestCode >= 0) {
SafeActivityOptions.abort(options);
return ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT;
@@ -680,16 +870,16 @@
resultRecord.removeResultsLocked(sourceRecord, resultWho, requestCode);
}
if (sourceRecord.launchedFromUid == callingUid) {
- // The new activity is being launched from the same uid as the previous
- // activity in the flow, and asking to forward its result back to the
- // previous. In this case the activity is serving as a trampoline between
- // the two, so we also want to update its launchedFromPackage to be the
- // same as the previous activity. Note that this is safe, since we know
- // these two packages come from the same uid; the caller could just as
- // well have supplied that same package name itself. This specifially
- // deals with the case of an intent picker/chooser being launched in the app
- // flow to redirect to an activity picked by the user, where we want the final
- // activity to consider it to have been launched by the previous app activity.
+ // The new activity is being launched from the same uid as the previous activity
+ // in the flow, and asking to forward its result back to the previous. In this
+ // case the activity is serving as a trampoline between the two, so we also want
+ // to update its launchedFromPackage to be the same as the previous activity.
+ // Note that this is safe, since we know these two packages come from the same
+ // uid; the caller could just as well have supplied that same package name itself
+ // . This specifially deals with the case of an intent picker/chooser being
+ // launched in the app flow to redirect to an activity picked by the user, where
+ // we want the final activity to consider it to have been launched by the
+ // previous app activity.
callingPackage = sourceRecord.launchedFromPackage;
}
}
@@ -708,19 +898,18 @@
if (err == ActivityManager.START_SUCCESS && sourceRecord != null
&& sourceRecord.getTaskRecord().voiceSession != null) {
- // If this activity is being launched as part of a voice session, we need
- // to ensure that it is safe to do so. If the upcoming activity will also
- // be part of the voice session, we can only launch it if it has explicitly
- // said it supports the VOICE category, or it is a part of the calling app.
+ // If this activity is being launched as part of a voice session, we need to ensure
+ // that it is safe to do so. If the upcoming activity will also be part of the voice
+ // session, we can only launch it if it has explicitly said it supports the VOICE
+ // category, or it is a part of the calling app.
if ((launchFlags & FLAG_ACTIVITY_NEW_TASK) == 0
&& sourceRecord.info.applicationInfo.uid != aInfo.applicationInfo.uid) {
try {
intent.addCategory(Intent.CATEGORY_VOICE);
if (!mService.getPackageManager().activitySupportsIntent(
intent.getComponent(), intent, resolvedType)) {
- Slog.w(TAG,
- "Activity being started in current voice task does not support voice: "
- + intent);
+ Slog.w(TAG, "Activity being started in current voice task does not support "
+ + "voice: " + intent);
err = ActivityManager.START_NOT_VOICE_COMPATIBLE;
}
} catch (RemoteException e) {
@@ -737,8 +926,7 @@
if (!mService.getPackageManager().activitySupportsIntent(intent.getComponent(),
intent, resolvedType)) {
Slog.w(TAG,
- "Activity being started in new voice task does not support: "
- + intent);
+ "Activity being started in new voice task does not support: " + intent);
err = ActivityManager.START_NOT_VOICE_COMPATIBLE;
}
} catch (RemoteException e) {
@@ -760,7 +948,7 @@
}
boolean abort = !mSupervisor.checkStartAnyActivityPermission(intent, aInfo, resultWho,
- requestCode, callingPid, callingUid, callingPackage, ignoreTargetSecurity,
+ requestCode, callingPid, callingUid, callingPackage, request.ignoreTargetSecurity,
inTask != null, callerApp, resultRecord, resultStack);
abort |= !mService.mIntentFirewall.checkStartActivity(intent, callingUid,
callingPid, resolvedType, aInfo.applicationInfo);
@@ -774,7 +962,8 @@
"shouldAbortBackgroundActivityStart");
restrictedBgActivity = shouldAbortBackgroundActivityStart(callingUid,
callingPid, callingPackage, realCallingUid, realCallingPid, callerApp,
- originatingPendingIntent, allowBackgroundActivityStart, intent);
+ request.originatingPendingIntent, request.allowBackgroundActivityStart,
+ intent);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
}
@@ -783,15 +972,15 @@
// Merge the two options bundles, while realCallerOptions takes precedence.
ActivityOptions checkedOptions = options != null
? options.getOptions(intent, aInfo, callerApp, mSupervisor) : null;
- if (allowPendingRemoteAnimationRegistryLookup) {
+ if (request.allowPendingRemoteAnimationRegistryLookup) {
checkedOptions = mService.getActivityStartController()
.getPendingRemoteAnimationRegistry()
.overrideOptionsIfNeeded(callingPackage, checkedOptions);
}
if (mService.mController != null) {
try {
- // The Intent we give to the watcher has the extra data
- // stripped off, since it can contain private information.
+ // The Intent we give to the watcher has the extra data stripped off, since it
+ // can contain private information.
Intent watchIntent = intent.cloneFilter();
abort |= !mService.mController.activityStarting(watchIntent,
aInfo.applicationInfo.packageName);
@@ -820,8 +1009,8 @@
resultRecord.sendResult(INVALID_UID, resultWho, requestCode, RESULT_CANCELED,
null /* data */);
}
- // We pretend to the caller that it was really started, but
- // they will just get a cancel result.
+ // We pretend to the caller that it was really started, but they will just get a
+ // cancel result.
ActivityOptions.abort(checkedOptions);
return START_ABORTED;
}
@@ -832,7 +1021,7 @@
if (aInfo != null) {
if (mService.getPackageManagerInternalLocked().isPermissionsReviewRequired(
aInfo.packageName, userId)) {
- IIntentSender target = mService.getIntentSenderLocked(
+ final IIntentSender target = mService.getIntentSenderLocked(
ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage,
callingUid, userId, null, null, 0, new Intent[]{intent},
new String[]{resolvedType}, PendingIntent.FLAG_CANCEL_CURRENT
@@ -870,7 +1059,7 @@
rInfo = mSupervisor.resolveIntent(intent, resolvedType, userId, 0,
computeResolveFilterUid(
- callingUid, realCallingUid, mRequest.filterCallingUid));
+ callingUid, realCallingUid, request.filterCallingUid));
aInfo = mSupervisor.resolveActivity(intent, rInfo, startFlags,
null /*profilerInfo*/);
@@ -889,7 +1078,7 @@
// starts either the intent we resolved here [on install error] or the ephemeral
// app [on install success].
if (rInfo != null && rInfo.auxiliaryInfo != null) {
- intent = createLaunchIntent(rInfo.auxiliaryInfo, ephemeralIntent,
+ intent = createLaunchIntent(rInfo.auxiliaryInfo, request.ephemeralIntent,
callingPackage, verificationBundle, resolvedType, userId);
resolvedType = null;
callingUid = realCallingUid;
@@ -898,13 +1087,11 @@
aInfo = mSupervisor.resolveActivity(intent, rInfo, startFlags, null /*profilerInfo*/);
}
- ActivityRecord r = new ActivityRecord(mService, callerApp, callingPid, callingUid,
+ final ActivityRecord r = new ActivityRecord(mService, callerApp, callingPid, callingUid,
callingPackage, intent, resolvedType, aInfo, mService.getGlobalConfiguration(),
- resultRecord, resultWho, requestCode, componentSpecified, voiceSession != null,
- mSupervisor, checkedOptions, sourceRecord);
- if (outActivity != null) {
- outActivity[0] = r;
- }
+ resultRecord, resultWho, requestCode, request.componentSpecified,
+ voiceSession != null, mSupervisor, checkedOptions, sourceRecord);
+ mLastStartActivityRecord = r;
if (r.appTimeTracker == null && sourceRecord != null) {
// If the caller didn't specify an explicit time tracker, we want to continue
@@ -932,10 +1119,52 @@
mService.onStartActivitySetDidAppSwitch();
mController.doPendingActivityLaunches(false);
- final int res = startActivity(r, sourceRecord, voiceSession, voiceInteractor, startFlags,
- true /* doResume */, checkedOptions, inTask, outActivity, restrictedBgActivity);
- mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(res, outActivity[0]);
- return res;
+ mLastStartActivityResult = startActivityUnchecked(r, sourceRecord, voiceSession,
+ request.voiceInteractor, startFlags, true /* doResume */, checkedOptions, inTask,
+ restrictedBgActivity);
+
+ if (request.outActivity != null) {
+ request.outActivity[0] = mLastStartActivityRecord;
+ }
+
+ return getExternalResult(mLastStartActivityResult);
+ }
+
+ /**
+ * Return true if background activity is really aborted.
+ *
+ * TODO(b/131748165): Refactor the logic so we don't need to call this method everywhere.
+ */
+ private boolean handleBackgroundActivityAbort(ActivityRecord r) {
+ // TODO(b/131747138): Remove toast and refactor related code in R release.
+ final boolean abort = !mService.isBackgroundActivityStartsEnabled();
+ if (!abort) {
+ return false;
+ }
+ final ActivityRecord resultRecord = r.resultTo;
+ final String resultWho = r.resultWho;
+ int requestCode = r.requestCode;
+ if (resultRecord != null) {
+ resultRecord.sendResult(INVALID_UID, resultWho, requestCode, RESULT_CANCELED,
+ null /* data */);
+ }
+ // We pretend to the caller that it was really started to make it backward compatible, but
+ // they will just get a cancel result.
+ ActivityOptions.abort(r.pendingOptions);
+ return true;
+ }
+
+ static int getExternalResult(int result) {
+ // Aborted results are treated as successes externally, but we must track them internally.
+ return result != START_ABORTED ? result : START_SUCCESS;
+ }
+
+ /**
+ * Called when execution is complete. Sets state indicating completion and proceeds with
+ * recycling if appropriate.
+ */
+ private void onExecutionComplete() {
+ mController.onExecutionComplete(this);
}
boolean shouldAbortBackgroundActivityStart(int callingUid, int callingPid,
@@ -1110,8 +1339,8 @@
// We're waiting for an activity launch to finish, but that activity simply
// brought another activity to front. We must also handle the case where the task is already
// in the front as a result of the trampoline activity being in the same task (it will be
- // considered focused as the trampoline will be finished). Let startActivityMayWait() know
- // about this, so it waits for the new activity to become visible instead.
+ // considered focused as the trampoline will be finished). Let them know about this, so
+ // it waits for the new activity to become visible instead, {@link #waitResultIfNeeded}.
mSupervisor.reportWaitingActivityLaunchedIfNeeded(r, result);
if (startedActivityStack == null) {
@@ -1141,241 +1370,6 @@
}
}
- private int startActivityMayWait(IApplicationThread caller, int callingUid,
- String callingPackage, int requestRealCallingPid, int requestRealCallingUid,
- Intent intent, String resolvedType, IVoiceInteractionSession voiceSession,
- IVoiceInteractor voiceInteractor, IBinder resultTo, String resultWho, int requestCode,
- int startFlags, ProfilerInfo profilerInfo, WaitResult outResult,
- Configuration globalConfig, SafeActivityOptions options, boolean ignoreTargetSecurity,
- int userId, TaskRecord inTask, String reason,
- boolean allowPendingRemoteAnimationRegistryLookup,
- PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) {
- // Refuse possible leaked file descriptors
- if (intent != null && intent.hasFileDescriptors()) {
- throw new IllegalArgumentException("File descriptors passed in Intent");
- }
- mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(intent);
- boolean componentSpecified = intent.getComponent() != null;
-
- final int realCallingPid = requestRealCallingPid != Request.DEFAULT_REAL_CALLING_PID
- ? requestRealCallingPid
- : Binder.getCallingPid();
- final int realCallingUid = requestRealCallingUid != Request.DEFAULT_REAL_CALLING_UID
- ? requestRealCallingUid
- : Binder.getCallingUid();
-
- int callingPid;
- if (callingUid >= 0) {
- callingPid = -1;
- } else if (caller == null) {
- callingPid = realCallingPid;
- callingUid = realCallingUid;
- } else {
- callingPid = callingUid = -1;
- }
-
- // Save a copy in case ephemeral needs it
- final Intent ephemeralIntent = new Intent(intent);
- // Don't modify the client's object!
- intent = new Intent(intent);
- if (componentSpecified
- && !(Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() == null)
- && !Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE.equals(intent.getAction())
- && !Intent.ACTION_RESOLVE_INSTANT_APP_PACKAGE.equals(intent.getAction())
- && mService.getPackageManagerInternalLocked()
- .isInstantAppInstallerComponent(intent.getComponent())) {
- // intercept intents targeted directly to the ephemeral installer the
- // ephemeral installer should never be started with a raw Intent; instead
- // adjust the intent so it looks like a "normal" instant app launch
- intent.setComponent(null /*component*/);
- componentSpecified = false;
- }
-
- ResolveInfo rInfo = mSupervisor.resolveIntent(intent, resolvedType, userId,
- 0 /* matchFlags */,
- computeResolveFilterUid(
- callingUid, realCallingUid, mRequest.filterCallingUid));
- if (rInfo == null) {
- UserInfo userInfo = mSupervisor.getUserInfo(userId);
- if (userInfo != null && userInfo.isManagedProfile()) {
- // Special case for managed profiles, if attempting to launch non-cryto aware
- // app in a locked managed profile from an unlocked parent allow it to resolve
- // as user will be sent via confirm credentials to unlock the profile.
- UserManager userManager = UserManager.get(mService.mContext);
- boolean profileLockedAndParentUnlockingOrUnlocked = false;
- long token = Binder.clearCallingIdentity();
- try {
- UserInfo parent = userManager.getProfileParent(userId);
- profileLockedAndParentUnlockingOrUnlocked = (parent != null)
- && userManager.isUserUnlockingOrUnlocked(parent.id)
- && !userManager.isUserUnlockingOrUnlocked(userId);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- if (profileLockedAndParentUnlockingOrUnlocked) {
- rInfo = mSupervisor.resolveIntent(intent, resolvedType, userId,
- PackageManager.MATCH_DIRECT_BOOT_AWARE
- | PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
- computeResolveFilterUid(
- callingUid, realCallingUid, mRequest.filterCallingUid));
- }
- }
- }
- // Collect information about the target of the Intent.
- ActivityInfo aInfo = mSupervisor.resolveActivity(intent, rInfo, startFlags, profilerInfo);
-
- synchronized (mService.mGlobalLock) {
- final ActivityStack stack = mRootActivityContainer.getTopDisplayFocusedStack();
- stack.mConfigWillChange = globalConfig != null
- && mService.getGlobalConfiguration().diff(globalConfig) != 0;
- if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
- "Starting activity when config will change = " + stack.mConfigWillChange);
-
- final long origId = Binder.clearCallingIdentity();
-
- if (aInfo != null &&
- (aInfo.applicationInfo.privateFlags
- & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0 &&
- mService.mHasHeavyWeightFeature) {
- // This may be a heavy-weight process! Check to see if we already
- // have another, different heavy-weight process running.
- if (aInfo.processName.equals(aInfo.applicationInfo.packageName)) {
- final WindowProcessController heavy = mService.mHeavyWeightProcess;
- if (heavy != null && (heavy.mInfo.uid != aInfo.applicationInfo.uid
- || !heavy.mName.equals(aInfo.processName))) {
- int appCallingUid = callingUid;
- if (caller != null) {
- WindowProcessController callerApp =
- mService.getProcessController(caller);
- if (callerApp != null) {
- appCallingUid = callerApp.mInfo.uid;
- } else {
- Slog.w(TAG, "Unable to find app for caller " + caller
- + " (pid=" + callingPid + ") when starting: "
- + intent.toString());
- SafeActivityOptions.abort(options);
- return ActivityManager.START_PERMISSION_DENIED;
- }
- }
-
- IIntentSender target = mService.getIntentSenderLocked(
- ActivityManager.INTENT_SENDER_ACTIVITY, "android",
- appCallingUid, userId, null, null, 0, new Intent[] { intent },
- new String[] { resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT
- | PendingIntent.FLAG_ONE_SHOT, null);
-
- Intent newIntent = new Intent();
- if (requestCode >= 0) {
- // Caller is requesting a result.
- newIntent.putExtra(HeavyWeightSwitcherActivity.KEY_HAS_RESULT, true);
- }
- newIntent.putExtra(HeavyWeightSwitcherActivity.KEY_INTENT,
- new IntentSender(target));
- heavy.updateIntentForHeavyWeightActivity(newIntent);
- newIntent.putExtra(HeavyWeightSwitcherActivity.KEY_NEW_APP,
- aInfo.packageName);
- newIntent.setFlags(intent.getFlags());
- newIntent.setClassName("android",
- HeavyWeightSwitcherActivity.class.getName());
- intent = newIntent;
- resolvedType = null;
- caller = null;
- callingUid = Binder.getCallingUid();
- callingPid = Binder.getCallingPid();
- componentSpecified = true;
- rInfo = mSupervisor.resolveIntent(intent, null /*resolvedType*/, userId,
- 0 /* matchFlags */, computeResolveFilterUid(
- callingUid, realCallingUid, mRequest.filterCallingUid));
- aInfo = rInfo != null ? rInfo.activityInfo : null;
- if (aInfo != null) {
- aInfo = mService.mAmInternal.getActivityInfoForUser(aInfo, userId);
- }
- }
- }
- }
-
- final ActivityRecord[] outRecord = new ActivityRecord[1];
- int res = startActivity(caller, intent, ephemeralIntent, resolvedType, aInfo, rInfo,
- voiceSession, voiceInteractor, resultTo, resultWho, requestCode, callingPid,
- callingUid, callingPackage, realCallingPid, realCallingUid, startFlags, options,
- ignoreTargetSecurity, componentSpecified, outRecord, inTask, reason,
- allowPendingRemoteAnimationRegistryLookup, originatingPendingIntent,
- allowBackgroundActivityStart);
-
- Binder.restoreCallingIdentity(origId);
-
- if (stack.mConfigWillChange) {
- // If the caller also wants to switch to a new configuration,
- // do so now. This allows a clean switch, as we are waiting
- // for the current activity to pause (so we will not destroy
- // it), and have not yet started the next activity.
- mService.mAmInternal.enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION,
- "updateConfiguration()");
- stack.mConfigWillChange = false;
- if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
- "Updating to new configuration after starting activity.");
- mService.updateConfigurationLocked(globalConfig, null, false);
- }
-
- // Notify ActivityMetricsLogger that the activity has launched. ActivityMetricsLogger
- // will then wait for the windows to be drawn and populate WaitResult.
- mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(res, outRecord[0]);
- if (outResult != null) {
- outResult.result = res;
-
- final ActivityRecord r = outRecord[0];
-
- switch(res) {
- case START_SUCCESS: {
- mSupervisor.mWaitingActivityLaunched.add(outResult);
- do {
- try {
- mService.mGlobalLock.wait();
- } catch (InterruptedException e) {
- }
- } while (outResult.result != START_TASK_TO_FRONT
- && !outResult.timeout && outResult.who == null);
- if (outResult.result == START_TASK_TO_FRONT) {
- res = START_TASK_TO_FRONT;
- }
- break;
- }
- case START_DELIVERED_TO_TOP: {
- outResult.timeout = false;
- outResult.who = r.mActivityComponent;
- outResult.totalTime = 0;
- break;
- }
- case START_TASK_TO_FRONT: {
- outResult.launchState =
- r.attachedToProcess() ? LAUNCH_STATE_HOT : LAUNCH_STATE_COLD;
- // ActivityRecord may represent a different activity, but it should not be
- // in the resumed state.
- if (r.nowVisible && r.isState(RESUMED)) {
- outResult.timeout = false;
- outResult.who = r.mActivityComponent;
- outResult.totalTime = 0;
- } else {
- final long startTimeMs = SystemClock.uptimeMillis();
- mSupervisor.waitActivityVisible(
- r.mActivityComponent, outResult, startTimeMs);
- // Note: the timeout variable is not currently not ever set.
- do {
- try {
- mService.mGlobalLock.wait();
- } catch (InterruptedException e) {
- }
- } while (!outResult.timeout && outResult.who == null);
- }
- break;
- }
- }
- }
-
- return res;
- }
- }
-
/**
* Compute the logical UID based on which the package manager would filter
* app components i.e. based on which the instant app policy would be applied
@@ -1393,17 +1387,22 @@
: (customCallingUid >= 0 ? customCallingUid : actualCallingUid);
}
- private int startActivity(final ActivityRecord r, ActivityRecord sourceRecord,
+ /**
+ * Start an activity while most of preliminary checks has been done and caller has been
+ * confirmed that holds necessary permissions to do so.
+ * Here also ensures that the starting activity is removed if the start wasn't successful.
+ */
+ private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord,
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask,
- ActivityRecord[] outActivity, boolean restrictedBgActivity) {
+ boolean restrictedBgActivity) {
int result = START_CANCELED;
final ActivityStack startedActivityStack;
try {
mService.deferWindowLayout();
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startActivityInner");
result = startActivityInner(r, sourceRecord, voiceSession, voiceInteractor,
- startFlags, doResume, options, inTask, outActivity, restrictedBgActivity);
+ startFlags, doResume, options, inTask, restrictedBgActivity);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
startedActivityStack = handleStartResult(r, result);
@@ -1459,34 +1458,16 @@
}
/**
- * Return true if background activity is really aborted.
+ * Start an activity and determine if the activity should be adding to the top of an existing
+ * task or delivered new intent to an existing activity. Also manipulating the activity task
+ * onto requested or valid stack/display.
*
- * TODO(b/131748165): Refactor the logic so we don't need to call this method everywhere.
+ * Note: This method should only be called from {@link #startActivityUnchecked}.
*/
- private boolean handleBackgroundActivityAbort(ActivityRecord r) {
- // TODO(b/131747138): Remove toast and refactor related code in R release.
- final boolean abort = !mService.isBackgroundActivityStartsEnabled();
- if (!abort) {
- return false;
- }
- final ActivityRecord resultRecord = r.resultTo;
- final String resultWho = r.resultWho;
- int requestCode = r.requestCode;
- if (resultRecord != null) {
- resultRecord.sendResult(INVALID_UID, resultWho, requestCode, RESULT_CANCELED,
- null /* data */);
- }
- // We pretend to the caller that it was really started to make it backward compatible, but
- // they will just get a cancel result.
- ActivityOptions.abort(r.pendingOptions);
- return true;
- }
-
- // Note: This method should only be called from {@link startActivity}.
private int startActivityInner(final ActivityRecord r, ActivityRecord sourceRecord,
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask,
- ActivityRecord[] outActivity, boolean restrictedBgActivity) {
+ boolean restrictedBgActivity) {
setInitialState(r, options, inTask, doResume, startFlags, sourceRecord, voiceSession,
voiceInteractor, restrictedBgActivity);
@@ -1528,7 +1509,7 @@
final ActivityRecord targetTaskTop = newTask ? null : targetTask.getTopActivity();
if (targetTaskTop != null) {
// Recycle the target task for this launch.
- startResult = recycleTask(targetTask, targetTaskTop, reusedActivity, outActivity);
+ startResult = recycleTask(targetTask, targetTaskTop, reusedActivity);
if (startResult != START_SUCCESS) {
return startResult;
}
@@ -1690,7 +1671,7 @@
* - Determine whether need to add a new activity on top or just brought the task to front.
*/
private int recycleTask(TaskRecord targetTask, ActivityRecord targetTaskTop,
- ActivityRecord reusedActivity, ActivityRecord[] outActivity) {
+ ActivityRecord reusedActivity) {
// True if we are clearing top and resetting of a standard (default) launch mode
// ({@code LAUNCH_MULTIPLE}) activity. The existing activity will be finished.
final boolean clearTopAndResetStandardLaunchMode =
@@ -1729,13 +1710,11 @@
setTargetStackIfNeeded(targetTaskTop);
- final ActivityRecord outResult =
- outActivity != null && outActivity.length > 0 ? outActivity[0] : null;
-
// When there is a reused activity and the current result is a trampoline activity,
// set the reused activity as the result.
- if (outResult != null && (outResult.finishing || outResult.noDisplay)) {
- outActivity[0] = targetTaskTop;
+ if (mLastStartActivityRecord != null
+ && (mLastStartActivityRecord.finishing || mLastStartActivityRecord.noDisplay)) {
+ mLastStartActivityRecord = targetTaskTop;
}
if ((mStartFlags & START_FLAG_ONLY_IF_NEEDED) != 0) {
@@ -1777,12 +1756,11 @@
// We didn't do anything... but it was needed (a.k.a., client don't use that intent!)
// And for paranoia, make sure we have correctly resumed the top activity.
resumeTargetStackIfNeeded();
- if (outActivity != null && outActivity.length > 0) {
- // The reusedActivity could be finishing, for example of starting an activity with
- // FLAG_ACTIVITY_CLEAR_TOP flag. In that case, return the top running activity in the
- // task instead.
- outActivity[0] = targetTaskTop.finishing ? targetTask.getTopActivity() : targetTaskTop;
- }
+ // The reusedActivity could be finishing, for example of starting an activity with
+ // FLAG_ACTIVITY_CLEAR_TOP flag. In that case, return the top running activity in the
+ // task instead.
+ mLastStartActivityRecord =
+ targetTaskTop.finishing ? targetTask.getTopActivity() : targetTaskTop;
return mMovedToFront ? START_TASK_TO_FRONT : START_DELIVERED_TO_TOP;
}
@@ -1864,9 +1842,8 @@
mLaunchFlags);
// The above code can remove {@code reusedActivity} from the task, leading to the
- // the {@code ActivityRecord} removing its reference to the {@code TaskRecord}. The
- // task reference is needed in the call below to
- // {@link setTargetStackAndMoveToFrontIfNeeded}.
+ // {@code ActivityRecord} removing its reference to the {@code TaskRecord}. The task
+ // reference is needed in the call below to {@link setTargetStackAndMoveToFrontIfNeeded}
if (targetTaskTop.getTaskRecord() == null) {
targetTaskTop.setTask(targetTask);
}
@@ -2450,7 +2427,7 @@
private void addOrReparentStartingActivity(TaskRecord parent, String reason) {
if (mStartActivity.getTaskRecord() == null || mStartActivity.getTaskRecord() == parent) {
- parent.addActivityToTop(mStartActivity);
+ parent.addChild(mStartActivity);
} else {
mStartActivity.reparent(parent, parent.getChildCount() /* top */, reason);
}
@@ -2652,12 +2629,6 @@
return this;
}
- ActivityStarter setEphemeralIntent(Intent intent) {
- mRequest.ephemeralIntent = intent;
- return this;
- }
-
-
ActivityStarter setResolvedType(String type) {
mRequest.resolvedType = type;
return this;
@@ -2809,13 +2780,6 @@
return this;
}
- ActivityStarter setMayWait(int userId) {
- mRequest.mayWait = true;
- mRequest.userId = userId;
-
- return this;
- }
-
ActivityStarter setAllowPendingRemoteAnimationRegistryLookup(boolean allowLookup) {
mRequest.allowPendingRemoteAnimationRegistryLookup = allowLookup;
return this;
@@ -2845,11 +2809,10 @@
pw.print(prefix);
pw.print("mLastStartActivityResult=");
pw.println(mLastStartActivityResult);
- ActivityRecord r = mLastStartActivityRecord[0];
- if (r != null) {
+ if (mLastStartActivityRecord != null) {
pw.print(prefix);
pw.println("mLastStartActivityRecord:");
- r.dump(pw, prefix + " ", true /* dumpAll */);
+ mLastStartActivityRecord.dump(pw, prefix + " ", true /* dumpAll */);
}
if (mStartActivity != null) {
pw.print(prefix);
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 14df505..3da8481 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -54,6 +54,7 @@
import static android.os.Process.SYSTEM_UID;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
+import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RTL;
import static android.provider.Settings.Global.HIDE_ERROR_DIALOGS;
@@ -569,6 +570,7 @@
boolean mSupportsPictureInPicture;
boolean mSupportsMultiDisplay;
boolean mForceResizableActivities;
+ boolean mSizeCompatFreeform;
final List<ActivityTaskManagerInternal.ScreenObserver> mScreenObservers = new ArrayList<>();
@@ -744,6 +746,8 @@
final boolean forceRtl = Settings.Global.getInt(resolver, DEVELOPMENT_FORCE_RTL, 0) != 0;
final boolean forceResizable = Settings.Global.getInt(
resolver, DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, 0) != 0;
+ final boolean sizeCompatFreeform = Settings.Global.getInt(
+ resolver, DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, 0) != 0;
// Transfer any global setting for forcing RTL layout, into a System Property
DisplayProperties.debug_force_rtl(forceRtl);
@@ -757,6 +761,7 @@
synchronized (mGlobalLock) {
mForceResizableActivities = forceResizable;
+ mSizeCompatFreeform = sizeCompatFreeform;
final boolean multiWindowFormEnabled = freeformWindowManagement
|| supportsSplitScreenMultiWindow
|| supportsPictureInPicture
@@ -1056,7 +1061,7 @@
.setStartFlags(startFlags)
.setProfilerInfo(profilerInfo)
.setActivityOptions(bOptions)
- .setMayWait(userId)
+ .setUserId(userId)
.execute();
}
@@ -1227,7 +1232,7 @@
.setRequestCode(requestCode)
.setStartFlags(startFlags)
.setActivityOptions(bOptions)
- .setMayWait(userId)
+ .setUserId(userId)
.setProfilerInfo(profilerInfo)
.setWaitResult(res)
.execute();
@@ -1254,7 +1259,7 @@
.setStartFlags(startFlags)
.setGlobalConfiguration(config)
.setActivityOptions(bOptions)
- .setMayWait(userId)
+ .setUserId(userId)
.execute();
}
}
@@ -1384,7 +1389,7 @@
.setRequestCode(requestCode)
.setStartFlags(startFlags)
.setActivityOptions(bOptions)
- .setMayWait(userId)
+ .setUserId(userId)
.setIgnoreTargetSecurity(ignoreTargetSecurity)
.setFilterCallingUid(isResolver ? 0 /* system */ : targetUid)
// The target may well be in the background, which would normally prevent it
@@ -1432,7 +1437,7 @@
.setStartFlags(startFlags)
.setProfilerInfo(profilerInfo)
.setActivityOptions(bOptions)
- .setMayWait(userId)
+ .setUserId(userId)
.setAllowBackgroundActivityStart(true)
.execute();
}
@@ -1448,7 +1453,7 @@
.setCallingPackage(callingPackage)
.setResolvedType(resolvedType)
.setActivityOptions(bOptions)
- .setMayWait(userId)
+ .setUserId(userId)
.setAllowBackgroundActivityStart(true)
.execute();
}
@@ -3393,6 +3398,9 @@
if (stack.inFreeformWindowingMode()) {
stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
+ } else if (!mSizeCompatFreeform) {
+ throw new IllegalStateException("Size-compat windows are currently not"
+ + "freeform-enabled");
} else if (stack.getParent().inFreeformWindowingMode()) {
// If the window is on a freeform display, set it to undefined. It will be
// resolved to freeform and it can adjust windowing mode when the display mode
diff --git a/services/core/java/com/android/server/wm/AppTaskImpl.java b/services/core/java/com/android/server/wm/AppTaskImpl.java
index 1eb7455..c5e190d 100644
--- a/services/core/java/com/android/server/wm/AppTaskImpl.java
+++ b/services/core/java/com/android/server/wm/AppTaskImpl.java
@@ -155,7 +155,7 @@
.setCallingPackage(callingPackage)
.setResolvedType(resolvedType)
.setActivityOptions(bOptions)
- .setMayWait(callingUser)
+ .setUserId(callingUser)
.setInTask(tr)
.execute();
}
diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java
index 300ee1d..70d5ab9 100644
--- a/services/core/java/com/android/server/wm/ConfigurationContainer.java
+++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java
@@ -540,7 +540,7 @@
return sameWindowingMode;
}
- public void registerConfigurationChangeListener(ConfigurationContainerListener listener) {
+ void registerConfigurationChangeListener(ConfigurationContainerListener listener) {
if (mChangeListeners.contains(listener)) {
return;
}
@@ -548,7 +548,7 @@
listener.onRequestedOverrideConfigurationChanged(mResolvedOverrideConfiguration);
}
- public void unregisterConfigurationChangeListener(ConfigurationContainerListener listener) {
+ void unregisterConfigurationChangeListener(ConfigurationContainerListener listener) {
mChangeListeners.remove(listener);
}
@@ -560,13 +560,12 @@
/**
* Must be called when new parent for the container was set.
*/
- void onParentChanged() {
- final ConfigurationContainer parent = getParent();
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
// Removing parent usually means that we've detached this entity to destroy it or to attach
// to another parent. In both cases we don't need to update the configuration now.
- if (parent != null) {
+ if (newParent != null) {
// Update full configuration of this container and all its children.
- onConfigurationChanged(parent.mFullConfiguration);
+ onConfigurationChanged(newParent.mFullConfiguration);
// Update merged override configuration of this container and all its children.
onMergedOverrideConfigurationChanged();
}
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index aa0b68b..2d1d297 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -4359,9 +4359,9 @@
}
@Override
- void onParentChanged() {
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
if (getParent() != null) {
- super.onParentChanged(() -> {
+ super.onParentChanged(newParent, oldParent, () -> {
mAppAnimationLayer = makeChildSurface(null)
.setName("animationLayer")
.build();
@@ -4381,7 +4381,7 @@
.show(mSplitScreenDividerAnchor);
});
} else {
- super.onParentChanged();
+ super.onParentChanged(newParent, oldParent);
mWmService.mTransactionFactory.get()
.remove(mAppAnimationLayer)
.remove(mBoostedAppAnimationLayer)
@@ -4611,7 +4611,7 @@
}
@Override
- void onParentChanged() {
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
// Since we are the top of the SurfaceControl hierarchy here
// we create the root surfaces explicitly rather than chaining
// up as the default implementation in onParentChanged does. So we
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 208f54c..a783ee9 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -876,6 +876,8 @@
if (canToastShowWhenLocked(callingPid)) {
attrs.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
}
+ // Toasts can't be clickable
+ attrs.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
break;
}
@@ -3241,7 +3243,8 @@
statusBar.topAppWindowChanged(displayId, isFullscreen, isImmersive);
// TODO(b/118118435): Remove this after removing system UI visibilities.
- mDisplayContent.statusBarVisibilityChanged(visibility);
+ mDisplayContent.statusBarVisibilityChanged(
+ visibility & ~(View.STATUS_BAR_UNHIDE | View.NAVIGATION_BAR_UNHIDE));
}
});
return diff;
diff --git a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java
index bc95481..11f09d0 100644
--- a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java
+++ b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java
@@ -56,8 +56,6 @@
if (mIsImeLayoutDrawn && mShowImeRunner != null) {
// Show IME if InputMethodService requested to be shown and it's layout has finished.
mShowImeRunner.run();
- mIsImeLayoutDrawn = false;
- mShowImeRunner = null;
}
}
@@ -74,10 +72,19 @@
mDisplayContent.mInputMethodTarget.showInsets(
WindowInsets.Type.ime(), true /* fromIme */);
}
- mImeTargetFromIme = null;
+ abortShowImePostLayout();
};
}
+ /**
+ * Abort any pending request to show IME post layout.
+ */
+ void abortShowImePostLayout() {
+ mImeTargetFromIme = null;
+ mIsImeLayoutDrawn = false;
+ mShowImeRunner = null;
+ }
+
private boolean isImeTargetFromDisplayContentAndImeSame() {
// IMMS#mLastImeTargetWindow always considers focused window as
// IME target, however DisplayContent#computeImeTarget() can compute
diff --git a/services/core/java/com/android/server/wm/PolicyControl.java b/services/core/java/com/android/server/wm/PolicyControl.java
index 4c8ce9e..0f92bc8 100644
--- a/services/core/java/com/android/server/wm/PolicyControl.java
+++ b/services/core/java/com/android/server/wm/PolicyControl.java
@@ -26,6 +26,8 @@
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
+import com.android.internal.annotations.VisibleForTesting;
+
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -51,7 +53,8 @@
private static final String TAG = "PolicyControl";
private static final boolean DEBUG = false;
- private static final String NAME_IMMERSIVE_FULL = "immersive.full";
+ @VisibleForTesting
+ static final String NAME_IMMERSIVE_FULL = "immersive.full";
private static final String NAME_IMMERSIVE_STATUS = "immersive.status";
private static final String NAME_IMMERSIVE_NAVIGATION = "immersive.navigation";
private static final String NAME_IMMERSIVE_PRECONFIRMATIONS = "immersive.preconfirms";
@@ -67,15 +70,19 @@
: (attrs.systemUiVisibility | attrs.subtreeSystemUiVisibility);
if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(attrs)) {
vis |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
+ | View.SYSTEM_UI_FLAG_FULLSCREEN;
+ if (attrs.isFullscreen()) {
+ vis |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
+ }
vis &= ~(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.STATUS_BAR_TRANSLUCENT);
}
if (sImmersiveNavigationFilter != null && sImmersiveNavigationFilter.matches(attrs)) {
vis |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+ if (attrs.isFullscreen()) {
+ vis |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+ }
vis &= ~(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.NAVIGATION_BAR_TRANSLUCENT);
}
@@ -144,7 +151,8 @@
}
}
- private static void setFilters(String value) {
+ @VisibleForTesting
+ static void setFilters(String value) {
if (DEBUG) Slog.d(TAG, "setFilters: " + value);
sImmersiveStatusFilter = null;
sImmersiveNavigationFilter = null;
diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java
index 12579e6..2dae126 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimation.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimation.java
@@ -247,7 +247,7 @@
"startRecentsActivity");
mWindowManager.initializeRecentsAnimation(mTargetActivityType, recentsAnimationRunner,
this, mDefaultDisplay.mDisplayId,
- mStackSupervisor.mRecentTasks.getRecentTaskIds());
+ mStackSupervisor.mRecentTasks.getRecentTaskIds(), targetActivity);
// If we updated the launch-behind state, update the visibility of the activities after
// we fetch the visible tasks to be controlled by the animation
@@ -452,7 +452,7 @@
.setCallingUid(mRecentsUid)
.setCallingPackage(mRecentsComponent.getPackageName())
.setActivityOptions(new SafeActivityOptions(options))
- .setMayWait(mUserId)
+ .setUserId(mUserId)
.execute();
}
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 9a58a68..7a3e43b 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -358,7 +358,8 @@
* because it may call cancelAnimation() which needs to properly clean up the controller
* in the window manager.
*/
- public void initialize(int targetActivityType, SparseBooleanArray recentTaskIds) {
+ public void initialize(int targetActivityType, SparseBooleanArray recentTaskIds,
+ ActivityRecord targetActivity) {
mTargetActivityType = targetActivityType;
mDisplayContent.mAppTransition.registerListenerLocked(mAppTransitionListener);
@@ -400,16 +401,12 @@
}
// Adjust the wallpaper visibility for the showing target activity
- final ActivityRecord recentsComponentActivity =
- targetStack.getTopChild().getTopFullscreenActivity();
- if (recentsComponentActivity != null) {
- ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
- "setHomeApp(%s)", recentsComponentActivity.getName());
- mTargetActivityRecord = recentsComponentActivity;
- if (recentsComponentActivity.windowsCanBeWallpaperTarget()) {
- mDisplayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
- mDisplayContent.setLayoutNeeded();
- }
+ ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
+ "setHomeApp(%s)", targetActivity.getName());
+ mTargetActivityRecord = targetActivity;
+ if (targetActivity.windowsCanBeWallpaperTarget()) {
+ mDisplayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
+ mDisplayContent.setLayoutNeeded();
}
// Save the minimized home height
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 1db3149f..bf7dd57 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -67,7 +67,6 @@
final int mTaskId;
/* User for which this task was created. */
final int mUserId;
- private boolean mDeferRemoval = false;
final Rect mPreparedFrozenBounds = new Rect();
final Configuration mPreparedFrozenMergedConfig = new Configuration();
@@ -176,14 +175,18 @@
void addChild(ActivityRecord child, int position) {
position = getAdjustedAddPosition(position);
super.addChild(child, position);
- mDeferRemoval = false;
+
+ // Inform the TaskRecord side of the child addition
+ // TODO(task-unify): Will be removed after task unification.
+ if (mTaskRecord != null) {
+ mTaskRecord.onChildAdded(child, position);
+ }
}
@Override
void positionChildAt(int position, ActivityRecord child, boolean includingParents) {
position = getAdjustedAddPosition(position);
super.positionChildAt(position, child, includingParents);
- mDeferRemoval = false;
}
private boolean hasWindowsAlive() {
@@ -197,8 +200,10 @@
@VisibleForTesting
boolean shouldDeferRemoval() {
- // TODO: This should probably return false if mChildren.isEmpty() regardless if the stack
- // is animating...
+ if (mChildren.isEmpty()) {
+ // No reason to defer removal of a Task that doesn't have any child.
+ return false;
+ }
return hasWindowsAlive() && mStack.isSelfOrChildAnimating();
}
@@ -206,7 +211,6 @@
void removeIfPossible() {
if (shouldDeferRemoval()) {
if (DEBUG_STACK) Slog.i(TAG, "removeTask: deferring removing taskId=" + mTaskId);
- mDeferRemoval = true;
return;
}
removeImmediately();
@@ -216,7 +220,6 @@
void removeImmediately() {
if (DEBUG_STACK) Slog.i(TAG, "removeTask: removing taskId=" + mTaskId);
EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "removeTask");
- mDeferRemoval = false;
if (mTaskRecord != null) {
mTaskRecord.unregisterConfigurationChangeListener(this);
}
@@ -266,8 +269,8 @@
}
@Override
- void onParentChanged() {
- super.onParentChanged();
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
+ super.onParentChanged(newParent, oldParent);
// Update task bounds if needed.
adjustBoundsForDisplayChangeIfNeeded(getDisplayContent());
@@ -290,11 +293,18 @@
super.removeChild(child);
+ // Inform the TaskRecord side of the child removal
+ // TODO(task-unify): Will be removed after task unification.
+ if (mTaskRecord != null) {
+ mTaskRecord.onChildRemoved(child);
+ }
+
+ // TODO(task-unify): Need to make this account for what we are doing in
+ // ActivityRecord.removeFromHistory so that the task isn't removed in some situations when
+ // we unify task level.
if (mChildren.isEmpty()) {
EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "removeActivity: last activity");
- if (mDeferRemoval) {
- removeIfPossible();
- }
+ removeIfPossible();
}
}
@@ -745,7 +755,7 @@
@Override
public String toString() {
- return "{taskId=" + mTaskId + " appTokens=" + mChildren + " mdr=" + mDeferRemoval + "}";
+ return "{taskId=" + mTaskId + " appTokens=" + mChildren + "}";
}
String getName() {
@@ -792,7 +802,6 @@
proto.write(FILLS_PARENT, matchParentBounds());
getBounds().writeToProto(proto, BOUNDS);
mOverrideDisplayedBounds.writeToProto(proto, DISPLAYED_BOUNDS);
- proto.write(DEFER_REMOVAL, mDeferRemoval);
proto.write(SURFACE_WIDTH, mSurfaceControl.getWidth());
proto.write(SURFACE_HEIGHT, mSurfaceControl.getHeight());
proto.end(token);
@@ -805,7 +814,6 @@
pw.println(prefix + "taskId=" + mTaskId);
pw.println(doublePrefix + "mBounds=" + getBounds().toShortString());
- pw.println(doublePrefix + "mdr=" + mDeferRemoval);
pw.println(doublePrefix + "appTokens=" + mChildren);
pw.println(doublePrefix + "mDisplayedBounds=" + mOverrideDisplayedBounds.toShortString());
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index 9712277..31145de 100644
--- a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
@@ -43,10 +43,8 @@
import android.app.ActivityOptions;
import android.app.WindowConfiguration;
import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
-import android.os.Build;
import android.util.Slog;
import android.view.Gravity;
import android.view.View;
@@ -65,15 +63,6 @@
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskLaunchParamsModifier" : TAG_ATM;
private static final boolean DEBUG = false;
- // A mask for SUPPORTS_SCREEN that indicates the activity supports resize.
- private static final int SUPPORTS_SCREEN_RESIZEABLE_MASK =
- ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES
- | ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS
- | ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS
- | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS
- | ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES
- | ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS;
-
// Screen size of Nexus 5x
private static final int DEFAULT_PORTRAIT_PHONE_WIDTH_DP = 412;
private static final int DEFAULT_PORTRAIT_PHONE_HEIGHT_DP = 732;
@@ -253,10 +242,9 @@
if (display.inFreeformWindowingMode()) {
if (launchMode == WINDOWING_MODE_PINNED) {
if (DEBUG) appendLog("picture-in-picture");
- } else if (isTaskForcedMaximized(root)) {
- // We're launching an activity that probably can't handle resizing nicely, so force
- // it to be maximized even someone suggests launching it in freeform using launch
- // options.
+ } else if (!mSupervisor.mService.mSizeCompatFreeform && !root.isResizeable()) {
+ // We're launching an activity in size-compat mode and they aren't allowed in
+ // freeform, so force it to be maximized.
launchMode = WINDOWING_MODE_FULLSCREEN;
outParams.mBounds.setEmpty();
if (DEBUG) appendLog("forced-maximize");
@@ -460,28 +448,6 @@
}
/**
- * Returns if task is forced to maximize.
- *
- * There are several cases where we force a task to maximize:
- * 1) Root activity is targeting pre-Donut, which by default can't handle multiple screen
- * densities, so resizing will likely cause issues;
- * 2) Root activity doesn't declare any flag that it supports any screen density, so resizing
- * may also cause issues;
- * 3) Root activity is not resizeable, for which we shouldn't allow user resize it.
- *
- * @param root the root activity to check against.
- * @return {@code true} if it should be forced to maximize; {@code false} otherwise.
- */
- private boolean isTaskForcedMaximized(@NonNull ActivityRecord root) {
- if (root.info.applicationInfo.targetSdkVersion < Build.VERSION_CODES.DONUT
- || (root.info.applicationInfo.flags & SUPPORTS_SCREEN_RESIZEABLE_MASK) == 0) {
- return true;
- }
-
- return !root.isResizeable();
- }
-
- /**
* Resolves activity requested orientation to 4 categories:
* 1) {@link ActivityInfo#SCREEN_ORIENTATION_LOCKED} indicating app wants to lock down
* orientation;
diff --git a/services/core/java/com/android/server/wm/TaskPositioningController.java b/services/core/java/com/android/server/wm/TaskPositioningController.java
index ed07f30..e1123fa 100644
--- a/services/core/java/com/android/server/wm/TaskPositioningController.java
+++ b/services/core/java/com/android/server/wm/TaskPositioningController.java
@@ -126,6 +126,11 @@
synchronized (mService.mGlobalLock) {
final Task task = displayContent.findTaskForResizePoint(x, y);
if (task != null) {
+ if (!task.isResizeable()) {
+ // The task is not resizable, so don't do anything when the user drags the
+ // the resize handles.
+ return;
+ }
if (!startPositioningLocked(task.getTopVisibleAppMainWindow(), true /*resize*/,
task.preserveOrientationOnResize(), x, y)) {
return;
diff --git a/services/core/java/com/android/server/wm/TaskRecord.java b/services/core/java/com/android/server/wm/TaskRecord.java
index 299b32c..166bd05 100644
--- a/services/core/java/com/android/server/wm/TaskRecord.java
+++ b/services/core/java/com/android/server/wm/TaskRecord.java
@@ -68,13 +68,16 @@
import static com.android.server.am.TaskRecordProto.STACK_ID;
import static com.android.server.wm.ActivityRecord.FINISH_RESULT_REMOVED;
import static com.android.server.wm.ActivityRecord.STARTING_WINDOW_SHOWN;
+import static com.android.server.wm.ActivityStack.REMOVE_TASK_MODE_DESTROYING;
import static com.android.server.wm.ActivityStack.REMOVE_TASK_MODE_MOVING;
import static com.android.server.wm.ActivityStack.REMOVE_TASK_MODE_MOVING_TO_TOP;
import static com.android.server.wm.ActivityStackSupervisor.ON_TOP;
import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS;
+import static com.android.server.wm.ActivityStackSupervisor.REMOVE_FROM_RECENTS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_LOCKTASK;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_RECENTS;
+import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_STATES;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_TASKS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_ADD_REMOVE;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_LOCKTASK;
@@ -82,6 +85,7 @@
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_TASKS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
+import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowContainer.POSITION_BOTTOM;
import static com.android.server.wm.WindowContainer.POSITION_TOP;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
@@ -126,6 +130,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.util.XmlUtils;
+import com.android.server.protolog.common.ProtoLog;
import com.android.server.wm.ActivityStack.ActivityState;
import org.xmlpull.v1.XmlPullParser;
@@ -519,18 +524,7 @@
mAtmService.deferWindowLayout();
try {
- if (!isResizeable()) {
- Slog.w(TAG, "resizeTask: task " + this + " not resizeable.");
- return true;
- }
-
- // If this is a forced resize, let it go through even if the bounds is not changing,
- // as we might need a relayout due to surface size change (to/from fullscreen).
final boolean forced = (resizeMode & RESIZE_MODE_FORCED) != 0;
- if (equivalentRequestedOverrideBounds(bounds) && !forced) {
- // Nothing to do here...
- return true;
- }
if (mTask == null) {
// Task doesn't exist in window manager yet (e.g. was restored from recents).
@@ -980,6 +974,7 @@
* Must be used for setting parent stack because it performs configuration updates.
* Must be called after adding task as a child to the stack.
*/
+ // TODO(task-unify): Remove or rework after task level unification.
void setStack(ActivityStack stack) {
if (stack != null && !stack.isInStackLocked(this)) {
throw new IllegalStateException("Task must be added as a Stack child first.");
@@ -1004,7 +999,7 @@
}
}
- onParentChanged();
+ onParentChanged(mStack, oldStack);
}
/**
@@ -1030,8 +1025,9 @@
}
@Override
- protected void onParentChanged() {
- super.onParentChanged();
+ protected void onParentChanged(
+ ConfigurationContainer newParent, ConfigurationContainer oldParent) {
+ super.onParentChanged(newParent, oldParent);
mAtmService.mRootActivityContainer.updateUIDsPresentOnDisplay();
}
@@ -1226,10 +1222,6 @@
updateEffectiveIntent();
}
- void addActivityToTop(ActivityRecord r) {
- addActivityAtIndex(getChildCount(), r);
- }
-
@Override
/*@WindowConfiguration.ActivityType*/
public int getActivityType() {
@@ -1240,18 +1232,11 @@
return getChildAt(0).getActivityType();
}
- /**
- * Adds an activity {@param r} at the given {@param index}. The activity {@param r} must either
- * be in the current task or unparented to any task.
- */
- void addActivityAtIndex(int index, ActivityRecord r) {
- TaskRecord task = r.getTaskRecord();
- if (task != null && task != this) {
- throw new IllegalArgumentException("Can not add r=" + " to task=" + this
- + " current parent=" + task);
- }
-
- r.setTask(this);
+ /** Called when a Task child is added from the Task.java side. */
+ // TODO(task-unify): Just override addChild to do what is needed when someone calls to add a
+ // child.
+ void onChildAdded(ActivityRecord r, int index) {
+ r.inHistory = true;
// Remove r first, and if it wasn't already in the list and it's fullscreen, count it.
if (!mActivities.remove(r) && r.occludesParent()) {
@@ -1298,34 +1283,34 @@
mAtmService.notifyTaskPersisterLocked(this, false);
}
- if (r.getParent() != null) {
- // Only attempt to move in WM if the child has a controller. It is possible we haven't
- // created controller for the activity we are starting yet.
- mTask.positionChildAt(r, index);
- }
-
// Make sure the list of display UID whitelists is updated
// now that this record is in a new task.
mAtmService.mRootActivityContainer.updateUIDsPresentOnDisplay();
}
- /**
- * Removes the specified activity from this task.
- * @param r The {@link ActivityRecord} to remove.
- * @return true if this was the last activity in the task.
- */
- boolean removeActivity(ActivityRecord r) {
- return removeActivity(r, false /* reparenting */);
- }
-
- boolean removeActivity(ActivityRecord r, boolean reparenting) {
- if (r.getTaskRecord() != this) {
- throw new IllegalArgumentException(
- "Activity=" + r + " does not belong to task=" + this);
+ // TODO(task-unify): Merge onChildAdded method below into this since task will be a single
+ // object.
+ void addChild(ActivityRecord r) {
+ if (r.getParent() != null) {
+ // Shouldn't already have a parent since we are just adding to the task...
+ throw new IllegalStateException(
+ "r=" + r + " parent=" + r.getParent() + " task=" + this);
}
- r.setTask(null /* task */, reparenting /* reparenting */);
+ ProtoLog.v(WM_DEBUG_ADD_REMOVE, "addChild: %s at top.", this);
+ // This means the activity isn't attached to Task.java yet. Go ahead and do that.
+ // TODO(task-unify): Remove/call super once we unify task level.
+ if (mTask != null) {
+ mTask.addChild(r, Integer.MAX_VALUE /* add on top */);
+ } else {
+ onChildAdded(r, Integer.MAX_VALUE);
+ }
+ }
+ /** Called when a Task child is removed from the Task.java side. */
+ // TODO(task-unify): Just override removeChild to do what is needed when someone calls to remove
+ // a child.
+ void onChildRemoved(ActivityRecord r) {
if (mActivities.remove(r) && r.occludesParent()) {
// Was previously in list.
numFullscreen--;
@@ -1341,11 +1326,27 @@
mAtmService.getTaskChangeNotificationController().notifyTaskStackChanged();
}
- if (!hasChild()) {
- return !mReuseTask;
+ if (hasChild()) {
+ updateEffectiveIntent();
+
+ // The following block can be executed multiple times if there is more than one overlay.
+ // {@link ActivityStackSupervisor#removeTaskByIdLocked} handles this by reverse lookup
+ // of the task by id and exiting early if not found.
+ if (onlyHasTaskOverlayActivities(false /* excludingFinishing */)) {
+ // When destroying a task, tell the supervisor to remove it so that any activity it
+ // has can be cleaned up correctly. This is currently the only place where we remove
+ // a task with the DESTROYING mode, so instead of passing the onlyHasTaskOverlays
+ // state into removeTask(), we just clear the task here before the other residual
+ // work.
+ // TODO: If the callers to removeTask() changes such that we have multiple places
+ // where we are destroying the task, move this back into removeTask()
+ mAtmService.mStackSupervisor.removeTaskByIdLocked(mTaskId, false /* killProcess */,
+ !REMOVE_FROM_RECENTS, "onChildRemoved");
+ }
+ } else if (!mReuseTask) {
+ // Remove entire task if it doesn't have any activity left and it isn't marked for reuse
+ mStack.removeTask(this, "onChildRemoved", REMOVE_TASK_MODE_DESTROYING);
}
- updateEffectiveIntent();
- return false;
}
/**
@@ -2065,7 +2066,10 @@
} else {
// Apply the given non-decor and stable insets to calculate the corresponding bounds
// for screen size of configuration.
- final int rotation = parentConfig.windowConfiguration.getRotation();
+ int rotation = inOutConfig.windowConfiguration.getRotation();
+ if (rotation == ROTATION_UNDEFINED) {
+ rotation = parentConfig.windowConfiguration.getRotation();
+ }
if (rotation != ROTATION_UNDEFINED && compatInsets != null) {
mTmpNonDecorBounds.set(bounds);
mTmpStableBounds.set(bounds);
@@ -2379,14 +2383,14 @@
if (intent != null) {
StringBuilder sb = new StringBuilder(128);
sb.append(prefix); sb.append("intent={");
- intent.toShortString(sb, false, true, false, true);
+ intent.toShortString(sb, false, true, false, false);
sb.append('}');
pw.println(sb.toString());
}
if (affinityIntent != null) {
StringBuilder sb = new StringBuilder(128);
sb.append(prefix); sb.append("affinityIntent={");
- affinityIntent.toShortString(sb, false, true, false, true);
+ affinityIntent.toShortString(sb, false, true, false, false);
sb.append('}');
pw.println(sb.toString());
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index fc9a110..3552245 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -950,8 +950,8 @@
}
@Override
- void onParentChanged() {
- super.onParentChanged();
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
+ super.onParentChanged(newParent, oldParent);
if (getParent() != null || mDisplayContent == null) {
return;
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index 037edf1..a620a7c 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -106,6 +106,10 @@
*/
private WindowContainer<WindowContainer> mParent = null;
+ // Set to true when we are performing a reparenting operation so we only send one
+ // onParentChanged() notification.
+ private boolean mReparenting;
+
// List of children for this window container. List is in z-order as the children appear on
// screen with the top-most window container at the tail of the list.
protected final WindowList<E> mChildren = new WindowList<E>();
@@ -187,9 +191,45 @@
scheduleAnimation();
}
+ void reparent(WindowContainer newParent, int position) {
+ if (newParent == null) {
+ throw new IllegalArgumentException("reparent: can't reparent to null " + this);
+ }
+
+ final WindowContainer oldParent = mParent;
+ if (mParent == newParent) {
+ throw new IllegalArgumentException("WC=" + this + " already child of " + mParent);
+ }
+
+ // The display object before reparenting as that might lead to old parent getting removed
+ // from the display if it no longer has any child.
+ final DisplayContent prevDc = oldParent.getDisplayContent();
+ final DisplayContent dc = newParent.getDisplayContent();
+
+ mReparenting = true;
+ oldParent.removeChild(this);
+ newParent.addChild(this, position);
+ mReparenting = false;
+
+ // Send onParentChanged notification here is we disabled sending it in setParent for
+ // reparenting case.
+ onParentChanged(newParent, oldParent);
+
+ // Relayout display(s)
+ dc.setLayoutNeeded();
+ if (prevDc != dc) {
+ onDisplayChanged(dc);
+ prevDc.setLayoutNeeded();
+ }
+ getDisplayContent().layoutAndAssignWindowLayersIfNeeded();
+ }
+
final protected void setParent(WindowContainer<WindowContainer> parent) {
+ final WindowContainer oldParent = mParent;
mParent = parent;
- onParentChanged();
+ if (!mReparenting) {
+ onParentChanged(mParent, oldParent);
+ }
}
/**
@@ -197,12 +237,13 @@
* Supposed to be overridden and contain actions that should be executed after parent was set.
*/
@Override
- void onParentChanged() {
- onParentChanged(null);
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
+ onParentChanged(newParent, oldParent, null);
}
- void onParentChanged(PreAssignChildLayersCallback callback) {
- super.onParentChanged();
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent,
+ PreAssignChildLayersCallback callback) {
+ super.onParentChanged(newParent, oldParent);
if (mParent == null) {
return;
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java
index 0cb4826..d224972 100644
--- a/services/core/java/com/android/server/wm/WindowManagerInternal.java
+++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java
@@ -216,7 +216,7 @@
*
* @param displayId The logical display id.
* @param callbacks The callbacks to invoke.
- * @return {@code false} if display id is not valid.
+ * @return {@code false} if display id is not valid or an embedded display.
*/
public abstract boolean setMagnificationCallbacks(int displayId,
@Nullable MagnificationCallbacks callbacks);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index e90f3da..085b0f6 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -39,6 +39,7 @@
import static android.provider.DeviceConfig.WindowManager.KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP;
import static android.provider.DeviceConfig.WindowManager.KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
+import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
import static android.view.Display.DEFAULT_DISPLAY;
@@ -717,6 +718,8 @@
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT);
private final Uri mForceResizableUri = Settings.Global.getUriFor(
DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
+ private final Uri mSizeCompatFreeformUri = Settings.Global.getUriFor(
+ DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM);
public SettingsObserver() {
super(new Handler());
@@ -737,6 +740,8 @@
UserHandle.USER_ALL);
resolver.registerContentObserver(mFreeformWindowUri, false, this, UserHandle.USER_ALL);
resolver.registerContentObserver(mForceResizableUri, false, this, UserHandle.USER_ALL);
+ resolver.registerContentObserver(mSizeCompatFreeformUri, false, this,
+ UserHandle.USER_ALL);
}
@Override
@@ -775,6 +780,11 @@
return;
}
+ if (mSizeCompatFreeformUri.equals(uri)) {
+ updateSizeCompatFreeform();
+ return;
+ }
+
@UpdateAnimationScaleMode
final int mode;
if (mWindowAnimationScaleUri.equals(uri)) {
@@ -844,6 +854,14 @@
mAtmService.mForceResizableActivities = forceResizable;
}
+
+ void updateSizeCompatFreeform() {
+ ContentResolver resolver = mContext.getContentResolver();
+ final boolean sizeCompatFreeform = Settings.Global.getInt(resolver,
+ DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, 0) != 0;
+
+ mAtmService.mSizeCompatFreeform = sizeCompatFreeform;
+ }
}
PowerManager mPowerManager;
@@ -2652,11 +2670,11 @@
void initializeRecentsAnimation(int targetActivityType,
IRecentsAnimationRunner recentsAnimationRunner,
RecentsAnimationController.RecentsAnimationCallbacks callbacks, int displayId,
- SparseBooleanArray recentTaskIds) {
+ SparseBooleanArray recentTaskIds, ActivityRecord targetActivity) {
mRecentsAnimationController = new RecentsAnimationController(this, recentsAnimationRunner,
callbacks, displayId);
mRoot.getDisplayContent(displayId).mAppTransition.updateBooster();
- mRecentsAnimationController.initialize(targetActivityType, recentTaskIds);
+ mRecentsAnimationController.initialize(targetActivityType, recentTaskIds, targetActivity);
}
@VisibleForTesting
@@ -7331,6 +7349,9 @@
synchronized (mGlobalLock) {
final DisplayContent dc = mRoot.getDisplayContent(displayId);
if (dc != null && dc.mInputMethodTarget != null) {
+ // If there was a pending IME show(), reset it as IME has been
+ // requested to be hidden.
+ dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
dc.mInputMethodTarget.hideInsets(WindowInsets.Type.ime(), true /* fromIme */);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index b9cf29a..f0ea13d 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -868,8 +868,8 @@
}
@Override
- void onParentChanged() {
- super.onParentChanged();
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
+ super.onParentChanged(newParent, oldParent);
setDrawnStateEvaluated(false /*evaluated*/);
getDisplayContent().reapplyMagnificationSpec();
@@ -2319,29 +2319,6 @@
final Region region = inputWindowHandle.touchableRegion;
setTouchableRegionCropIfNeeded(inputWindowHandle);
- final Rect appOverrideBounds = mActivityRecord != null
- ? mActivityRecord.getResolvedOverrideBounds() : null;
- if (appOverrideBounds != null && !appOverrideBounds.isEmpty()) {
- // There may have touchable letterboxes around the activity, so in order to let the
- // letterboxes are able to receive touch event and slip to activity, the activity with
- // compatibility bounds cannot occupy full screen touchable region.
- if (modal) {
- // A modal window uses the whole compatibility bounds.
- flags |= FLAG_NOT_TOUCH_MODAL;
- mTmpRect.set(0, 0, appOverrideBounds.width(), appOverrideBounds.height());
- } else {
- // Non-modal uses the application based frame.
- mTmpRect.set(mWindowFrames.mCompatFrame);
- }
- // The offset of compatibility bounds is applied to surface of {@link #ActivityRecord}
- // and frame, so it is unnecessary to translate twice in surface based coordinates.
- final int surfaceOffsetX = mActivityRecord.hasSizeCompatBounds()
- ? mActivityRecord.getBounds().left : 0;
- mTmpRect.offset(surfaceOffsetX - mWindowFrames.mFrame.left, -mWindowFrames.mFrame.top);
- region.set(mTmpRect);
- return flags;
- }
-
if (modal && mActivityRecord != null) {
// Limit the outer touch to the activity stack region.
flags |= FLAG_NOT_TOUCH_MODAL;
@@ -2398,6 +2375,15 @@
// Translate to surface based coordinates.
region.translate(-mWindowFrames.mFrame.left, -mWindowFrames.mFrame.top);
+ // TODO(b/139804591): sizecompat layout needs to be reworked. Currently mFrame is post-
+ // scaling but the existing logic doesn't expect that. The result is that the already-
+ // scaled region ends up getting sent to surfaceflinger which then applies the scale
+ // (again). Until this is resolved, apply an inverse-scale here.
+ if (mActivityRecord != null && mActivityRecord.hasSizeCompatBounds()
+ && mGlobalScale != 1.f) {
+ region.scale(mInvGlobalScale);
+ }
+
return flags;
}
diff --git a/services/core/jni/com_android_server_VibratorService.cpp b/services/core/jni/com_android_server_VibratorService.cpp
index a8c7682..64c7935 100644
--- a/services/core/jni/com_android_server_VibratorService.cpp
+++ b/services/core/jni/com_android_server_VibratorService.cpp
@@ -190,7 +190,7 @@
}
}
-static jlong vibratorPerformEffect(JNIEnv* env, jclass, jlong effect, jint strength,
+static jlong vibratorPerformEffect(JNIEnv* env, jclass, jlong effect, jlong strength,
jobject vibration) {
Status status;
uint32_t lengthMs;
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
index 59996cc..5a1d552 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
@@ -62,4 +62,6 @@
String packageName, boolean hasGrant) {
return false;
}
+
+ public void setLocationEnabled(ComponentName who, boolean locationEnabled) {}
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java b/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java
index 4a456f7..aa38880 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java
@@ -17,7 +17,6 @@
package com.android.server.devicepolicy;
import android.app.Notification;
-import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -26,12 +25,9 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
-import android.graphics.Color;
-import android.os.Build;
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.os.UserManager;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.security.Credentials;
@@ -39,9 +35,9 @@
import android.security.KeyChain.KeyChainConnection;
import android.util.Log;
+import com.android.internal.R;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
-import com.android.internal.R;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -49,7 +45,6 @@
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.List;
-import java.util.Set;
public class CertificateMonitor {
protected static final String LOG_TAG = DevicePolicyManagerService.LOG_TAG;
@@ -111,13 +106,13 @@
}
}
- public List<String> getInstalledCaCertificates(UserHandle userHandle)
+ private List<String> getInstalledCaCertificates(UserHandle userHandle)
throws RemoteException, RuntimeException {
try (KeyChainConnection conn = mInjector.keyChainBindAsUser(userHandle)) {
return conn.getService().getUserCaAliases().getList();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- return null;
+ throw new RuntimeException(e);
} catch (AssertionError e) {
throw new RuntimeException(e);
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index c4adc035..5e49c7a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -168,6 +168,7 @@
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Color;
+import android.location.LocationManager;
import android.media.AudioManager;
import android.media.IAudioService;
import android.net.ConnectivityManager;
@@ -1959,6 +1960,10 @@
return mContext.getSystemService(ConnectivityManager.class);
}
+ LocationManager getLocationManager() {
+ return mContext.getSystemService(LocationManager.class);
+ }
+
IWindowManager getIWindowManager() {
return IWindowManager.Stub
.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
@@ -4178,7 +4183,7 @@
private boolean passwordQualityInvocationOrderCheckEnabled(String packageName, int userId) {
try {
return mIPlatformCompat.isChangeEnabledByPackageName(ADMIN_APP_PASSWORD_COMPLEXITY,
- packageName);
+ packageName, userId);
} catch (RemoteException e) {
Log.e(LOG_TAG, "Failed to get a response from PLATFORM_COMPAT_SERVICE", e);
}
@@ -10899,6 +10904,36 @@
}
@Override
+ public void setLocationEnabled(ComponentName who, boolean locationEnabled) {
+ Preconditions.checkNotNull(who, "ComponentName is null");
+ int userId = mInjector.userHandleGetCallingUserId();
+
+ synchronized (getLockObject()) {
+ getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
+
+ if (!isDeviceOwner(who, userId) && !isCurrentUserDemo()) {
+ throw new SecurityException(
+ "Permission denial: Profile owners cannot update location settings");
+ }
+ }
+
+ long ident = mInjector.binderClearCallingIdentity();
+ try {
+ mInjector.getLocationManager().setLocationEnabledForUser(
+ locationEnabled, UserHandle.of(userId));
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_SECURE_SETTING)
+ .setAdmin(who)
+ .setStrings(Settings.Secure.LOCATION_MODE, Integer.toString(
+ locationEnabled ? Settings.Secure.LOCATION_MODE_ON
+ : Settings.Secure.LOCATION_MODE_OFF))
+ .write();
+ } finally {
+ mInjector.binderRestoreCallingIdentity(ident);
+ }
+ }
+
+ @Override
public boolean setTime(ComponentName who, long millis) {
Preconditions.checkNotNull(who, "ComponentName is null in setTime");
enforceDeviceOwner(who);
diff --git a/services/net/Android.bp b/services/net/Android.bp
index 1ca96ed..2ab8189 100644
--- a/services/net/Android.bp
+++ b/services/net/Android.bp
@@ -1,10 +1,14 @@
java_library_static {
name: "services.net",
- srcs: ["java/**/*.java"],
+ srcs: [
+ ":tethering-services-srcs",
+ "java/**/*.java",
+ ],
static_libs: [
"dnsresolver_aidl_interface-V2-java",
- "netd_aidl_interface-java",
+ "netd_aidl_interface-unstable-java",
"networkstack-client",
+ "tethering-client",
],
}
@@ -17,3 +21,17 @@
"java/android/net/netlink/*.java",
],
}
+
+filegroup {
+ name: "services-tethering-shared-srcs",
+ srcs: [
+ ":framework-annotations",
+ "java/android/net/ConnectivityModuleConnector.java",
+ "java/android/net/NetworkStackClient.java",
+ "java/android/net/ip/InterfaceController.java",
+ "java/android/net/util/InterfaceParams.java",
+ "java/android/net/util/NetdService.java",
+ "java/android/net/util/NetworkConstants.java",
+ "java/android/net/util/SharedLog.java"
+ ],
+}
diff --git a/services/net/java/android/net/netlink/InetDiagMessage.java b/services/net/java/android/net/netlink/InetDiagMessage.java
index 31a2556..ca07630 100644
--- a/services/net/java/android/net/netlink/InetDiagMessage.java
+++ b/services/net/java/android/net/netlink/InetDiagMessage.java
@@ -26,6 +26,7 @@
import static android.system.OsConstants.IPPROTO_UDP;
import static android.system.OsConstants.NETLINK_INET_DIAG;
+import android.annotation.Nullable;
import android.net.util.SocketUtils;
import android.system.ErrnoException;
import android.util.Log;
@@ -53,7 +54,35 @@
private static final int TIMEOUT_MS = 500;
public static byte[] InetDiagReqV2(int protocol, InetSocketAddress local,
- InetSocketAddress remote, int family, short flags) {
+ InetSocketAddress remote, int family, short flags) {
+ return InetDiagReqV2(protocol, local, remote, family, flags, 0 /* pad */,
+ 0 /* idiagExt */, StructInetDiagReqV2.INET_DIAG_REQ_V2_ALL_STATES);
+ }
+
+ /**
+ * Construct an inet_diag_req_v2 message. This method will throw {@code NullPointerException}
+ * if local and remote are not both null or both non-null.
+ *
+ * @param protocol the request protocol type. This should be set to one of IPPROTO_TCP,
+ * IPPROTO_UDP, or IPPROTO_UDPLITE.
+ * @param local local socket address of the target socket. This will be packed into a
+ * {@Code StructInetDiagSockId}. Request to diagnose for all sockets if both of
+ * local or remote address is null.
+ * @param remote remote socket address of the target socket. This will be packed into a
+ * {@Code StructInetDiagSockId}. Request to diagnose for all sockets if both of
+ * local or remote address is null.
+ * @param family the ip family of the request message. This should be set to either AF_INET or
+ * AF_INET6 for IPv4 or IPv6 sockets respectively.
+ * @param flags message flags. See <linux_src>/include/uapi/linux/netlink.h.
+ * @param pad for raw socket protocol specification.
+ * @param idiagExt a set of flags defining what kind of extended information to report.
+ * @param state a bit mask that defines a filter of socket states.
+ *
+ * @return bytes array representation of the message
+ **/
+ public static byte[] InetDiagReqV2(int protocol, @Nullable InetSocketAddress local,
+ @Nullable InetSocketAddress remote, int family, short flags, int pad, int idiagExt,
+ int state) throws NullPointerException {
final byte[] bytes = new byte[StructNlMsgHdr.STRUCT_SIZE + StructInetDiagReqV2.STRUCT_SIZE];
final ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byteBuffer.order(ByteOrder.nativeOrder());
@@ -63,9 +92,9 @@
nlMsgHdr.nlmsg_type = SOCK_DIAG_BY_FAMILY;
nlMsgHdr.nlmsg_flags = flags;
nlMsgHdr.pack(byteBuffer);
+ final StructInetDiagReqV2 inetDiagReqV2 =
+ new StructInetDiagReqV2(protocol, local, remote, family, pad, idiagExt, state);
- final StructInetDiagReqV2 inetDiagReqV2 = new StructInetDiagReqV2(protocol, local, remote,
- family);
inetDiagReqV2.pack(byteBuffer);
return bytes;
}
diff --git a/services/net/java/android/net/netlink/StructInetDiagReqV2.java b/services/net/java/android/net/netlink/StructInetDiagReqV2.java
index 49a9325..2268113 100644
--- a/services/net/java/android/net/netlink/StructInetDiagReqV2.java
+++ b/services/net/java/android/net/netlink/StructInetDiagReqV2.java
@@ -16,10 +16,10 @@
package android.net.netlink;
-import static java.nio.ByteOrder.BIG_ENDIAN;
+import android.annotation.Nullable;
+
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
/**
* struct inet_diag_req_v2
@@ -40,41 +40,58 @@
public class StructInetDiagReqV2 {
public static final int STRUCT_SIZE = 8 + StructInetDiagSockId.STRUCT_SIZE;
- private final byte sdiag_family;
- private final byte sdiag_protocol;
- private final StructInetDiagSockId id;
- private final int INET_DIAG_REQ_V2_ALL_STATES = (int) 0xffffffff;
-
+ private final byte mSdiagFamily;
+ private final byte mSdiagProtocol;
+ private final byte mIdiagExt;
+ private final byte mPad;
+ private final StructInetDiagSockId mId;
+ private final int mState;
+ public static final int INET_DIAG_REQ_V2_ALL_STATES = (int) 0xffffffff;
public StructInetDiagReqV2(int protocol, InetSocketAddress local, InetSocketAddress remote,
- int family) {
- sdiag_family = (byte) family;
- sdiag_protocol = (byte) protocol;
- id = new StructInetDiagSockId(local, remote);
+ int family) {
+ this(protocol, local, remote, family, 0 /* pad */, 0 /* extension */,
+ INET_DIAG_REQ_V2_ALL_STATES);
+ }
+
+ public StructInetDiagReqV2(int protocol, @Nullable InetSocketAddress local,
+ @Nullable InetSocketAddress remote, int family, int pad, int extension, int state)
+ throws NullPointerException {
+ mSdiagFamily = (byte) family;
+ mSdiagProtocol = (byte) protocol;
+ // Request for all sockets if no specific socket is requested. Specify the local and remote
+ // socket address information for target request socket.
+ if ((local == null) != (remote == null)) {
+ throw new NullPointerException("Local and remote must be both null or both non-null");
+ }
+ mId = ((local != null && remote != null) ? new StructInetDiagSockId(local, remote) : null);
+ mPad = (byte) pad;
+ mIdiagExt = (byte) extension;
+ mState = state;
}
public void pack(ByteBuffer byteBuffer) {
// The ByteOrder must have already been set by the caller.
- byteBuffer.put((byte) sdiag_family);
- byteBuffer.put((byte) sdiag_protocol);
- byteBuffer.put((byte) 0);
- byteBuffer.put((byte) 0);
- byteBuffer.putInt(INET_DIAG_REQ_V2_ALL_STATES);
- id.pack(byteBuffer);
+ byteBuffer.put((byte) mSdiagFamily);
+ byteBuffer.put((byte) mSdiagProtocol);
+ byteBuffer.put((byte) mIdiagExt);
+ byteBuffer.put((byte) mPad);
+ byteBuffer.putInt(mState);
+ if (mId != null) mId.pack(byteBuffer);
}
@Override
public String toString() {
- final String familyStr = NetlinkConstants.stringForAddressFamily(sdiag_family);
- final String protocolStr = NetlinkConstants.stringForAddressFamily(sdiag_protocol);
+ final String familyStr = NetlinkConstants.stringForAddressFamily(mSdiagFamily);
+ final String protocolStr = NetlinkConstants.stringForAddressFamily(mSdiagProtocol);
return "StructInetDiagReqV2{ "
+ "sdiag_family{" + familyStr + "}, "
+ "sdiag_protocol{" + protocolStr + "}, "
- + "idiag_ext{" + 0 + ")}, "
- + "pad{" + 0 + "}, "
- + "idiag_states{" + Integer.toHexString(INET_DIAG_REQ_V2_ALL_STATES) + "}, "
- + id.toString()
+ + "idiag_ext{" + mIdiagExt + ")}, "
+ + "pad{" + mPad + "}, "
+ + "idiag_states{" + Integer.toHexString(mState) + "}, "
+ + ((mId != null) ? mId.toString() : "inet_diag_sockid=null")
+ "}";
}
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java
index 7b7b8e6..9e7b805 100644
--- a/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java
@@ -85,6 +85,7 @@
import androidx.test.runner.AndroidJUnit4;
import com.android.internal.annotations.GuardedBy;
+import com.android.server.usage.AppStandbyInternal;
import org.junit.After;
import org.junit.Before;
@@ -108,7 +109,7 @@
private long mAppStandbyWindow;
private AlarmManagerService mService;
- private UsageStatsManagerInternal.AppIdleStateChangeListener mAppStandbyListener;
+ private AppStandbyInternal.AppIdleStateChangeListener mAppStandbyListener;
private AlarmManagerService.ChargingReceiver mChargingReceiver;
@Mock
private ContentResolver mMockResolver;
@@ -119,6 +120,8 @@
@Mock
private UsageStatsManagerInternal mUsageStatsManagerInternal;
@Mock
+ private AppStandbyInternal mAppStandbyInternal;
+ @Mock
private AppStateTracker mAppStateTracker;
@Mock
private AlarmManagerService.ClockReceiver mClockReceiver;
@@ -257,6 +260,8 @@
doReturn(mAppStateTracker).when(() -> LocalServices.getService(AppStateTracker.class));
doReturn(null)
.when(() -> LocalServices.getService(DeviceIdleInternal.class));
+ doReturn(mAppStandbyInternal).when(
+ () -> LocalServices.getService(AppStandbyInternal.class));
doReturn(mUsageStatsManagerInternal).when(
() -> LocalServices.getService(UsageStatsManagerInternal.class));
when(mUsageStatsManagerInternal.getAppStandbyBucket(eq(TEST_CALLING_PACKAGE),
@@ -289,9 +294,9 @@
assertEquals(0, mService.mConstants.MIN_FUTURITY);
assertEquals(0, mService.mConstants.MIN_INTERVAL);
mAppStandbyWindow = mService.mConstants.APP_STANDBY_WINDOW;
- ArgumentCaptor<UsageStatsManagerInternal.AppIdleStateChangeListener> captor =
- ArgumentCaptor.forClass(UsageStatsManagerInternal.AppIdleStateChangeListener.class);
- verify(mUsageStatsManagerInternal).addAppIdleStateChangeListener(captor.capture());
+ ArgumentCaptor<AppStandbyInternal.AppIdleStateChangeListener> captor =
+ ArgumentCaptor.forClass(AppStandbyInternal.AppIdleStateChangeListener.class);
+ verify(mAppStandbyInternal).addListener(captor.capture());
mAppStandbyListener = captor.getValue();
ArgumentCaptor<AlarmManagerService.ChargingReceiver> chargingReceiverCaptor =
diff --git a/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java b/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java
index 80d1129..1f4656a 100644
--- a/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java
@@ -45,7 +45,6 @@
import android.app.IUidObserver;
import android.app.usage.UsageStatsManager;
import android.app.usage.UsageStatsManagerInternal;
-import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -70,6 +69,8 @@
import com.android.internal.app.IAppOpsCallback;
import com.android.internal.app.IAppOpsService;
import com.android.server.AppStateTracker.Listener;
+import com.android.server.usage.AppStandbyInternal;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import org.junit.Before;
import org.junit.Test;
@@ -128,8 +129,8 @@
}
@Override
- UsageStatsManagerInternal injectUsageStatsManagerInternal() {
- return mMockUsageStatsManagerInternal;
+ AppStandbyInternal injectAppStandbyInternal() {
+ return mMockAppStandbyInternal;
}
@Override
@@ -175,7 +176,7 @@
private PowerManagerInternal mMockPowerManagerInternal;
@Mock
- private UsageStatsManagerInternal mMockUsageStatsManagerInternal;
+ private AppStandbyInternal mMockAppStandbyInternal;
private MockContentResolver mMockContentResolver;
@@ -271,7 +272,7 @@
verify(mMockContext).registerReceiver(
receiverCaptor.capture(), any(IntentFilter.class));
- verify(mMockUsageStatsManagerInternal).addAppIdleStateChangeListener(
+ verify(mMockAppStandbyInternal).addListener(
appIdleStateChangeListenerCaptor.capture());
mIUidObserver = uidObserverArgumentCaptor.getValue();
diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp
index 83e20fb..30ccb71 100644
--- a/services/tests/servicestests/Android.bp
+++ b/services/tests/servicestests/Android.bp
@@ -75,7 +75,7 @@
"libui",
"libunwindstack",
"libutils",
- "netd_aidl_interface-V2-cpp",
+ "netd_aidl_interface-cpp",
],
dxflags: ["--multi-dex"],
diff --git a/services/tests/servicestests/res/raw/apex_test.apex b/services/tests/servicestests/res/raw/apex_test.apex
new file mode 100644
index 0000000..19b1c5e
--- /dev/null
+++ b/services/tests/servicestests/res/raw/apex_test.apex
Binary files differ
diff --git a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
index 4a9dd97..0605d9e 100644
--- a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
@@ -36,7 +36,7 @@
public void test1() {
assertTrue("dynamic_system service available", mService != null);
try {
- mService.startInstallation(1 << 20, 8 << 30);
+ mService.startInstallation("userdata", 8L << 30, false);
fail("DynamicSystemService did not throw SecurityException as expected");
} catch (SecurityException e) {
// expected
diff --git a/services/tests/servicestests/src/com/android/server/GnssManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/GnssManagerServiceTest.java
new file mode 100644
index 0000000..9692c25
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/GnssManagerServiceTest.java
@@ -0,0 +1,743 @@
+/*
+ * 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;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertThrows;
+
+import android.Manifest;
+import android.app.ActivityManager;
+import android.app.AppOpsManager;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.location.GnssClock;
+import android.location.GnssMeasurementCorrections;
+import android.location.GnssMeasurementsEvent;
+import android.location.GnssNavigationMessage;
+import android.location.GnssSingleSatCorrection;
+import android.location.IBatchedLocationCallback;
+import android.location.IGnssMeasurementsListener;
+import android.location.IGnssNavigationMessageListener;
+import android.location.IGnssStatusListener;
+import android.location.INetInitiatedListener;
+import android.location.Location;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.IInterface;
+import android.os.Message;
+import android.os.RemoteException;
+
+import com.android.server.location.GnssBatchingProvider;
+import com.android.server.location.GnssCapabilitiesProvider;
+import com.android.server.location.GnssLocationProvider;
+import com.android.server.location.GnssMeasurementCorrectionsProvider;
+import com.android.server.location.GnssMeasurementsProvider;
+import com.android.server.location.GnssMeasurementsProvider.GnssMeasurementProviderNative;
+import com.android.server.location.GnssNavigationMessageProvider;
+import com.android.server.location.GnssNavigationMessageProvider.GnssNavigationMessageProviderNative;
+import com.android.server.location.GnssStatusListenerHelper;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.AdditionalMatchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Unit tests for {@link com.android.server.GnssManagerService}.
+ */
+public class GnssManagerServiceTest {
+
+ // Gnss Providers
+ @Mock
+ private GnssLocationProvider mMockGnssLocationProvider;
+ @Mock
+ private GnssBatchingProvider mMockGnssBatchingProvider;
+ @Mock
+ private GnssLocationProvider.GnssSystemInfoProvider mMockGnssSystemInfoProvider;
+ @Mock
+ private GnssCapabilitiesProvider mMockGnssCapabilitiesProvider;
+ @Mock
+ private GnssMeasurementCorrectionsProvider mMockGnssMeasurementCorrectionsProvider;
+ @Mock
+ private INetInitiatedListener mMockNetInitiatedListener;
+ private GnssMeasurementsProvider mTestGnssMeasurementsProvider;
+ private GnssStatusListenerHelper mTestGnssStatusProvider;
+ private GnssNavigationMessageProvider mTestGnssNavigationMessageProvider;
+
+ // Managers and services
+ @Mock
+ private AppOpsManager mMockAppOpsManager;
+ @Mock
+ private ActivityManager mMockActivityManager;
+ @Mock
+ private LocationManagerService mMockLocationManagerService;
+
+ // Context and handler
+ @Mock
+ private Handler mMockHandler;
+ @Mock
+ private Context mMockContext;
+
+ // Class under test
+ private GnssManagerService mGnssManagerService;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ GnssLocationProvider.setIsSupportedForTest(true);
+
+ // Set up mock context
+ when(mMockContext.getSystemServiceName(AppOpsManager.class)).thenReturn(
+ Context.APP_OPS_SERVICE);
+ when(mMockContext.getSystemServiceName(ActivityManager.class)).thenReturn(
+ Context.ACTIVITY_SERVICE);
+ when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(
+ mMockAppOpsManager);
+ when(mMockContext.getSystemService(
+ eq(Context.ACTIVITY_SERVICE))).thenReturn(
+ mMockActivityManager);
+ enableLocationPermissions();
+
+ // Mock Handler will execute posted runnables immediately
+ when(mMockHandler.sendMessageAtTime(any(Message.class), anyLong())).thenAnswer(
+ (InvocationOnMock invocation) -> {
+ Message msg = (Message) (invocation.getArguments()[0]);
+ msg.getCallback().run();
+ return null;
+ });
+
+ // Setup providers
+ mTestGnssMeasurementsProvider = createGnssMeasurementsProvider(
+ mMockContext, mMockHandler);
+ mTestGnssStatusProvider = createGnssStatusListenerHelper(
+ mMockContext, mMockHandler);
+ mTestGnssNavigationMessageProvider = createGnssNavigationMessageProvider(
+ mMockContext, mMockHandler);
+
+ // Setup GnssLocationProvider to return providers
+ when(mMockGnssLocationProvider.getGnssStatusProvider()).thenReturn(
+ mTestGnssStatusProvider);
+ when(mMockGnssLocationProvider.getGnssBatchingProvider()).thenReturn(
+ mMockGnssBatchingProvider);
+ when(mMockGnssLocationProvider.getGnssCapabilitiesProvider()).thenReturn(
+ mMockGnssCapabilitiesProvider);
+ when(mMockGnssLocationProvider.getGnssSystemInfoProvider()).thenReturn(
+ mMockGnssSystemInfoProvider);
+ when(mMockGnssLocationProvider.getGnssMeasurementCorrectionsProvider()).thenReturn(
+ mMockGnssMeasurementCorrectionsProvider);
+ when(mMockGnssLocationProvider.getGnssMeasurementsProvider()).thenReturn(
+ mTestGnssMeasurementsProvider);
+ when(mMockGnssLocationProvider.getGnssNavigationMessageProvider()).thenReturn(
+ mTestGnssNavigationMessageProvider);
+ when(mMockGnssLocationProvider.getNetInitiatedListener()).thenReturn(
+ mMockNetInitiatedListener);
+
+ // Setup GnssBatching provider
+ when(mMockGnssBatchingProvider.start(anyLong(), anyBoolean())).thenReturn(true);
+ when(mMockGnssBatchingProvider.stop()).thenReturn(true);
+
+ // Create GnssManagerService
+ mGnssManagerService = new GnssManagerService(mMockLocationManagerService, mMockContext,
+ mMockGnssLocationProvider, new LocationUsageLogger());
+ }
+
+ private void overrideAsBinder(IInterface mockListener) {
+ IBinder mockBinder = mock(IBinder.class);
+ when(mockListener.asBinder()).thenReturn(mockBinder);
+ }
+
+ private IGnssStatusListener createMockGnssStatusListener() {
+ IGnssStatusListener mockListener = mock(IGnssStatusListener.class);
+ overrideAsBinder(mockListener);
+ return mockListener;
+ }
+
+ private IGnssMeasurementsListener createMockGnssMeasurementsListener() {
+ IGnssMeasurementsListener mockListener = mock(
+ IGnssMeasurementsListener.class);
+ overrideAsBinder(mockListener);
+ return mockListener;
+ }
+
+ private IBatchedLocationCallback createMockBatchedLocationCallback() {
+ IBatchedLocationCallback mockedCallback = mock(IBatchedLocationCallback.class);
+ overrideAsBinder(mockedCallback);
+ return mockedCallback;
+ }
+
+ private IGnssNavigationMessageListener createMockGnssNavigationMessageListener() {
+ IGnssNavigationMessageListener mockListener = mock(IGnssNavigationMessageListener.class);
+ overrideAsBinder(mockListener);
+ return mockListener;
+ }
+
+ private GnssMeasurementCorrections createDummyGnssMeasurementCorrections() {
+ GnssSingleSatCorrection gnssSingleSatCorrection =
+ new GnssSingleSatCorrection.Builder().build();
+ return
+ new GnssMeasurementCorrections.Builder().setSingleSatelliteCorrectionList(
+ Arrays.asList(gnssSingleSatCorrection)).build();
+ }
+
+ private void enableLocationPermissions() {
+ Mockito.doThrow(new SecurityException()).when(
+ mMockContext).enforceCallingPermission(
+ AdditionalMatchers.and(
+ AdditionalMatchers.not(eq(Manifest.permission.LOCATION_HARDWARE)),
+ AdditionalMatchers.not(eq(Manifest.permission.ACCESS_FINE_LOCATION))),
+ anyString());
+ when(mMockContext.checkPermission(
+ eq(android.Manifest.permission.LOCATION_HARDWARE), anyInt(), anyInt())).thenReturn(
+ PackageManager.PERMISSION_GRANTED);
+
+ // AppOpsManager will return true if OP_FINE_LOCATION is checked
+ when(mMockAppOpsManager.checkOp(anyInt(), anyInt(), anyString())).thenAnswer(
+ (InvocationOnMock invocation) -> {
+ int code = (int) (invocation.getArguments()[0]);
+ if (code == AppOpsManager.OP_FINE_LOCATION) {
+ return AppOpsManager.MODE_ALLOWED;
+ }
+ return AppOpsManager.MODE_ERRORED;
+ });
+ }
+
+ private void disableLocationPermissions() {
+ Mockito.doThrow(new SecurityException()).when(
+ mMockContext).enforceCallingPermission(anyString(), anyString());
+ Mockito.doThrow(new SecurityException()).when(
+ mMockContext).checkPermission(anyString(), anyInt(), anyInt());
+
+ when(mMockAppOpsManager.checkOp(anyInt(), anyInt(),
+ anyString())).thenReturn(AppOpsManager.MODE_ERRORED);
+ }
+
+ private GnssStatusListenerHelper createGnssStatusListenerHelper(Context context,
+ Handler handler) {
+ return new GnssStatusListenerHelper(
+ context, handler) {
+ @Override
+ protected boolean isAvailableInPlatform() {
+ return true;
+ }
+
+ @Override
+ protected boolean isGpsEnabled() {
+ return true;
+ }
+ };
+ }
+
+ private GnssMeasurementsProvider createGnssMeasurementsProvider(Context context,
+ Handler handler) {
+ GnssMeasurementProviderNative
+ mockGnssMeasurementProviderNative = mock(GnssMeasurementProviderNative.class);
+ return new GnssMeasurementsProvider(
+ context, handler, mockGnssMeasurementProviderNative) {
+ @Override
+ protected boolean isGpsEnabled() {
+ return true;
+ }
+ };
+ }
+
+ private GnssNavigationMessageProvider createGnssNavigationMessageProvider(Context context,
+ Handler handler) {
+ GnssNavigationMessageProviderNative mockGnssNavigationMessageProviderNative = mock(
+ GnssNavigationMessageProviderNative.class);
+ return new GnssNavigationMessageProvider(context, handler,
+ mockGnssNavigationMessageProviderNative) {
+ @Override
+ protected boolean isGpsEnabled() {
+ return true;
+ }
+ };
+ }
+
+ @Test
+ public void getGnssYearOfHardwareTest() {
+ final int gnssYearOfHardware = 2012;
+ when(mMockGnssSystemInfoProvider.getGnssYearOfHardware()).thenReturn(gnssYearOfHardware);
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.getGnssYearOfHardware()).isEqualTo(gnssYearOfHardware);
+ }
+
+ @Test
+ public void getGnssHardwareModelNameTest() {
+ final String gnssHardwareModelName = "hardwarename";
+ when(mMockGnssSystemInfoProvider.getGnssHardwareModelName()).thenReturn(
+ gnssHardwareModelName);
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.getGnssHardwareModelName()).isEqualTo(
+ gnssHardwareModelName);
+ }
+
+ @Test
+ public void getGnssCapabilitiesWithoutPermissionsTest() {
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.getGnssCapabilities("com.android.server"));
+ }
+
+ @Test
+ public void getGnssCapabilitiesWithPermissionsTest() {
+ final long mGnssCapabilities = 23132L;
+ when(mMockGnssCapabilitiesProvider.getGnssCapabilities()).thenReturn(mGnssCapabilities);
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.getGnssCapabilities("com.android.server")).isEqualTo(
+ mGnssCapabilities);
+ }
+
+ @Test
+ public void getGnssBatchSizeWithoutPermissionsTest() {
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.getGnssBatchSize("com.android.server"));
+ }
+
+ @Test
+ public void getGnssBatchSizeWithPermissionsTest() {
+ final int gnssBatchSize = 10;
+ when(mMockGnssBatchingProvider.getBatchSize()).thenReturn(gnssBatchSize);
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.getGnssBatchSize("com.android.server")).isEqualTo(
+ gnssBatchSize);
+ }
+
+ @Test
+ public void startGnssBatchWithoutPermissionsTest() {
+ final long periodNanos = 100L;
+ final boolean wakeOnFifoFull = true;
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.startGnssBatch(periodNanos, wakeOnFifoFull,
+ "com.android.server"));
+ verify(mMockGnssBatchingProvider, times(0)).start(periodNanos, wakeOnFifoFull);
+ }
+
+ @Test
+ public void startGnssBatchWithPermissionsTest() {
+ final long periodNanos = 100L;
+ final boolean wakeOnFifoFull = true;
+
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.startGnssBatch(periodNanos, wakeOnFifoFull,
+ "com.android.server"))
+ .isEqualTo(
+ true);
+ verify(mMockGnssBatchingProvider, times(1)).start(100L, true);
+ }
+
+ @Test
+ public void addGnssBatchCallbackWithoutPermissionsTest() throws RemoteException {
+ IBatchedLocationCallback mockBatchedLocationCallback = createMockBatchedLocationCallback();
+ List<Location> mockLocationList = (List<Location>) mock(List.class);
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class, () -> mGnssManagerService.addGnssBatchingCallback(
+ mockBatchedLocationCallback, "com.android.server", "abcd123",
+ "TestBatchedLocationCallback"));
+
+ mGnssManagerService.onReportLocation(mockLocationList);
+
+ verify(mockBatchedLocationCallback, times(0)).onLocationBatch(mockLocationList);
+ }
+
+ @Test
+ public void addGnssBatchCallbackWithPermissionsTest() throws RemoteException {
+ IBatchedLocationCallback mockBatchedLocationCallback = createMockBatchedLocationCallback();
+ List<Location> mockLocationList = (List<Location>) mock(List.class);
+
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.addGnssBatchingCallback(
+ mockBatchedLocationCallback, "com.android.server",
+ "abcd123", "TestBatchedLocationCallback")).isEqualTo(true);
+
+ mGnssManagerService.onReportLocation(mockLocationList);
+
+ verify(mockBatchedLocationCallback, times(1)).onLocationBatch(mockLocationList);
+ }
+
+ @Test
+ public void replaceGnssBatchCallbackTest() throws RemoteException {
+ IBatchedLocationCallback mockBatchedLocationCallback1 = createMockBatchedLocationCallback();
+ IBatchedLocationCallback mockBatchedLocationCallback2 = createMockBatchedLocationCallback();
+ List<Location> mockLocationList = (List<Location>) mock(List.class);
+
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.addGnssBatchingCallback(
+ mockBatchedLocationCallback1, "com.android.server",
+ "abcd123", "TestBatchedLocationCallback")).isEqualTo(true);
+ assertThat(mGnssManagerService.addGnssBatchingCallback(
+ mockBatchedLocationCallback2, "com.android.server",
+ "abcd123", "TestBatchedLocationCallback")).isEqualTo(true);
+
+ mGnssManagerService.onReportLocation(mockLocationList);
+
+ verify(mockBatchedLocationCallback1, times(0)).onLocationBatch(mockLocationList);
+ verify(mockBatchedLocationCallback2, times(1)).onLocationBatch(mockLocationList);
+ }
+
+ @Test
+ public void flushGnssBatchWithoutPermissionsTest() {
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.flushGnssBatch("com.android.server"));
+ verify(mMockGnssBatchingProvider, times(0)).flush();
+ }
+
+ @Test
+ public void flushGnssBatchWithPermissionsTest() {
+ enableLocationPermissions();
+ mGnssManagerService.flushGnssBatch("com.android.server");
+
+ verify(mMockGnssBatchingProvider, times(1)).flush();
+ }
+
+ @Test
+ public void removeGnssBatchingCallbackWithoutPermissionsTest() throws RemoteException {
+ IBatchedLocationCallback mockBatchedLocationCallback = createMockBatchedLocationCallback();
+ List<Location> mockLocationList = (List<Location>) mock(List.class);
+
+ enableLocationPermissions();
+
+ mGnssManagerService.addGnssBatchingCallback(mockBatchedLocationCallback,
+ "com.android.server", "abcd123", "TestBatchedLocationCallback");
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.removeGnssBatchingCallback());
+
+ mGnssManagerService.onReportLocation(mockLocationList);
+
+ verify(mockBatchedLocationCallback, times(1)).onLocationBatch(mockLocationList);
+ }
+
+ @Test
+ public void removeGnssBatchingCallbackWithPermissionsTest() throws RemoteException {
+ IBatchedLocationCallback mockBatchedLocationCallback = createMockBatchedLocationCallback();
+ List<Location> mockLocationList = (List<Location>) mock(List.class);
+
+ enableLocationPermissions();
+
+ mGnssManagerService.addGnssBatchingCallback(mockBatchedLocationCallback,
+ "com.android.server", "abcd123", "TestBatchedLocationCallback");
+
+ mGnssManagerService.removeGnssBatchingCallback();
+
+ mGnssManagerService.onReportLocation(mockLocationList);
+
+ verify(mockBatchedLocationCallback, times(0)).onLocationBatch(mockLocationList);
+ }
+
+ @Test
+ public void stopGnssBatchWithoutPermissionsTest() {
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class, () -> mGnssManagerService.stopGnssBatch());
+ verify(mMockGnssBatchingProvider, times(0)).stop();
+ }
+
+ @Test
+ public void stopGnssBatchWithPermissionsTest() {
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.stopGnssBatch()).isEqualTo(true);
+ verify(mMockGnssBatchingProvider, times(1)).stop();
+ }
+
+ @Test
+ public void registerGnssStatusCallbackWithoutPermissionsTest() throws RemoteException {
+ final int timeToFirstFix = 20000;
+ IGnssStatusListener mockGnssStatusListener = createMockGnssStatusListener();
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class, () -> mGnssManagerService
+ .registerGnssStatusCallback(
+ mockGnssStatusListener, "com.android.server", "abcd123"));
+
+ mTestGnssStatusProvider.onFirstFix(timeToFirstFix);
+
+ verify(mockGnssStatusListener, times(0)).onFirstFix(timeToFirstFix);
+ }
+
+ @Test
+ public void registerGnssStatusCallbackWithPermissionsTest() throws RemoteException {
+ final int timeToFirstFix = 20000;
+ IGnssStatusListener mockGnssStatusListener = createMockGnssStatusListener();
+
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.registerGnssStatusCallback(
+ mockGnssStatusListener, "com.android.server", "abcd123")).isEqualTo(true);
+
+ mTestGnssStatusProvider.onFirstFix(timeToFirstFix);
+
+ verify(mockGnssStatusListener, times(1)).onFirstFix(timeToFirstFix);
+ }
+
+ @Test
+ public void unregisterGnssStatusCallbackWithPermissionsTest() throws RemoteException {
+ final int timeToFirstFix = 20000;
+ IGnssStatusListener mockGnssStatusListener = createMockGnssStatusListener();
+
+ enableLocationPermissions();
+
+ mGnssManagerService.registerGnssStatusCallback(
+ mockGnssStatusListener, "com.android.server", "abcd123");
+
+ mGnssManagerService.unregisterGnssStatusCallback(mockGnssStatusListener);
+
+ mTestGnssStatusProvider.onFirstFix(timeToFirstFix);
+
+ verify(mockGnssStatusListener, times(0)).onFirstFix(timeToFirstFix);
+ }
+
+ @Test
+ public void addGnssMeasurementsListenerWithoutPermissionsTest() throws RemoteException {
+ IGnssMeasurementsListener mockGnssMeasurementsListener =
+ createMockGnssMeasurementsListener();
+ GnssMeasurementsEvent gnssMeasurementsEvent = new GnssMeasurementsEvent(new GnssClock(),
+ null);
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.addGnssMeasurementsListener(
+ mockGnssMeasurementsListener,
+ "com.android.server", "abcd123", "TestGnssMeasurementsListener"));
+
+ mTestGnssMeasurementsProvider.onMeasurementsAvailable(gnssMeasurementsEvent);
+ verify(mockGnssMeasurementsListener, times(0)).onGnssMeasurementsReceived(
+ gnssMeasurementsEvent);
+ }
+
+ @Test
+ public void addGnssMeasurementsListenerWithPermissionsTest() throws RemoteException {
+ IGnssMeasurementsListener mockGnssMeasurementsListener =
+ createMockGnssMeasurementsListener();
+ GnssMeasurementsEvent gnssMeasurementsEvent = new GnssMeasurementsEvent(new GnssClock(),
+ null);
+
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.addGnssMeasurementsListener(mockGnssMeasurementsListener,
+ "com.android.server", "abcd123", "TestGnssMeasurementsListener")).isEqualTo(true);
+
+ mTestGnssMeasurementsProvider.onMeasurementsAvailable(gnssMeasurementsEvent);
+ verify(mockGnssMeasurementsListener, times(1)).onGnssMeasurementsReceived(
+ gnssMeasurementsEvent);
+ }
+
+ @Test
+ public void injectGnssMeasurementCorrectionsWithoutPermissionsTest() {
+ GnssMeasurementCorrections gnssMeasurementCorrections =
+ createDummyGnssMeasurementCorrections();
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.injectGnssMeasurementCorrections(
+ gnssMeasurementCorrections, "com.android.server"));
+ verify(mMockGnssMeasurementCorrectionsProvider, times(0))
+ .injectGnssMeasurementCorrections(
+ gnssMeasurementCorrections);
+ }
+
+ @Test
+ public void injectGnssMeasurementCorrectionsWithPermissionsTest() {
+ GnssMeasurementCorrections gnssMeasurementCorrections =
+ createDummyGnssMeasurementCorrections();
+
+ enableLocationPermissions();
+
+ mGnssManagerService.injectGnssMeasurementCorrections(
+ gnssMeasurementCorrections, "com.android.server");
+ verify(mMockGnssMeasurementCorrectionsProvider, times(1))
+ .injectGnssMeasurementCorrections(
+ gnssMeasurementCorrections);
+ }
+
+ @Test
+ public void removeGnssMeasurementsListenerWithoutPermissionsTest() throws RemoteException {
+ IGnssMeasurementsListener mockGnssMeasurementsListener =
+ createMockGnssMeasurementsListener();
+ GnssMeasurementsEvent gnssMeasurementsEvent = new GnssMeasurementsEvent(new GnssClock(),
+ null);
+
+ enableLocationPermissions();
+
+ mGnssManagerService.addGnssMeasurementsListener(mockGnssMeasurementsListener,
+ "com.android.server", "abcd123", "TestGnssMeasurementsListener");
+
+ disableLocationPermissions();
+
+ mGnssManagerService.removeGnssMeasurementsListener(
+ mockGnssMeasurementsListener);
+
+ mTestGnssMeasurementsProvider.onMeasurementsAvailable(gnssMeasurementsEvent);
+ verify(mockGnssMeasurementsListener, times(0)).onGnssMeasurementsReceived(
+ gnssMeasurementsEvent);
+ }
+
+ @Test
+ public void removeGnssMeasurementsListenerWithPermissionsTest() throws RemoteException {
+ IGnssMeasurementsListener mockGnssMeasurementsListener =
+ createMockGnssMeasurementsListener();
+ GnssMeasurementsEvent gnssMeasurementsEvent = new GnssMeasurementsEvent(new GnssClock(),
+ null);
+
+ enableLocationPermissions();
+
+ mGnssManagerService.addGnssMeasurementsListener(mockGnssMeasurementsListener,
+ "com.android.server", "abcd123", "TestGnssMeasurementsListener");
+
+ disableLocationPermissions();
+
+ mGnssManagerService.removeGnssMeasurementsListener(
+ mockGnssMeasurementsListener);
+
+ mTestGnssMeasurementsProvider.onMeasurementsAvailable(gnssMeasurementsEvent);
+ verify(mockGnssMeasurementsListener, times(0)).onGnssMeasurementsReceived(
+ gnssMeasurementsEvent);
+ }
+
+ @Test
+ public void addGnssNavigationMessageListenerWithoutPermissionsTest() throws RemoteException {
+ IGnssNavigationMessageListener mockGnssNavigationMessageListener =
+ createMockGnssNavigationMessageListener();
+ GnssNavigationMessage gnssNavigationMessage = new GnssNavigationMessage();
+
+ disableLocationPermissions();
+
+ assertThrows(SecurityException.class,
+ () -> mGnssManagerService.addGnssNavigationMessageListener(
+ mockGnssNavigationMessageListener, "com.android.server",
+ "abcd123", "TestGnssNavigationMessageListener"));
+
+ mTestGnssNavigationMessageProvider.onNavigationMessageAvailable(gnssNavigationMessage);
+
+ verify(mockGnssNavigationMessageListener, times(0)).onGnssNavigationMessageReceived(
+ gnssNavigationMessage);
+ }
+
+ @Test
+ public void addGnssNavigationMessageListenerWithPermissionsTest() throws RemoteException {
+ IGnssNavigationMessageListener mockGnssNavigationMessageListener =
+ createMockGnssNavigationMessageListener();
+ GnssNavigationMessage gnssNavigationMessage = new GnssNavigationMessage();
+
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.addGnssNavigationMessageListener(
+ mockGnssNavigationMessageListener, "com.android.server",
+ "abcd123", "TestGnssNavigationMessageListener")).isEqualTo(true);
+
+ mTestGnssNavigationMessageProvider.onNavigationMessageAvailable(gnssNavigationMessage);
+
+ verify(mockGnssNavigationMessageListener, times(1)).onGnssNavigationMessageReceived(
+ gnssNavigationMessage);
+ }
+
+ @Test
+ public void removeGnssNavigationMessageListenerWithoutPermissionsTest() throws RemoteException {
+ IGnssNavigationMessageListener mockGnssNavigationMessageListener =
+ createMockGnssNavigationMessageListener();
+ GnssNavigationMessage gnssNavigationMessage = new GnssNavigationMessage();
+
+ enableLocationPermissions();
+
+ mGnssManagerService.addGnssNavigationMessageListener(
+ mockGnssNavigationMessageListener, "com.android.server",
+ "abcd123", "TestGnssNavigationMessageListener");
+
+ disableLocationPermissions();
+
+ mGnssManagerService.removeGnssNavigationMessageListener(
+ mockGnssNavigationMessageListener);
+
+ mTestGnssNavigationMessageProvider.onNavigationMessageAvailable(gnssNavigationMessage);
+
+ verify(mockGnssNavigationMessageListener, times(0)).onGnssNavigationMessageReceived(
+ gnssNavigationMessage);
+ }
+
+ @Test
+ public void removeGnssNavigationMessageListenerWithPermissionsTest() throws RemoteException {
+ IGnssNavigationMessageListener mockGnssNavigationMessageListener =
+ createMockGnssNavigationMessageListener();
+ GnssNavigationMessage gnssNavigationMessage = new GnssNavigationMessage();
+
+ enableLocationPermissions();
+
+ mGnssManagerService.addGnssNavigationMessageListener(
+ mockGnssNavigationMessageListener, "com.android.server",
+ "abcd123", "TestGnssNavigationMessageListener");
+
+ mGnssManagerService.removeGnssNavigationMessageListener(
+ mockGnssNavigationMessageListener);
+
+ mTestGnssNavigationMessageProvider.onNavigationMessageAvailable(gnssNavigationMessage);
+
+ verify(mockGnssNavigationMessageListener, times(0)).onGnssNavigationMessageReceived(
+ gnssNavigationMessage);
+ }
+
+ @Test
+ public void sendNiResponseWithPermissionsTest() throws RemoteException {
+ when(mMockNetInitiatedListener.sendNiResponse(anyInt(), anyInt())).thenReturn(true);
+
+ int notifId = 0;
+ int userResponse = 0;
+ enableLocationPermissions();
+
+ assertThat(mGnssManagerService.sendNiResponse(notifId, userResponse)).isEqualTo(true);
+
+ verify(mMockNetInitiatedListener, times(1)).sendNiResponse(notifId, userResponse);
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
index 4aeeb0a..ec47a95 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
@@ -33,7 +33,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.content.ContentResolver;
import android.content.Context;
@@ -43,17 +42,15 @@
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricPrompt;
+import android.hardware.biometrics.IBiometricAuthenticator;
import android.hardware.biometrics.IBiometricService;
import android.hardware.biometrics.IBiometricServiceReceiver;
import android.hardware.biometrics.IBiometricServiceReceiverInternal;
-import android.hardware.face.FaceManager;
-import android.hardware.face.IFaceService;
import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.IFingerprintService;
import android.os.Binder;
import android.os.Bundle;
-import android.os.Handler;
import android.os.IBinder;
+import android.os.RemoteException;
import android.security.KeyStore;
import androidx.test.InstrumentationRegistry;
@@ -68,8 +65,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.util.List;
-
@SmallTest
public class BiometricServiceTest {
@@ -98,71 +93,33 @@
@Mock
private PackageManager mPackageManager;
@Mock
- private AppOpsManager mAppOpsManager;
- @Mock
IBiometricServiceReceiver mReceiver1;
@Mock
IBiometricServiceReceiver mReceiver2;
@Mock
- FingerprintManager mFingerprintManager;
+ BiometricService.Injector mInjector;
@Mock
- FaceManager mFaceManager;
-
- private static class MockInjector extends BiometricService.Injector {
- @Override
- IActivityManager getActivityManagerService() {
- return mock(IActivityManager.class);
- }
-
- @Override
- IStatusBarService getStatusBarService() {
- return mock(IStatusBarService.class);
- }
-
- @Override
- IFingerprintService getFingerprintService() {
- return mock(IFingerprintService.class);
- }
-
- @Override
- IFaceService getFaceService() {
- return mock(IFaceService.class);
- }
-
- @Override
- BiometricService.SettingObserver getSettingObserver(Context context, Handler handler,
- List<BiometricService.EnabledOnKeyguardCallback> callbacks) {
- return mock(BiometricService.SettingObserver.class);
- }
-
- @Override
- KeyStore getKeyStore() {
- return mock(KeyStore.class);
- }
-
- @Override
- boolean isDebugEnabled(Context context, int userId) {
- return false;
- }
-
- @Override
- void publishBinderService(BiometricService service, IBiometricService.Stub impl) {
- // no-op for test
- }
- }
+ IBiometricAuthenticator mFingerprintAuthenticator;
+ @Mock
+ IBiometricAuthenticator mFaceAuthenticator;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
- when(mContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mAppOpsManager);
- when(mContext.getSystemService(Context.FINGERPRINT_SERVICE))
- .thenReturn(mFingerprintManager);
- when(mContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
when(mContext.getContentResolver()).thenReturn(mContentResolver);
when(mContext.getResources()).thenReturn(mResources);
+ when(mInjector.getActivityManagerService()).thenReturn(mock(IActivityManager.class));
+ when(mInjector.getStatusBarService()).thenReturn(mock(IStatusBarService.class));
+ when(mInjector.getFingerprintAuthenticator()).thenReturn(mFingerprintAuthenticator);
+ when(mInjector.getFaceAuthenticator()).thenReturn(mFaceAuthenticator);
+ when(mInjector.getSettingObserver(any(), any(), any())).thenReturn(
+ mock(BiometricService.SettingObserver.class));
+ when(mInjector.getKeyStore()).thenReturn(mock(KeyStore.class));
+ when(mInjector.isDebugEnabled(any(), anyInt())).thenReturn(false);
+
when(mResources.getString(R.string.biometric_error_hw_unavailable))
.thenReturn(ERROR_HW_UNAVAILABLE);
when(mResources.getString(R.string.biometric_not_recognized))
@@ -172,61 +129,69 @@
}
@Test
- public void testAuthenticate_withoutHardware_returnsErrorHardwareNotPresent() throws Exception {
+ public void testAuthenticate_withoutHardware_returnsErrorHardwareNotPresent() throws
+ Exception {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
.thenReturn(false);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_IRIS)).thenReturn(false);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(false);
- mBiometricService = new BiometricService(mContext, new MockInjector());
+ mBiometricService = new BiometricService(mContext, mInjector);
mBiometricService.onStart();
invokeAuthenticate(mBiometricService.mImpl, mReceiver1, false /* requireConfirmation */,
false /* allowDeviceCredential */);
waitForIdle();
verify(mReceiver1).onError(
- eq(BiometricConstants.BIOMETRIC_ERROR_HW_NOT_PRESENT), eq(ERROR_HW_UNAVAILABLE));
+ eq(BiometricAuthenticator.TYPE_NONE),
+ eq(BiometricConstants.BIOMETRIC_ERROR_HW_NOT_PRESENT),
+ eq(0 /* vendorCode */));
}
@Test
public void testAuthenticate_withoutEnrolled_returnsErrorNoBiometrics() throws Exception {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)).thenReturn(true);
- when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+ when(mFingerprintAuthenticator.isHardwareDetected(any())).thenReturn(true);
- mBiometricService = new BiometricService(mContext, new MockInjector());
+ mBiometricService = new BiometricService(mContext, mInjector);
mBiometricService.onStart();
invokeAuthenticate(mBiometricService.mImpl, mReceiver1, false /* requireConfirmation */,
false /* allowDeviceCredential */);
waitForIdle();
verify(mReceiver1).onError(
- eq(BiometricConstants.BIOMETRIC_ERROR_NO_BIOMETRICS), any());
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
+ eq(BiometricConstants.BIOMETRIC_ERROR_NO_BIOMETRICS),
+ eq(0 /* vendorCode */));
}
@Test
- public void testAuthenticate_whenHalIsDead_returnsErrorHardwareUnavailable() throws Exception {
+ public void testAuthenticate_whenHalIsDead_returnsErrorHardwareUnavailable() throws
+ Exception {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)).thenReturn(true);
- when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
- when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
+ when(mFingerprintAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
+ when(mFingerprintAuthenticator.isHardwareDetected(any())).thenReturn(false);
- mBiometricService = new BiometricService(mContext, new MockInjector());
+ mBiometricService = new BiometricService(mContext, mInjector);
mBiometricService.onStart();
invokeAuthenticate(mBiometricService.mImpl, mReceiver1, false /* requireConfirmation */,
false /* allowDeviceCredential */);
waitForIdle();
verify(mReceiver1).onError(
- eq(BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE), eq(ERROR_HW_UNAVAILABLE));
+ eq(BiometricAuthenticator.TYPE_NONE),
+ eq(BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE),
+ eq(0 /* vendorCode */));
}
@Test
public void testAuthenticateFace_respectsUserSetting()
throws Exception {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(true);
- when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
- when(mFaceManager.isHardwareDetected()).thenReturn(true);
+ when(mFaceAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
+ when(mFaceAuthenticator.isHardwareDetected(any())).thenReturn(true);
- mBiometricService = new BiometricService(mContext, new MockInjector());
+ mBiometricService = new BiometricService(mContext, mInjector);
mBiometricService.onStart();
// Disabled in user settings receives onError
@@ -235,7 +200,9 @@
false /* allowDeviceCredential */);
waitForIdle();
verify(mReceiver1).onError(
- eq(BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE), eq(ERROR_HW_UNAVAILABLE));
+ eq(BiometricAuthenticator.TYPE_NONE),
+ eq(BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE),
+ eq(0 /* vendorCode */));
// Enrolled, not disabled in settings, user requires confirmation in settings
resetReceiver();
@@ -245,8 +212,8 @@
invokeAuthenticate(mBiometricService.mImpl, mReceiver1, false /* requireConfirmation */,
false /* allowDeviceCredential */);
waitForIdle();
- verify(mReceiver1, never()).onError(anyInt(), any(String.class));
- verify(mBiometricService.mFaceService).prepareForAuthentication(
+ verify(mReceiver1, never()).onError(anyInt(), anyInt(), anyInt());
+ verify(mBiometricService.mAuthenticators.get(0).impl).prepareForAuthentication(
eq(true) /* requireConfirmation */,
any(IBinder.class),
anyLong() /* sessionId */,
@@ -265,7 +232,7 @@
invokeAuthenticate(mBiometricService.mImpl, mReceiver1, false /* requireConfirmation */,
false /* allowDeviceCredential */);
waitForIdle();
- verify(mBiometricService.mFaceService).prepareForAuthentication(
+ verify(mBiometricService.mAuthenticators.get(0).impl).prepareForAuthentication(
eq(false) /* requireConfirmation */,
any(IBinder.class),
anyLong() /* sessionId */,
@@ -281,7 +248,7 @@
@Test
public void testAuthenticate_happyPathWithoutConfirmation() throws Exception {
setupAuthForOnly(BiometricAuthenticator.TYPE_FINGERPRINT);
- mBiometricService = new BiometricService(mContext, new MockInjector());
+ mBiometricService = new BiometricService(mContext, mInjector);
mBiometricService.onStart();
// Start testing the happy path
@@ -295,8 +262,9 @@
// Invokes <Modality>Service#prepareForAuthentication
ArgumentCaptor<Integer> cookieCaptor = ArgumentCaptor.forClass(Integer.class);
- verify(mReceiver1, never()).onError(anyInt(), any(String.class));
- verify(mBiometricService.mFingerprintService).prepareForAuthentication(
+ verify(mReceiver1, never()).onError(anyInt(), anyInt(), anyInt());
+ verify(mBiometricService.mAuthenticators.get(0).impl).prepareForAuthentication(
+ anyBoolean() /* requireConfirmation */,
any(IBinder.class),
anyLong() /* sessionId */,
anyInt() /* userId */,
@@ -316,7 +284,7 @@
BiometricService.STATE_AUTH_STARTED);
// startPreparedClient invoked
- verify(mBiometricService.mFingerprintService)
+ verify(mBiometricService.mAuthenticators.get(0).impl)
.startPreparedClient(cookieCaptor.getValue());
// StatusBar showBiometricDialog invoked
@@ -337,8 +305,7 @@
assertEquals(mBiometricService.mCurrentAuthSession.mState,
BiometricService.STATE_AUTHENTICATED_PENDING_SYSUI);
// Notify SystemUI hardware authenticated
- verify(mBiometricService.mStatusBarService).onBiometricAuthenticated(
- eq(true) /* authenticated */, eq(null) /* failureReason */);
+ verify(mBiometricService.mStatusBarService).onBiometricAuthenticated();
// SystemUI sends callback with dismissed reason
mBiometricService.mInternalReceiver.onDialogDismissed(
@@ -355,7 +322,7 @@
@Test
public void testAuthenticate_noBiometrics_credentialAllowed() throws Exception {
setupAuthForOnly(BiometricAuthenticator.TYPE_FACE);
- when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
+ when(mFaceAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(false);
invokeAuthenticate(mBiometricService.mImpl, mReceiver1,
true /* requireConfirmation */, true /* allowDeviceCredential */);
waitForIdle();
@@ -409,8 +376,10 @@
mBiometricService.mInternalReceiver.onAuthenticationFailed();
waitForIdle();
- verify(mBiometricService.mStatusBarService)
- .onBiometricAuthenticated(eq(false), eq(ERROR_NOT_RECOGNIZED));
+ verify(mBiometricService.mStatusBarService).onBiometricError(
+ eq(BiometricAuthenticator.TYPE_NONE),
+ eq(BiometricConstants.BIOMETRIC_PAUSED_REJECTED),
+ eq(0 /* vendorCode */));
verify(mReceiver1).onAuthenticationFailed();
assertEquals(mBiometricService.mCurrentAuthSession.mState,
BiometricService.STATE_AUTH_PAUSED);
@@ -426,15 +395,18 @@
mBiometricService.mInternalReceiver.onAuthenticationFailed();
waitForIdle();
- verify(mBiometricService.mStatusBarService)
- .onBiometricAuthenticated(eq(false), eq(ERROR_NOT_RECOGNIZED));
+ verify(mBiometricService.mStatusBarService).onBiometricError(
+ eq(BiometricAuthenticator.TYPE_NONE),
+ eq(BiometricConstants.BIOMETRIC_PAUSED_REJECTED),
+ eq(0 /* vendorCode */));
verify(mReceiver1).onAuthenticationFailed();
assertEquals(mBiometricService.mCurrentAuthSession.mState,
BiometricService.STATE_AUTH_STARTED);
}
@Test
- public void testErrorCanceled_whenAuthenticating_notifiesSystemUIAndClient() throws Exception {
+ public void testErrorCanceled_whenAuthenticating_notifiesSystemUIAndClient() throws
+ Exception {
setupAuthForOnly(BiometricAuthenticator.TYPE_FINGERPRINT);
invokeAuthenticateAndStart(mBiometricService.mImpl, mReceiver1,
false /* requireConfirmation */, false /* allowDeviceCredential */);
@@ -451,15 +423,15 @@
BiometricService.STATE_AUTH_STARTED);
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
- BiometricConstants.BIOMETRIC_ERROR_CANCELED, ERROR_CANCELED);
+ BiometricAuthenticator.TYPE_FINGERPRINT,
+ BiometricConstants.BIOMETRIC_ERROR_CANCELED, 0 /* vendorCode */);
waitForIdle();
// Auth session doesn't become null until SystemUI responds that the animation is completed
assertNotNull(mBiometricService.mCurrentAuthSession);
// ERROR_CANCELED is not sent until SystemUI responded that animation is completed
- verify(mReceiver1, never()).onError(
- anyInt(), anyString());
- verify(mReceiver2, never()).onError(anyInt(), any(String.class));
+ verify(mReceiver1, never()).onError(anyInt(), anyInt(), anyInt());
+ verify(mReceiver2, never()).onError(anyInt(), anyInt(), anyInt());
// SystemUI dialog closed
verify(mBiometricService.mStatusBarService).hideAuthenticationDialog();
@@ -469,8 +441,9 @@
.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_SERVER_REQUESTED);
waitForIdle();
verify(mReceiver1).onError(
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
eq(BiometricConstants.BIOMETRIC_ERROR_CANCELED),
- eq(ERROR_CANCELED));
+ eq(0 /* vendorCode */));
assertNull(mBiometricService.mCurrentAuthSession);
}
@@ -482,14 +455,17 @@
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FACE,
BiometricConstants.BIOMETRIC_ERROR_TIMEOUT,
- ERROR_TIMEOUT);
+ 0 /* vendorCode */);
waitForIdle();
assertEquals(mBiometricService.mCurrentAuthSession.mState,
BiometricService.STATE_AUTH_PAUSED);
- verify(mBiometricService.mStatusBarService)
- .onBiometricAuthenticated(eq(false), eq(ERROR_TIMEOUT));
+ verify(mBiometricService.mStatusBarService).onBiometricError(
+ eq(BiometricAuthenticator.TYPE_FACE),
+ eq(BiometricConstants.BIOMETRIC_ERROR_TIMEOUT),
+ eq(0 /* vendorCode */));
// Timeout does not count as fail as per BiometricPrompt documentation.
verify(mReceiver1, never()).onAuthenticationFailed();
@@ -524,22 +500,25 @@
public void testErrorFromHal_whenPaused_notifiesSystemUIAndClient() throws Exception {
setupAuthForOnly(BiometricAuthenticator.TYPE_FACE);
invokeAuthenticateAndStart(mBiometricService.mImpl, mReceiver1,
- false /* requireCOnfirmation */, false /* allowDeviceCredential */);
+ false /* requireConfirmation */, false /* allowDeviceCredential */);
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FACE,
BiometricConstants.BIOMETRIC_ERROR_TIMEOUT,
- ERROR_TIMEOUT);
+ 0 /* vendorCode */);
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FACE,
BiometricConstants.BIOMETRIC_ERROR_CANCELED,
- ERROR_CANCELED);
+ 0 /* vendorCode */);
waitForIdle();
// Client receives error immediately
verify(mReceiver1).onError(
+ eq(BiometricAuthenticator.TYPE_FACE),
eq(BiometricConstants.BIOMETRIC_ERROR_CANCELED),
- eq(ERROR_CANCELED));
+ eq(0 /* vendorCode */));
// Dialog is hidden immediately
verify(mBiometricService.mStatusBarService).hideAuthenticationDialog();
// Auth session is over
@@ -558,26 +537,29 @@
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FINGERPRINT,
BiometricConstants.BIOMETRIC_ERROR_UNABLE_TO_PROCESS,
- ERROR_UNABLE_TO_PROCESS);
+ 0 /* vendorCode */);
waitForIdle();
// Sends error to SystemUI and does not notify client yet
assertEquals(mBiometricService.mCurrentAuthSession.mState,
BiometricService.STATE_ERROR_PENDING_SYSUI);
verify(mBiometricService.mStatusBarService).onBiometricError(
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
eq(BiometricConstants.BIOMETRIC_ERROR_UNABLE_TO_PROCESS),
- eq(ERROR_UNABLE_TO_PROCESS));
+ eq(0 /* vendorCode */));
verify(mBiometricService.mStatusBarService, never()).hideAuthenticationDialog();
- verify(mReceiver1, never()).onError(anyInt(), anyString());
+ verify(mReceiver1, never()).onError(anyInt(), anyInt(), anyInt());
// SystemUI animation completed, client is notified, auth session is over
mBiometricService.mInternalReceiver
.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_ERROR);
waitForIdle();
verify(mReceiver1).onError(
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
eq(BiometricConstants.BIOMETRIC_ERROR_UNABLE_TO_PROCESS),
- eq(ERROR_UNABLE_TO_PROCESS));
+ eq(0 /* vendorCode */));
assertNull(mBiometricService.mCurrentAuthSession);
}
@@ -590,8 +572,9 @@
mBiometricService.mInternalReceiver.onError(
getCookieForPendingSession(mBiometricService.mPendingAuthSession),
+ BiometricAuthenticator.TYPE_FACE,
BiometricConstants.BIOMETRIC_ERROR_LOCKOUT,
- ERROR_LOCKOUT);
+ 0 /* vendorCode */);
waitForIdle();
// Pending auth session becomes current auth session, since device credential should
@@ -622,8 +605,9 @@
mBiometricService.mInternalReceiver.onError(
getCookieForPendingSession(mBiometricService.mPendingAuthSession),
+ BiometricAuthenticator.TYPE_FINGERPRINT,
BiometricConstants.BIOMETRIC_ERROR_LOCKOUT,
- ERROR_LOCKOUT);
+ 0 /* vendorCode */);
waitForIdle();
// Error is sent to client
@@ -690,17 +674,18 @@
assertEquals(BiometricService.STATE_SHOWING_DEVICE_CREDENTIAL,
mBiometricService.mCurrentAuthSession.mState);
- verify(mReceiver1, never()).onError(anyInt(), anyString());
+ verify(mReceiver1, never()).onError(anyInt(), anyInt(), anyInt());
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FINGERPRINT,
BiometricConstants.BIOMETRIC_ERROR_CANCELED,
- ERROR_CANCELED);
+ 0 /* vendorCode */);
waitForIdle();
assertEquals(BiometricService.STATE_SHOWING_DEVICE_CREDENTIAL,
mBiometricService.mCurrentAuthSession.mState);
- verify(mReceiver1, never()).onError(anyInt(), anyString());
+ verify(mReceiver1, never()).onError(anyInt(), anyInt(), anyInt());
}
@Test
@@ -714,15 +699,17 @@
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FINGERPRINT,
BiometricConstants.BIOMETRIC_ERROR_LOCKOUT,
- ERROR_LOCKOUT);
+ 0 /* vendorCode */);
waitForIdle();
assertEquals(BiometricService.STATE_SHOWING_DEVICE_CREDENTIAL,
mBiometricService.mCurrentAuthSession.mState);
verify(mBiometricService.mStatusBarService).onBiometricError(
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
eq(BiometricConstants.BIOMETRIC_ERROR_LOCKOUT),
- eq(ERROR_LOCKOUT));
+ eq(0 /* vendorCode */));
}
@Test
@@ -736,15 +723,17 @@
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FINGERPRINT,
BiometricConstants.BIOMETRIC_ERROR_UNABLE_TO_PROCESS,
- ERROR_UNABLE_TO_PROCESS);
+ 0 /* vendorCode */);
waitForIdle();
assertEquals(BiometricService.STATE_ERROR_PENDING_SYSUI,
mBiometricService.mCurrentAuthSession.mState);
verify(mBiometricService.mStatusBarService).onBiometricError(
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
eq(BiometricConstants.BIOMETRIC_ERROR_UNABLE_TO_PROCESS),
- eq(ERROR_UNABLE_TO_PROCESS));
+ eq(0 /* vendorCode */));
}
@Test
@@ -758,9 +747,10 @@
.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_USER_CANCEL);
waitForIdle();
verify(mReceiver1).onError(
+ eq(BiometricAuthenticator.TYPE_FINGERPRINT),
eq(BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED),
- eq(ERROR_USER_CANCELED));
- verify(mBiometricService.mFingerprintService).cancelAuthenticationFromService(
+ eq(0 /* vendorCode */));
+ verify(mBiometricService.mAuthenticators.get(0).impl).cancelAuthenticationFromService(
any(),
any(),
anyInt(),
@@ -778,13 +768,15 @@
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FACE,
BiometricConstants.BIOMETRIC_ERROR_TIMEOUT,
- ERROR_TIMEOUT);
+ 0 /* vendorCode */);
mBiometricService.mInternalReceiver.onDialogDismissed(
BiometricPrompt.DISMISSED_REASON_NEGATIVE);
waitForIdle();
- verify(mBiometricService.mFaceService, never()).cancelAuthenticationFromService(
+ verify(mBiometricService.mAuthenticators.get(0).impl,
+ never()).cancelAuthenticationFromService(
any(),
any(),
anyInt(),
@@ -794,20 +786,23 @@
}
@Test
- public void testDismissedReasonUserCancel_whilePaused_doesntInvokeHalCancel() throws Exception {
+ public void testDismissedReasonUserCancel_whilePaused_doesntInvokeHalCancel() throws
+ Exception {
setupAuthForOnly(BiometricAuthenticator.TYPE_FACE);
invokeAuthenticateAndStart(mBiometricService.mImpl, mReceiver1,
false /* requireConfirmation */, false /* allowDeviceCredential */);
mBiometricService.mInternalReceiver.onError(
getCookieForCurrentSession(mBiometricService.mCurrentAuthSession),
+ BiometricAuthenticator.TYPE_FACE,
BiometricConstants.BIOMETRIC_ERROR_TIMEOUT,
- ERROR_TIMEOUT);
+ 0 /* vendorCode */);
mBiometricService.mInternalReceiver.onDialogDismissed(
BiometricPrompt.DISMISSED_REASON_USER_CANCEL);
waitForIdle();
- verify(mBiometricService.mFaceService, never()).cancelAuthenticationFromService(
+ verify(mBiometricService.mAuthenticators.get(0).impl,
+ never()).cancelAuthenticationFromService(
any(),
any(),
anyInt(),
@@ -830,7 +825,8 @@
waitForIdle();
// doesn't send cancel to HAL
- verify(mBiometricService.mFaceService, never()).cancelAuthenticationFromService(
+ verify(mBiometricService.mAuthenticators.get(0).impl,
+ never()).cancelAuthenticationFromService(
any(),
any(),
anyInt(),
@@ -838,8 +834,9 @@
anyInt(),
anyBoolean());
verify(mReceiver1).onError(
+ eq(BiometricAuthenticator.TYPE_FACE),
eq(BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED),
- eq(ERROR_USER_CANCELED));
+ eq(0 /* vendorCode */));
assertNull(mBiometricService.mCurrentAuthSession);
}
@@ -863,7 +860,7 @@
// Helper methods
- private void setupAuthForOnly(int modality) {
+ private void setupAuthForOnly(int modality) throws RemoteException {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
.thenReturn(false);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(false);
@@ -871,17 +868,17 @@
if (modality == BiometricAuthenticator.TYPE_FINGERPRINT) {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
.thenReturn(true);
- when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
- when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+ when(mFingerprintAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
+ when(mFingerprintAuthenticator.isHardwareDetected(any())).thenReturn(true);
} else if (modality == BiometricAuthenticator.TYPE_FACE) {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(true);
- when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
- when(mFaceManager.isHardwareDetected()).thenReturn(true);
+ when(mFaceAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
+ when(mFaceAuthenticator.isHardwareDetected(any())).thenReturn(true);
} else {
fail("Unknown modality: " + modality);
}
- mBiometricService = new BiometricService(mContext, new MockInjector());
+ mBiometricService = new BiometricService(mContext, mInjector);
mBiometricService.onStart();
when(mBiometricService.mSettingObserver.getFaceEnabledForApps(anyInt())).thenReturn(true);
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
index 537287d..9863057 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
@@ -52,6 +52,7 @@
import com.android.internal.widget.ILockSettings;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockSettingsInternal;
+import com.android.internal.widget.LockscreenCredential;
import com.android.server.LocalServices;
import com.android.server.locksettings.recoverablekeystore.RecoverableKeyStoreManager;
import com.android.server.wm.WindowManagerInternal;
@@ -104,6 +105,7 @@
FaceManager mFaceManager;
PackageManager mPackageManager;
protected boolean mHasSecureLockScreen;
+ FakeSettings mSettings;
@Override
protected void setUp() throws Exception {
@@ -125,6 +127,7 @@
mFingerprintManager = mock(FingerprintManager.class);
mFaceManager = mock(FaceManager.class);
mPackageManager = mock(PackageManager.class);
+ mSettings = new FakeSettings();
LocalServices.removeServiceForTest(LockSettingsInternal.class);
LocalServices.removeServiceForTest(DevicePolicyManagerInternal.class);
@@ -162,7 +165,7 @@
mService = new LockSettingsServiceTestable(mContext, mLockPatternUtils, mStorage,
mGateKeeperService, mKeyStore, setUpStorageManagerMock(), mActivityManager,
mSpManager, mAuthSecretService, mGsiService, mRecoverableKeyStoreManager,
- mUserManagerInternal, mDeviceStateCache);
+ mUserManagerInternal, mDeviceStateCache, mSettings);
when(mUserManager.getUserInfo(eq(PRIMARY_USER_ID))).thenReturn(PRIMARY_USER_INFO);
mPrimaryUserProfiles.add(PRIMARY_USER_INFO);
installChildProfile(MANAGED_PROFILE_USER_ID);
@@ -195,6 +198,7 @@
mockBiometricsHardwareFingerprintsAndTemplates(PRIMARY_USER_ID);
mockBiometricsHardwareFingerprintsAndTemplates(MANAGED_PROFILE_USER_ID);
+ mSettings.setDeviceProvisioned(true);
mLocalService = LocalServices.getService(LockSettingsInternal.class);
}
@@ -307,4 +311,22 @@
protected static void assertArrayNotEquals(byte[] expected, byte[] actual) {
assertFalse(Arrays.equals(expected, actual));
}
+
+ protected LockscreenCredential newPassword(String password) {
+ return LockscreenCredential.createPasswordOrNone(password);
+ }
+
+ protected LockscreenCredential newPin(String pin) {
+ return LockscreenCredential.createPinOrNone(pin);
+ }
+
+ protected LockscreenCredential newPattern(String pattern) {
+ return LockscreenCredential.createPattern(LockPatternUtils.byteArrayToPattern(
+ pattern.getBytes()));
+ }
+
+ protected LockscreenCredential nonePassword() {
+ return LockscreenCredential.createNone();
+ }
+
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/CachedSyntheticPasswordTests.java b/services/tests/servicestests/src/com/android/server/locksettings/CachedSyntheticPasswordTests.java
index d2a9145..5c54883 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/CachedSyntheticPasswordTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/CachedSyntheticPasswordTests.java
@@ -15,9 +15,6 @@
*/
package com.android.server.locksettings;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
-
import static com.android.server.testutils.TestUtils.assertExpectException;
import static org.mockito.Mockito.anyInt;
@@ -30,7 +27,7 @@
import androidx.test.filters.SmallTest;
-import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
import org.mockito.ArgumentCaptor;
@@ -59,56 +56,53 @@
}
public void testSyntheticPasswordClearCredentialUntrusted() throws RemoteException {
- final byte[] password = "testSyntheticPasswordClearCredential-password".getBytes();
- final byte[] newPassword = "testSyntheticPasswordClearCredential-newpassword".getBytes();
+ final LockscreenCredential password = newPassword("password");
+ final LockscreenCredential newPassword = newPassword("newpassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
long sid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
// clear password
- mService.setLockCredential(null, LockPatternUtils.CREDENTIAL_TYPE_NONE, null,
- PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID, true);
+ mService.setLockCredential(nonePassword(), password, PRIMARY_USER_ID, true);
assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
// set a new password
- mService.setLockCredential(newPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
- assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(newPassword,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ mService.setLockCredential(newPassword, nonePassword(), PRIMARY_USER_ID,
+ false);
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
+ newPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
assertNotEquals(sid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
}
public void testSyntheticPasswordChangeCredentialUntrusted() throws RemoteException {
- final byte[] password = "testSyntheticPasswordClearCredential-password".getBytes();
- final byte[] newPassword = "testSyntheticPasswordClearCredential-newpassword".getBytes();
+ final LockscreenCredential password = newPassword("password");
+ final LockscreenCredential newPassword = newPassword("newpassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
long sid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
// Untrusted change password
- mService.setLockCredential(newPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, true);
+ mService.setLockCredential(newPassword, nonePassword(), PRIMARY_USER_ID,
+ true);
assertNotEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertNotEquals(sid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
// Verify the password
- assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(newPassword,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID).getResponseCode());
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
+ newPassword, 0, PRIMARY_USER_ID).getResponseCode());
}
public void testUntrustedCredentialChangeMaintainsAuthSecret() throws RemoteException {
- final byte[] password =
- "testUntrustedCredentialChangeMaintainsAuthSecret-password".getBytes();
- final byte[] newPassword =
- "testUntrustedCredentialChangeMaintainsAuthSecret-newpassword".getBytes();
+ final LockscreenCredential password = newPassword("password");
+ final LockscreenCredential newPassword = newPassword("newpassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
// Untrusted change password
- mService.setLockCredential(newPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, true);
+ mService.setLockCredential(newPassword, nonePassword(), PRIMARY_USER_ID,
+ true);
// Verify the password
- assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(newPassword,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
+ newPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
// Ensure the same secret was passed each time
@@ -118,31 +112,30 @@
}
public void testUntrustedCredentialChangeBlockedIfSpNotCached() throws RemoteException {
- final byte[] password =
- "testUntrustedCredentialChangeBlockedIfSpNotCached-password".getBytes();
- final byte[] newPassword =
- "testUntrustedCredentialChangeBlockedIfSpNotCached-newpassword".getBytes();
+ final LockscreenCredential password = newPassword("password");
+ final LockscreenCredential newPassword = newPassword("newpassword");
// Disable caching for this test
enableSpCaching(false);
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
+ flushHandlerTasks();
+
long sid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
// Untrusted change password
assertExpectException(
IllegalStateException.class,
/* messageRegex= */ "Untrusted credential reset not possible without cached SP",
- () -> mService.setLockCredential(newPassword,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, true));
+ () -> mService.setLockCredential(newPassword, nonePassword(),
+ PRIMARY_USER_ID, true));
assertEquals(sid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
// Verify the new password doesn't work but the old one still does
- assertEquals(VerifyCredentialResponse.RESPONSE_ERROR, mService.verifyCredential(newPassword,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ assertEquals(VerifyCredentialResponse.RESPONSE_ERROR, mService.verifyCredential(
+ newPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
- assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(password,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/FakeSettings.java b/services/tests/servicestests/src/com/android/server/locksettings/FakeSettings.java
new file mode 100644
index 0000000..70a927c
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/locksettings/FakeSettings.java
@@ -0,0 +1,36 @@
+/*
+ * 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.locksettings;
+
+import android.provider.Settings;
+
+public class FakeSettings {
+
+ private int mDeviceProvisioned;
+
+ public void setDeviceProvisioned(boolean provisioned) {
+ mDeviceProvisioned = provisioned ? 1 : 0;
+ }
+
+ public int globalGetInt(String keyName) {
+ switch (keyName) {
+ case Settings.Global.DEVICE_PROVISIONED:
+ return mDeviceProvisioned;
+ default:
+ throw new IllegalArgumentException("Unhandled global settings: " + keyName);
+ }
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java
index fcd98e0..7e7e170 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java
@@ -20,9 +20,11 @@
import android.app.IActivityManager;
import android.app.admin.DeviceStateCache;
+import android.content.ContentResolver;
import android.content.Context;
import android.hardware.authsecret.V1_0.IAuthSecret;
import android.os.Handler;
+import android.os.Parcel;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserManagerInternal;
@@ -31,6 +33,7 @@
import android.security.keystore.KeyPermanentlyInvalidatedException;
import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockscreenCredential;
import com.android.server.ServiceThread;
import com.android.server.locksettings.recoverablekeystore.RecoverableKeyStoreManager;
@@ -50,12 +53,14 @@
private RecoverableKeyStoreManager mRecoverableKeyStoreManager;
private UserManagerInternal mUserManagerInternal;
private DeviceStateCache mDeviceStateCache;
+ private FakeSettings mSettings;
public MockInjector(Context context, LockSettingsStorage storage, KeyStore keyStore,
IActivityManager activityManager, LockPatternUtils lockPatternUtils,
IStorageManager storageManager, SyntheticPasswordManager spManager,
FakeGsiService gsiService, RecoverableKeyStoreManager recoverableKeyStoreManager,
- UserManagerInternal userManagerInternal, DeviceStateCache deviceStateCache) {
+ UserManagerInternal userManagerInternal, DeviceStateCache deviceStateCache,
+ FakeSettings settings) {
super(context);
mLockSettingsStorage = storage;
mKeyStore = keyStore;
@@ -67,6 +72,7 @@
mRecoverableKeyStoreManager = recoverableKeyStoreManager;
mUserManagerInternal = userManagerInternal;
mDeviceStateCache = deviceStateCache;
+ mSettings = settings;
}
@Override
@@ -119,6 +125,12 @@
}
@Override
+ public int settingsGlobalGetInt(ContentResolver contentResolver, String keyName,
+ int defaultValue) {
+ return mSettings.globalGetInt(keyName);
+ }
+
+ @Override
public UserManagerInternal getUserManagerInternal() {
return mUserManagerInternal;
}
@@ -144,27 +156,33 @@
}
}
+ public MockInjector mInjector;
+
protected LockSettingsServiceTestable(Context context, LockPatternUtils lockPatternUtils,
LockSettingsStorage storage, FakeGateKeeperService gatekeeper, KeyStore keystore,
IStorageManager storageManager, IActivityManager mActivityManager,
SyntheticPasswordManager spManager, IAuthSecret authSecretService,
FakeGsiService gsiService, RecoverableKeyStoreManager recoverableKeyStoreManager,
- UserManagerInternal userManagerInternal, DeviceStateCache deviceStateCache) {
+ UserManagerInternal userManagerInternal, DeviceStateCache deviceStateCache,
+ FakeSettings settings) {
super(new MockInjector(context, storage, keystore, mActivityManager, lockPatternUtils,
storageManager, spManager, gsiService,
- recoverableKeyStoreManager, userManagerInternal, deviceStateCache));
+ recoverableKeyStoreManager, userManagerInternal, deviceStateCache, settings));
mGateKeeperService = gatekeeper;
mAuthSecretService = authSecretService;
}
@Override
- protected void tieProfileLockToParent(int userId, byte[] password) {
- mStorage.writeChildProfileLock(userId, password);
+ protected void tieProfileLockToParent(int userId, LockscreenCredential password) {
+ Parcel parcel = Parcel.obtain();
+ parcel.writeParcelable(password, 0);
+ mStorage.writeChildProfileLock(userId, parcel.marshall());
+ parcel.recycle();
}
@Override
- protected byte[] getDecryptedPasswordForTiedProfile(int userId) throws FileNotFoundException,
- KeyPermanentlyInvalidatedException {
+ protected LockscreenCredential getDecryptedPasswordForTiedProfile(int userId)
+ throws FileNotFoundException, KeyPermanentlyInvalidatedException {
byte[] storedData = mStorage.readChildProfileLock(userId);
if (storedData == null) {
throw new FileNotFoundException("Child profile lock file not found");
@@ -176,6 +194,13 @@
} catch (RemoteException e) {
// shouldn't happen.
}
- return storedData;
+ Parcel parcel = Parcel.obtain();
+ try {
+ parcel.unmarshall(storedData, 0, storedData.length);
+ parcel.setDataPosition(0);
+ return (LockscreenCredential) parcel.readParcelable(null);
+ } finally {
+ parcel.recycle();
+ }
}
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTests.java
index 5818133..86ef31a 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTests.java
@@ -16,14 +16,10 @@
package com.android.server.locksettings;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
-
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -39,6 +35,7 @@
import androidx.test.filters.SmallTest;
import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.server.locksettings.FakeGateKeeperService.VerifyHandle;
import com.android.server.locksettings.LockSettingsStorage.CredentialHash;
@@ -61,60 +58,51 @@
}
public void testCreatePasswordPrimaryUser() throws RemoteException {
- testCreateCredential(PRIMARY_USER_ID, "password", CREDENTIAL_TYPE_PASSWORD,
- PASSWORD_QUALITY_ALPHABETIC);
+ testCreateCredential(PRIMARY_USER_ID, newPassword("password"));
}
public void testCreatePasswordFailsWithoutLockScreen() throws RemoteException {
- testCreateCredentialFailsWithoutLockScreen(PRIMARY_USER_ID, "password",
- CREDENTIAL_TYPE_PASSWORD, PASSWORD_QUALITY_ALPHABETIC);
+ testCreateCredentialFailsWithoutLockScreen(PRIMARY_USER_ID, newPassword("password"));
}
public void testCreatePatternPrimaryUser() throws RemoteException {
- testCreateCredential(PRIMARY_USER_ID, "123456789", CREDENTIAL_TYPE_PATTERN,
- PASSWORD_QUALITY_SOMETHING);
+ testCreateCredential(PRIMARY_USER_ID, newPattern("123456789"));
}
public void testCreatePatternFailsWithoutLockScreen() throws RemoteException {
- testCreateCredentialFailsWithoutLockScreen(PRIMARY_USER_ID, "123456789",
- CREDENTIAL_TYPE_PATTERN, PASSWORD_QUALITY_SOMETHING);
+ testCreateCredentialFailsWithoutLockScreen(PRIMARY_USER_ID, newPattern("123456789"));
}
public void testChangePasswordPrimaryUser() throws RemoteException {
- testChangeCredentials(PRIMARY_USER_ID, "78963214", CREDENTIAL_TYPE_PATTERN,
- "asdfghjk", CREDENTIAL_TYPE_PASSWORD, PASSWORD_QUALITY_ALPHABETIC);
+ testChangeCredentials(PRIMARY_USER_ID, newPattern("78963214"), newPassword("asdfghjk"));
}
public void testChangePatternPrimaryUser() throws RemoteException {
- testChangeCredentials(PRIMARY_USER_ID, "!£$%^&*(())", CREDENTIAL_TYPE_PASSWORD,
- "1596321", CREDENTIAL_TYPE_PATTERN, PASSWORD_QUALITY_SOMETHING);
+ testChangeCredentials(PRIMARY_USER_ID, newPassword("!£$%^&*(())"), newPattern("1596321"));
}
public void testChangePasswordFailPrimaryUser() throws RemoteException {
final long sid = 1234;
- initializeStorageWithCredential(PRIMARY_USER_ID, "password", CREDENTIAL_TYPE_PASSWORD, sid);
+ initializeStorageWithCredential(PRIMARY_USER_ID, newPassword("password"), sid);
- assertFalse(mService.setLockCredential("newpwd".getBytes(), CREDENTIAL_TYPE_PASSWORD,
- "badpwd".getBytes(), PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false));
- assertVerifyCredentials(PRIMARY_USER_ID, "password", CREDENTIAL_TYPE_PASSWORD, sid);
+ assertFalse(mService.setLockCredential(newPassword("newpwd"), newPassword("badpwd"),
+ PRIMARY_USER_ID, false));
+ assertVerifyCredentials(PRIMARY_USER_ID, newPassword("password"), sid);
}
public void testClearPasswordPrimaryUser() throws RemoteException {
- final String PASSWORD = "password";
- initializeStorageWithCredential(PRIMARY_USER_ID, PASSWORD, CREDENTIAL_TYPE_PASSWORD, 1234);
- assertTrue(mService.setLockCredential(null, CREDENTIAL_TYPE_NONE, PASSWORD.getBytes(),
- PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID, false));
- assertFalse(mService.havePassword(PRIMARY_USER_ID));
- assertFalse(mService.havePattern(PRIMARY_USER_ID));
+ initializeStorageWithCredential(PRIMARY_USER_ID, newPassword("password"), 1234);
+ assertTrue(mService.setLockCredential(nonePassword(), newPassword("password"),
+ PRIMARY_USER_ID, false));
+ assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(PRIMARY_USER_ID));
assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
}
public void testManagedProfileUnifiedChallenge() throws RemoteException {
- final String firstUnifiedPassword = "testManagedProfileUnifiedChallenge-pwd-1";
- final String secondUnifiedPassword = "testManagedProfileUnifiedChallenge-pwd-2";
- assertTrue(mService.setLockCredential(firstUnifiedPassword.getBytes(),
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
- null, PASSWORD_QUALITY_COMPLEX, PRIMARY_USER_ID, false));
+ final LockscreenCredential firstUnifiedPassword = newPassword("pwd-1");
+ final LockscreenCredential secondUnifiedPassword = newPassword("pwd-2");
+ assertTrue(mService.setLockCredential(firstUnifiedPassword,
+ nonePassword(), PRIMARY_USER_ID, false));
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
final long primarySid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
final long profileSid = mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID);
@@ -132,8 +120,8 @@
mGateKeeperService.clearAuthToken(TURNED_OFF_PROFILE_USER_ID);
// verify credential
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- firstUnifiedPassword.getBytes(), LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0,
- PRIMARY_USER_ID).getResponseCode());
+ firstUnifiedPassword, 0, PRIMARY_USER_ID)
+ .getResponseCode());
// Verify that we have a new auth token for the profile
assertNotNull(mGateKeeperService.getAuthToken(MANAGED_PROFILE_USER_ID));
@@ -148,16 +136,15 @@
*/
mStorageManager.setIgnoreBadUnlock(true);
// Change primary password and verify that profile SID remains
- assertTrue(mService.setLockCredential(secondUnifiedPassword.getBytes(),
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, firstUnifiedPassword.getBytes(),
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false));
+ assertTrue(mService.setLockCredential(
+ secondUnifiedPassword, firstUnifiedPassword, PRIMARY_USER_ID, false));
mStorageManager.setIgnoreBadUnlock(false);
assertEquals(profileSid, mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID));
assertNull(mGateKeeperService.getAuthToken(TURNED_OFF_PROFILE_USER_ID));
// Clear unified challenge
- assertTrue(mService.setLockCredential(null, LockPatternUtils.CREDENTIAL_TYPE_NONE,
- secondUnifiedPassword.getBytes(), PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID,
+ assertTrue(mService.setLockCredential(nonePassword(),
+ secondUnifiedPassword, PRIMARY_USER_ID,
false));
assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertEquals(0, mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID));
@@ -165,19 +152,19 @@
}
public void testManagedProfileSeparateChallenge() throws RemoteException {
- final String primaryPassword = "testManagedProfileSeparateChallenge-primary";
- final String profilePassword = "testManagedProfileSeparateChallenge-profile";
- assertTrue(mService.setLockCredential(primaryPassword.getBytes(),
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_COMPLEX, PRIMARY_USER_ID, false));
+ final LockscreenCredential primaryPassword = newPassword("primary");
+ final LockscreenCredential profilePassword = newPassword("profile");
+ assertTrue(mService.setLockCredential(primaryPassword,
+ nonePassword(),
+ PRIMARY_USER_ID, false));
/* Currently in LockSettingsService.setLockCredential, unlockUser() is called with the new
* credential as part of verifyCredential() before the new credential is committed in
* StorageManager. So we relax the check in our mock StorageManager to allow that.
*/
mStorageManager.setIgnoreBadUnlock(true);
- assertTrue(mService.setLockCredential(profilePassword.getBytes(),
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_COMPLEX, MANAGED_PROFILE_USER_ID, false));
+ assertTrue(mService.setLockCredential(profilePassword,
+ nonePassword(),
+ MANAGED_PROFILE_USER_ID, false));
mStorageManager.setIgnoreBadUnlock(false);
final long primarySid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
@@ -190,81 +177,69 @@
mGateKeeperService.clearAuthToken(MANAGED_PROFILE_USER_ID);
// verify primary credential
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- primaryPassword.getBytes(), LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0,
- PRIMARY_USER_ID).getResponseCode());
+ primaryPassword, 0, PRIMARY_USER_ID)
+ .getResponseCode());
assertNull(mGateKeeperService.getAuthToken(MANAGED_PROFILE_USER_ID));
// verify profile credential
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- profilePassword.getBytes(), LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0,
- MANAGED_PROFILE_USER_ID).getResponseCode());
+ profilePassword, 0, MANAGED_PROFILE_USER_ID)
+ .getResponseCode());
assertNotNull(mGateKeeperService.getAuthToken(MANAGED_PROFILE_USER_ID));
assertEquals(profileSid, mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID));
// Change primary credential and make sure we don't affect profile
mStorageManager.setIgnoreBadUnlock(true);
- assertTrue(mService.setLockCredential("pwd".getBytes(),
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
- primaryPassword.getBytes(), PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false));
+ assertTrue(mService.setLockCredential(
+ newPassword("pwd"), primaryPassword, PRIMARY_USER_ID, false));
mStorageManager.setIgnoreBadUnlock(false);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- profilePassword.getBytes(), LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0,
- MANAGED_PROFILE_USER_ID).getResponseCode());
+ profilePassword, 0, MANAGED_PROFILE_USER_ID)
+ .getResponseCode());
assertEquals(profileSid, mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID));
}
public void testSetLockCredential_forPrimaryUser_sendsCredentials() throws Exception {
- final byte[] password = "password".getBytes();
-
assertTrue(mService.setLockCredential(
- password,
- CREDENTIAL_TYPE_PASSWORD,
- null,
- PASSWORD_QUALITY_ALPHABETIC,
+ newPassword("password"),
+ nonePassword(),
PRIMARY_USER_ID,
false));
verify(mRecoverableKeyStoreManager)
- .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, password, PRIMARY_USER_ID);
+ .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, "password".getBytes(),
+ PRIMARY_USER_ID);
}
public void testSetLockCredential_forProfileWithSeparateChallenge_sendsCredentials()
throws Exception {
- final byte[] pattern = "12345".getBytes();
-
assertTrue(mService.setLockCredential(
- pattern,
- CREDENTIAL_TYPE_PATTERN,
- null,
- PASSWORD_QUALITY_SOMETHING,
+ newPattern("12345"),
+ nonePassword(),
MANAGED_PROFILE_USER_ID,
false));
verify(mRecoverableKeyStoreManager)
- .lockScreenSecretChanged(CREDENTIAL_TYPE_PATTERN, pattern, MANAGED_PROFILE_USER_ID);
+ .lockScreenSecretChanged(CREDENTIAL_TYPE_PATTERN, "12345".getBytes(),
+ MANAGED_PROFILE_USER_ID);
}
public void testSetLockCredential_forProfileWithSeparateChallenge_updatesCredentials()
throws Exception {
- final String oldCredential = "12345";
- final byte[] newCredential = "newPassword".getBytes();
initializeStorageWithCredential(
MANAGED_PROFILE_USER_ID,
- oldCredential,
- CREDENTIAL_TYPE_PATTERN,
- PASSWORD_QUALITY_SOMETHING);
+ newPattern("12345"),
+ 1234);
assertTrue(mService.setLockCredential(
- newCredential,
- CREDENTIAL_TYPE_PASSWORD,
- oldCredential.getBytes(),
- PASSWORD_QUALITY_ALPHABETIC,
+ newPassword("newPassword"),
+ newPattern("12345"),
MANAGED_PROFILE_USER_ID,
false));
verify(mRecoverableKeyStoreManager)
- .lockScreenSecretChanged(
- CREDENTIAL_TYPE_PASSWORD, newCredential, MANAGED_PROFILE_USER_ID);
+ .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, "newPassword".getBytes(),
+ MANAGED_PROFILE_USER_ID);
}
public void testSetLockCredential_forProfileWithUnifiedChallenge_doesNotSendRandomCredential()
@@ -272,10 +247,8 @@
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
assertTrue(mService.setLockCredential(
- "12345".getBytes(),
- CREDENTIAL_TYPE_PATTERN,
- null,
- PASSWORD_QUALITY_SOMETHING,
+ newPattern("12345"),
+ nonePassword(),
PRIMARY_USER_ID,
false));
@@ -287,40 +260,35 @@
public void
testSetLockCredential_forPrimaryUserWithUnifiedChallengeProfile_updatesBothCredentials()
throws Exception {
- final String oldCredential = "oldPassword";
- final byte[] newCredential = "newPassword".getBytes();
+ final LockscreenCredential oldCredential = newPassword("oldPassword");
+ final LockscreenCredential newCredential = newPassword("newPassword");
initializeStorageWithCredential(
- PRIMARY_USER_ID, oldCredential, CREDENTIAL_TYPE_PASSWORD, 1234);
+ PRIMARY_USER_ID, oldCredential, 1234);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
assertTrue(mService.setLockCredential(
newCredential,
- CREDENTIAL_TYPE_PASSWORD,
- oldCredential.getBytes(),
- PASSWORD_QUALITY_ALPHABETIC,
+ oldCredential,
PRIMARY_USER_ID,
false));
verify(mRecoverableKeyStoreManager)
- .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, newCredential, PRIMARY_USER_ID);
+ .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, newCredential.getCredential(),
+ PRIMARY_USER_ID);
verify(mRecoverableKeyStoreManager)
- .lockScreenSecretChanged(
- CREDENTIAL_TYPE_PASSWORD, newCredential, MANAGED_PROFILE_USER_ID);
+ .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, newCredential.getCredential(),
+ MANAGED_PROFILE_USER_ID);
}
public void
testSetLockCredential_forPrimaryUserWithUnifiedChallengeProfile_removesBothCredentials()
throws Exception {
- final String oldCredential = "oldPassword";
- initializeStorageWithCredential(
- PRIMARY_USER_ID, oldCredential, CREDENTIAL_TYPE_PASSWORD, 1234);
+ initializeStorageWithCredential(PRIMARY_USER_ID, newPassword("oldPassword"), 1234);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
assertTrue(mService.setLockCredential(
- null,
- CREDENTIAL_TYPE_NONE,
- oldCredential.getBytes(),
- PASSWORD_QUALITY_UNSPECIFIED,
+ nonePassword(),
+ newPassword("oldPassword"),
PRIMARY_USER_ID,
false));
@@ -331,17 +299,13 @@
}
public void testSetLockCredential_nullCredential_removeBiometrics() throws RemoteException {
- final String oldCredential = "oldPassword";
-
initializeStorageWithCredential(
PRIMARY_USER_ID,
- oldCredential,
- CREDENTIAL_TYPE_PATTERN,
- PASSWORD_QUALITY_SOMETHING);
+ newPattern("123654"),
+ 1234);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
- mService.setLockCredential(null, CREDENTIAL_TYPE_NONE, oldCredential.getBytes(),
- PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID, false);
+ mService.setLockCredential(nonePassword(), newPattern("123654"), PRIMARY_USER_ID, false);
// Verify fingerprint is removed
verify(mFingerprintManager).remove(any(), eq(PRIMARY_USER_ID), any());
@@ -353,41 +317,33 @@
public void testSetLockCredential_forUnifiedToSeparateChallengeProfile_sendsNewCredentials()
throws Exception {
- final String parentPassword = "parentPassword";
- final byte[] profilePassword = "profilePassword".getBytes();
- initializeStorageWithCredential(
- PRIMARY_USER_ID, parentPassword, CREDENTIAL_TYPE_PASSWORD, 1234);
+ final LockscreenCredential parentPassword = newPassword("parentPassword");
+ final LockscreenCredential profilePassword = newPassword("profilePassword");
+ initializeStorageWithCredential(PRIMARY_USER_ID, parentPassword, 1234);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
assertTrue(mService.setLockCredential(
profilePassword,
- CREDENTIAL_TYPE_PASSWORD,
- null,
- PASSWORD_QUALITY_ALPHABETIC,
+ nonePassword(),
MANAGED_PROFILE_USER_ID,
false));
verify(mRecoverableKeyStoreManager)
- .lockScreenSecretChanged(
- CREDENTIAL_TYPE_PASSWORD, profilePassword, MANAGED_PROFILE_USER_ID);
+ .lockScreenSecretChanged(CREDENTIAL_TYPE_PASSWORD, profilePassword.getCredential(),
+ MANAGED_PROFILE_USER_ID);
}
public void
testSetLockCredential_forSeparateToUnifiedChallengeProfile_doesNotSendRandomCredential()
throws Exception {
- final String parentPassword = "parentPassword";
- final String profilePassword = "12345";
- initializeStorageWithCredential(
- PRIMARY_USER_ID, parentPassword, CREDENTIAL_TYPE_PASSWORD, 1234);
+ final LockscreenCredential parentPassword = newPassword("parentPassword");
+ final LockscreenCredential profilePassword = newPattern("12345");
+ initializeStorageWithCredential(PRIMARY_USER_ID, parentPassword, 1234);
// Create and verify separate profile credentials.
- testCreateCredential(
- MANAGED_PROFILE_USER_ID,
- profilePassword,
- CREDENTIAL_TYPE_PATTERN,
- PASSWORD_QUALITY_SOMETHING);
+ testCreateCredential(MANAGED_PROFILE_USER_ID, profilePassword);
mService.setSeparateProfileChallengeEnabled(
- MANAGED_PROFILE_USER_ID, false, profilePassword.getBytes());
+ MANAGED_PROFILE_USER_ID, false, profilePassword);
// Called once for setting the initial separate profile credentials and not again during
// unification.
@@ -396,132 +352,121 @@
}
public void testVerifyCredential_forPrimaryUser_sendsCredentials() throws Exception {
- final String password = "password";
- initializeStorageWithCredential(PRIMARY_USER_ID, password, CREDENTIAL_TYPE_PASSWORD, 1234);
+ final LockscreenCredential password = newPassword("password");
+ initializeStorageWithCredential(PRIMARY_USER_ID, password, 1234);
reset(mRecoverableKeyStoreManager);
- mService.verifyCredential(
- password.getBytes(), CREDENTIAL_TYPE_PASSWORD, 1, PRIMARY_USER_ID);
+ mService.verifyCredential(password, 1, PRIMARY_USER_ID);
verify(mRecoverableKeyStoreManager)
.lockScreenSecretAvailable(
- CREDENTIAL_TYPE_PASSWORD, password.getBytes(), PRIMARY_USER_ID);
+ CREDENTIAL_TYPE_PASSWORD, password.getCredential(), PRIMARY_USER_ID);
}
public void testVerifyCredential_forProfileWithSeparateChallenge_sendsCredentials()
throws Exception {
- final byte[] pattern = "12345".getBytes();
+ final LockscreenCredential pattern = newPattern("12345");
assertTrue(mService.setLockCredential(
pattern,
- CREDENTIAL_TYPE_PATTERN,
- null,
- PASSWORD_QUALITY_SOMETHING,
+ nonePassword(),
MANAGED_PROFILE_USER_ID,
false));
reset(mRecoverableKeyStoreManager);
- mService.verifyCredential(pattern, CREDENTIAL_TYPE_PATTERN, 1, MANAGED_PROFILE_USER_ID);
+ mService.verifyCredential(pattern, 1, MANAGED_PROFILE_USER_ID);
verify(mRecoverableKeyStoreManager)
.lockScreenSecretAvailable(
- CREDENTIAL_TYPE_PATTERN, pattern, MANAGED_PROFILE_USER_ID);
+ CREDENTIAL_TYPE_PATTERN, pattern.getCredential(), MANAGED_PROFILE_USER_ID);
}
public void
testVerifyCredential_forPrimaryUserWithUnifiedChallengeProfile_sendsCredentialsForBoth()
throws Exception {
- final String pattern = "12345";
- initializeStorageWithCredential(PRIMARY_USER_ID, pattern, CREDENTIAL_TYPE_PATTERN, 1234);
+ final LockscreenCredential pattern = newPattern("12345");
+ initializeStorageWithCredential(PRIMARY_USER_ID, pattern, 1234);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
reset(mRecoverableKeyStoreManager);
- mService.verifyCredential(pattern.getBytes(), CREDENTIAL_TYPE_PATTERN, 1, PRIMARY_USER_ID);
+ mService.verifyCredential(pattern, 1, PRIMARY_USER_ID);
// Parent sends its credentials for both the parent and profile.
verify(mRecoverableKeyStoreManager)
.lockScreenSecretAvailable(
- CREDENTIAL_TYPE_PATTERN, pattern.getBytes(), PRIMARY_USER_ID);
+ CREDENTIAL_TYPE_PATTERN, pattern.getCredential(), PRIMARY_USER_ID);
verify(mRecoverableKeyStoreManager)
.lockScreenSecretAvailable(
- CREDENTIAL_TYPE_PATTERN, pattern.getBytes(), MANAGED_PROFILE_USER_ID);
+ CREDENTIAL_TYPE_PATTERN, pattern.getCredential(), MANAGED_PROFILE_USER_ID);
// Profile doesn't send its own random credentials.
verify(mRecoverableKeyStoreManager, never())
.lockScreenSecretAvailable(
eq(CREDENTIAL_TYPE_PASSWORD), any(), eq(MANAGED_PROFILE_USER_ID));
}
- private void testCreateCredential(int userId, String credential, int type, int quality)
+ private void testCreateCredential(int userId, LockscreenCredential credential)
throws RemoteException {
- assertTrue(mService.setLockCredential(credential.getBytes(), type, null, quality,
- userId, false));
- assertVerifyCredentials(userId, credential, type, -1);
+ assertTrue(mService.setLockCredential(credential, nonePassword(), userId, false));
+ assertVerifyCredentials(userId, credential, -1);
}
private void testCreateCredentialFailsWithoutLockScreen(
- int userId, String credential, int type, int quality) throws RemoteException {
+ int userId, LockscreenCredential credential) throws RemoteException {
mHasSecureLockScreen = false;
try {
- mService.setLockCredential(credential.getBytes(), type, null, quality,
- userId, false);
+ mService.setLockCredential(credential, null, userId, false);
fail("An exception should have been thrown.");
} catch (UnsupportedOperationException e) {
// Success - the exception was expected.
}
- assertFalse(mService.havePassword(userId));
- assertFalse(mService.havePattern(userId));
+ assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(userId));
}
- private void testChangeCredentials(int userId, String newCredential, int newType,
- String oldCredential, int oldType, int quality) throws RemoteException {
+ private void testChangeCredentials(int userId, LockscreenCredential newCredential,
+ LockscreenCredential oldCredential) throws RemoteException {
final long sid = 1234;
- initializeStorageWithCredential(userId, oldCredential, oldType, sid);
- assertTrue(mService.setLockCredential(newCredential.getBytes(), newType,
- oldCredential.getBytes(), quality, userId, false));
- assertVerifyCredentials(userId, newCredential, newType, sid);
+ initializeStorageWithCredential(userId, oldCredential, sid);
+ assertTrue(mService.setLockCredential(newCredential, oldCredential, userId, false));
+ assertVerifyCredentials(userId, newCredential, sid);
}
- private void assertVerifyCredentials(int userId, String credential, int type, long sid)
+ private void assertVerifyCredentials(int userId, LockscreenCredential credential, long sid)
throws RemoteException{
final long challenge = 54321;
- VerifyCredentialResponse response = mService.verifyCredential(credential.getBytes(),
- type, challenge, userId);
+ VerifyCredentialResponse response = mService.verifyCredential(credential,
+ challenge, userId);
assertEquals(GateKeeperResponse.RESPONSE_OK, response.getResponseCode());
if (sid != -1) assertEquals(sid, mGateKeeperService.getSecureUserId(userId));
- final int incorrectType;
- if (type == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD) {
- assertTrue(mService.havePassword(userId));
- assertFalse(mService.havePattern(userId));
- incorrectType = LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
- } else if (type == LockPatternUtils.CREDENTIAL_TYPE_PATTERN){
- assertFalse(mService.havePassword(userId));
- assertTrue(mService.havePattern(userId));
- incorrectType = LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+ if (credential.isPassword()) {
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, mService.getCredentialType(userId));
+ } else if (credential.isPin()) {
+ assertEquals(CREDENTIAL_TYPE_PIN, mService.getCredentialType(userId));
+ } else if (credential.isPattern()) {
+ assertEquals(CREDENTIAL_TYPE_PATTERN, mService.getCredentialType(userId));
} else {
- assertFalse(mService.havePassword(userId));
- assertFalse(mService.havePassword(userId));
- incorrectType = LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+ assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(userId));
}
- // check for bad type
- assertEquals(GateKeeperResponse.RESPONSE_ERROR, mService.verifyCredential(
- credential.getBytes(), incorrectType, challenge, userId).getResponseCode());
// check for bad credential
+ final LockscreenCredential badCredential;
+ if (!credential.isNone()) {
+ badCredential = credential.duplicate();
+ badCredential.getCredential()[0] ^= 1;
+ } else {
+ badCredential = LockscreenCredential.createPin("0");
+ }
assertEquals(GateKeeperResponse.RESPONSE_ERROR, mService.verifyCredential(
- ("0" + credential).getBytes(), type, challenge, userId).getResponseCode());
+ badCredential, challenge, userId).getResponseCode());
}
- private void initializeStorageWithCredential(int userId, String credential, int type, long sid)
- throws RemoteException {
- byte[] credentialBytes = credential == null ? null : credential.getBytes();
- byte[] oldHash = new VerifyHandle(credential.getBytes(), sid).toBytes();
+ private void initializeStorageWithCredential(int userId, LockscreenCredential credential,
+ long sid) throws RemoteException {
+ byte[] oldHash = new VerifyHandle(credential.getCredential(), sid).toBytes();
if (mService.shouldMigrateToSyntheticPasswordLocked(userId)) {
- mService.initializeSyntheticPasswordLocked(oldHash, credentialBytes, type,
- type == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD ? PASSWORD_QUALITY_ALPHABETIC
- : PASSWORD_QUALITY_SOMETHING, userId);
+ mService.initializeSyntheticPasswordLocked(oldHash, credential, userId);
} else {
- if (type == LockPatternUtils.CREDENTIAL_TYPE_PASSWORD) {
+ if (credential.isPassword() || credential.isPin()) {
mStorage.writeCredentialHash(CredentialHash.create(oldHash,
LockPatternUtils.CREDENTIAL_TYPE_PASSWORD), userId);
} else {
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java
index b60111e..8c2d172 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java
@@ -17,11 +17,13 @@
package com.android.server.locksettings;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
import static junit.framework.Assert.assertEquals;
-import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.never;
@@ -34,6 +36,8 @@
import static java.io.FileDescriptor.out;
import android.app.ActivityManager;
+import android.app.admin.PasswordMetrics;
+import android.app.admin.PasswordPolicy;
import android.content.Context;
import android.os.Binder;
import android.os.Handler;
@@ -88,6 +92,7 @@
@Test
public void testWrongPassword() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
when(mLockPatternUtils.checkCredential(
@@ -95,18 +100,20 @@
assertEquals(-1, mCommand.exec(mBinder, in, out, err,
new String[] { "set-pin", "--old", "1234" },
mShellCallback, mResultReceiver));
- verify(mLockPatternUtils, never()).setLockCredential(any(), any(),
- anyInt(), anyBoolean());
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
}
@Test
public void testChangePin() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
when(mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)).thenReturn(
PASSWORD_QUALITY_NUMERIC);
when(mLockPatternUtils.checkCredential(
LockscreenCredential.createPin("1234"), mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_NUMERIC));
assertEquals(0, mCommand.exec(new Binder(), in, out, err,
new String[] { "set-pin", "--old", "1234", "4321" },
mShellCallback, mResultReceiver));
@@ -117,6 +124,23 @@
}
@Test
+ public void testChangePin_nonCompliant() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)).thenReturn(
+ PASSWORD_QUALITY_NUMERIC);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPin("1234"), mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_ALPHABETIC));
+ assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-pin", "--old", "1234", "4321" },
+ mShellCallback, mResultReceiver));
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
+ }
+
+ @Test
public void testChangePin_noLockScreen() throws Exception {
when(mLockPatternUtils.hasSecureLockScreen()).thenReturn(false);
assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
@@ -128,22 +152,42 @@
@Test
public void testChangePassword() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
when(mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)).thenReturn(
PASSWORD_QUALITY_ALPHABETIC);
when(mLockPatternUtils.checkCredential(
LockscreenCredential.createPassword("1234"), mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_ALPHABETIC));
assertEquals(0, mCommand.exec(new Binder(), in, out, err,
- new String[] { "set-password", "--old", "1234", "4321" },
+ new String[] { "set-password", "--old", "1234", "abcd" },
mShellCallback, mResultReceiver));
verify(mLockPatternUtils).setLockCredential(
- LockscreenCredential.createPassword("4321"),
+ LockscreenCredential.createPassword("abcd"),
LockscreenCredential.createPassword("1234"),
mUserId);
}
@Test
+ public void testChangePassword_nonCompliant() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)).thenReturn(
+ PASSWORD_QUALITY_ALPHABETIC);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPassword("1234"), mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_COMPLEX));
+ assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-password", "--old", "1234", "weakpassword" },
+ mShellCallback, mResultReceiver));
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
+ }
+
+ @Test
public void testChangePassword_noLockScreen() throws Exception {
when(mLockPatternUtils.hasSecureLockScreen()).thenReturn(false);
assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
@@ -155,11 +199,14 @@
@Test
public void testChangePattern() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(false);
when(mLockPatternUtils.checkCredential(
LockscreenCredential.createPattern(stringToPattern("1234")),
mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_SOMETHING));
assertEquals(0, mCommand.exec(new Binder(), in, out, err,
new String[] { "set-pattern", "--old", "1234", "4321" },
mShellCallback, mResultReceiver));
@@ -170,6 +217,22 @@
}
@Test
+ public void testChangePattern_nonCompliant() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPattern(stringToPattern("1234")),
+ mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_NUMERIC));
+ assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-pattern", "--old", "1234", "4321" },
+ mShellCallback, mResultReceiver));
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
+ }
+
+ @Test
public void testChangePattern_noLockScreen() throws Exception {
when(mLockPatternUtils.hasSecureLockScreen()).thenReturn(false);
assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
@@ -181,11 +244,14 @@
@Test
public void testClear() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(true);
when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(false);
when(mLockPatternUtils.checkCredential(
LockscreenCredential.createPattern(stringToPattern("1234")),
mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_UNSPECIFIED));
assertEquals(0, mCommand.exec(new Binder(), in, out, err,
new String[] { "clear", "--old", "1234" },
mShellCallback, mResultReceiver));
@@ -195,7 +261,29 @@
mUserId);
}
+ @Test
+ public void testClear_nonCompliant() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPattern(stringToPattern("1234")),
+ mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_SOMETHING));
+ assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "clear", "--old", "1234" },
+ mShellCallback, mResultReceiver));
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
+ }
+
private List<LockPatternView.Cell> stringToPattern(String str) {
return LockPatternUtils.byteArrayToPattern(str.getBytes());
}
+
+ private PasswordMetrics metricsForAdminQuality(int quality) {
+ PasswordPolicy policy = new PasswordPolicy();
+ policy.quality = quality;
+ return policy.getMinMetrics();
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java
index bc61c58..1581d9a 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java
@@ -16,20 +16,51 @@
package com.android.server.locksettings;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+
import android.content.Context;
import com.android.server.PersistentDataBlockManagerInternal;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
import java.io.File;
+import java.util.Arrays;
public class LockSettingsStorageTestable extends LockSettingsStorage {
public File mStorageDir;
- public PersistentDataBlockManagerInternal mPersistentDataBlock;
+ public PersistentDataBlockManagerInternal mPersistentDataBlockManager;
+ private byte[] mPersistentData;
public LockSettingsStorageTestable(Context context, File storageDir) {
super(context);
mStorageDir = storageDir;
+ mPersistentDataBlockManager = mock(PersistentDataBlockManagerInternal.class);
+ doAnswer(new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ byte[] handle = (byte[]) invocation.getArguments()[0];
+ if (handle != null) {
+ mPersistentData = Arrays.copyOf(handle, handle.length);
+ } else {
+ mPersistentData = null;
+ }
+ return null;
+ }
+ }).when(mPersistentDataBlockManager).setFrpCredentialHandle(any());
+ // For some reasons, simply mocking getFrpCredentialHandle() with
+ // when(mPersistentDataBlockManager.getFrpCredentialHandle()).thenReturn(mPersistentData)
+ // does not work, I had to use the long-winded way below.
+ doAnswer(new Answer<byte[]>() {
+ @Override
+ public byte[] answer(InvocationOnMock invocation) throws Throwable {
+ return mPersistentData;
+ }
+ }).when(mPersistentDataBlockManager).getFrpCredentialHandle();
}
@Override
@@ -57,8 +88,8 @@
}
@Override
- public PersistentDataBlockManagerInternal getPersistentDataBlock() {
- return mPersistentDataBlock;
+ PersistentDataBlockManagerInternal getPersistentDataBlockManager() {
+ return mPersistentDataBlockManager;
}
private File makeDirs(File baseDir, String filePath) {
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java
index cb51897..7a18431 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java
@@ -240,12 +240,12 @@
writePasswordBytes(PASSWORD_0, 10);
writePatternBytes(PATTERN_0, 20);
- assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
+ assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN,
mStorage.readCredentialHash(10).type);
assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
mStorage.readCredentialHash(20).type);
mStorage.clearCache();
- assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
+ assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN,
mStorage.readCredentialHash(10).type);
assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
mStorage.readCredentialHash(20).type);
@@ -352,20 +352,20 @@
}
public void testPersistentDataBlock_unavailable() {
- mStorage.mPersistentDataBlock = null;
+ mStorage.mPersistentDataBlockManager = null;
assertSame(PersistentData.NONE, mStorage.readPersistentDataBlock());
}
public void testPersistentDataBlock_empty() {
- mStorage.mPersistentDataBlock = mock(PersistentDataBlockManagerInternal.class);
+ mStorage.mPersistentDataBlockManager = mock(PersistentDataBlockManagerInternal.class);
assertSame(PersistentData.NONE, mStorage.readPersistentDataBlock());
}
public void testPersistentDataBlock_withData() {
- mStorage.mPersistentDataBlock = mock(PersistentDataBlockManagerInternal.class);
- when(mStorage.mPersistentDataBlock.getFrpCredentialHandle())
+ mStorage.mPersistentDataBlockManager = mock(PersistentDataBlockManagerInternal.class);
+ when(mStorage.mPersistentDataBlockManager.getFrpCredentialHandle())
.thenReturn(PersistentData.toBytes(PersistentData.TYPE_SP_WEAVER, SOME_USER_ID,
DevicePolicyManager.PASSWORD_QUALITY_COMPLEX, PAYLOAD));
@@ -378,8 +378,8 @@
}
public void testPersistentDataBlock_exception() {
- mStorage.mPersistentDataBlock = mock(PersistentDataBlockManagerInternal.class);
- when(mStorage.mPersistentDataBlock.getFrpCredentialHandle())
+ mStorage.mPersistentDataBlockManager = mock(PersistentDataBlockManagerInternal.class);
+ when(mStorage.mPersistentDataBlockManager.getFrpCredentialHandle())
.thenThrow(new IllegalStateException("oops"));
assertSame(PersistentData.NONE, mStorage.readPersistentDataBlock());
}
@@ -453,7 +453,7 @@
private void assertPasswordBytes(byte[] password, int userId) {
CredentialHash cred = mStorage.readCredentialHash(userId);
- assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, cred.type);
+ assertEquals(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN, cred.type);
assertArrayEquals(password, cred.hash);
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockscreenFrpTest.java b/services/tests/servicestests/src/com/android/server/locksettings/LockscreenFrpTest.java
new file mode 100644
index 0000000..df719b6d
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockscreenFrpTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.locksettings;
+
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
+import static com.android.internal.widget.LockPatternUtils.USER_FRP;
+
+import android.app.admin.DevicePolicyManager;
+
+import com.android.internal.widget.VerifyCredentialResponse;
+import com.android.server.locksettings.LockSettingsStorage.PersistentData;
+
+
+/** Test setting a lockscreen credential and then verify it under USER_FRP */
+public class LockscreenFrpTest extends BaseLockSettingsServiceTests {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ // FRP credential can only be verified prior to provisioning
+ mSettings.setDeviceProvisioned(false);
+ }
+
+ public void testFrpCredential_setPin() {
+ mService.setLockCredential(newPin("1234"), nonePassword(), PRIMARY_USER_ID, false);
+
+ assertEquals(CREDENTIAL_TYPE_PIN, mService.getCredentialType(USER_FRP));
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK,
+ mService.verifyCredential(newPin("1234"), 0, USER_FRP).getResponseCode());
+ }
+
+ public void testFrpCredential_setPattern() {
+ mService.setLockCredential(newPattern("4321"), nonePassword(), PRIMARY_USER_ID, false);
+
+ assertEquals(CREDENTIAL_TYPE_PATTERN, mService.getCredentialType(USER_FRP));
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK,
+ mService.verifyCredential(newPattern("4321"), 0, USER_FRP).getResponseCode());
+ }
+
+ public void testFrpCredential_setPassword() {
+ mService.setLockCredential(newPassword("4321"), nonePassword(), PRIMARY_USER_ID, false);
+
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, mService.getCredentialType(USER_FRP));
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK,
+ mService.verifyCredential(newPassword("4321"), 0, USER_FRP).getResponseCode());
+ }
+
+ public void testFrpCredential_changeCredential() {
+ mService.setLockCredential(newPassword("1234"), nonePassword(), PRIMARY_USER_ID, false);
+ mService.setLockCredential(newPattern("5678"), newPassword("1234"), PRIMARY_USER_ID, false);
+
+ assertEquals(CREDENTIAL_TYPE_PATTERN, mService.getCredentialType(USER_FRP));
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK,
+ mService.verifyCredential(newPattern("5678"), 0, USER_FRP).getResponseCode());
+ }
+
+ public void testFrpCredential_removeCredential() {
+ mService.setLockCredential(newPassword("1234"), nonePassword(), PRIMARY_USER_ID, false);
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, mService.getCredentialType(USER_FRP));
+
+ mService.setLockCredential(nonePassword(), newPassword("1234"), PRIMARY_USER_ID, false);
+ assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(USER_FRP));
+ }
+
+ public void testFrpCredential_cannotVerifyAfterProvsioning() {
+ mService.setLockCredential(newPin("1234"), nonePassword(), PRIMARY_USER_ID, false);
+
+ mSettings.setDeviceProvisioned(true);
+ assertEquals(VerifyCredentialResponse.RESPONSE_ERROR,
+ mService.verifyCredential(newPin("1234"), 0, USER_FRP).getResponseCode());
+ }
+
+ public void testFrpCredential_legacyPinTypePersistentData() {
+ mService.setLockCredential(newPin("1234"), nonePassword(), PRIMARY_USER_ID, false);
+ PersistentData data = mStorage.readPersistentDataBlock();
+ // Tweak the existing persistent data to make it look like one with legacy credential type
+ assertEquals(CREDENTIAL_TYPE_PIN, data.payload[3]);
+ data.payload[3] = CREDENTIAL_TYPE_PASSWORD_OR_PIN;
+ mStorage.writePersistentDataBlock(data.type, data.userId,
+ DevicePolicyManager.PASSWORD_QUALITY_NUMERIC, data.payload);
+
+ assertEquals(CREDENTIAL_TYPE_PIN, mService.getCredentialType(USER_FRP));
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK,
+ mService.verifyCredential(newPin("1234"), 0, USER_FRP).getResponseCode());
+
+ }
+
+ public void testFrpCredential_legacyPasswordTypePersistentData() {
+ mService.setLockCredential(newPassword("1234"), nonePassword(), PRIMARY_USER_ID, false);
+ PersistentData data = mStorage.readPersistentDataBlock();
+ // Tweak the existing persistent data to make it look like one with legacy credential type
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, data.payload[3]);
+ data.payload[3] = CREDENTIAL_TYPE_PASSWORD_OR_PIN;
+ mStorage.writePersistentDataBlock(data.type, data.userId,
+ DevicePolicyManager.PASSWORD_QUALITY_COMPLEX, data.payload);
+
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, mService.getCredentialType(USER_FRP));
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK,
+ mService.verifyCredential(newPin("1234"), 0, USER_FRP).getResponseCode());
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
index 42ca42a..89a279c 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
@@ -16,11 +16,9 @@
package com.android.server.locksettings;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
-
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN;
import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_ENABLED_KEY;
import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_HANDLE_KEY;
@@ -38,7 +36,6 @@
import androidx.test.filters.SmallTest;
-import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.server.locksettings.SyntheticPasswordManager.AuthenticationResult;
@@ -72,15 +69,14 @@
public void testPasswordBasedSyntheticPassword() throws RemoteException {
final int USER_ID = 10;
- final byte[] password = "user-password".getBytes();
- final byte[] badPassword = "bad-password".getBytes();
+ final LockscreenCredential password = newPassword("user-password");
+ final LockscreenCredential badPassword = newPassword("bad-password");
MockSyntheticPasswordManager manager = new MockSyntheticPasswordManager(mContext, mStorage,
mGateKeeperService, mUserManager, mPasswordSlotManager);
AuthenticationToken authToken = manager.newSyntheticPasswordAndSid(mGateKeeperService, null,
null, USER_ID);
long handle = manager.createPasswordBasedSyntheticPassword(mGateKeeperService,
- password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, authToken,
- PASSWORD_QUALITY_ALPHABETIC, USER_ID);
+ password, authToken, USER_ID);
AuthenticationResult result = manager.unwrapPasswordBasedSyntheticPassword(
mGateKeeperService, handle, password, USER_ID, null);
@@ -105,97 +101,90 @@
}
public void testPasswordMigration() throws RemoteException {
- final byte[] password = "testPasswordMigration-password".getBytes();
+ final LockscreenCredential password = newPassword("testPasswordMigration-password");
disableSyntheticPassword();
- mService.setLockCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
+ assertTrue(mService.setLockCredential(password, nonePassword(), PRIMARY_USER_ID, false));
long sid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
final byte[] primaryStorageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
enableSyntheticPassword();
// Performs migration
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
assertEquals(sid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertTrue(hasSyntheticPassword(PRIMARY_USER_ID));
// SP-based verification
- assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(password,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
assertArrayNotEquals(primaryStorageKey,
mStorageManager.getUserUnlockToken(PRIMARY_USER_ID));
}
- protected void initializeCredentialUnderSP(byte[] password, int userId) throws RemoteException {
+ protected void initializeCredentialUnderSP(LockscreenCredential password, int userId)
+ throws RemoteException {
enableSyntheticPassword();
- int quality = password != null ? PASSWORD_QUALITY_ALPHABETIC
- : PASSWORD_QUALITY_UNSPECIFIED;
- int type = password != null ? LockPatternUtils.CREDENTIAL_TYPE_PASSWORD
- : LockPatternUtils.CREDENTIAL_TYPE_NONE;
- mService.setLockCredential(password, type, null, quality, userId, false);
+ mService.setLockCredential(password, nonePassword(), userId, false);
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, mService.getCredentialType(userId));
+ assertTrue(mService.isSyntheticPasswordBasedCredential(userId));
}
public void testSyntheticPasswordChangeCredential() throws RemoteException {
- final byte[] password = "testSyntheticPasswordChangeCredential-password".getBytes();
- final byte[] newPassword = "testSyntheticPasswordChangeCredential-newpassword".getBytes();
+ final LockscreenCredential password = newPassword("password");
+ final LockscreenCredential newPassword = newPassword("newpassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
long sid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
- mService.setLockCredential(newPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, password,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
+ mService.setLockCredential(newPassword, password, PRIMARY_USER_ID, false);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- newPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ newPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
assertEquals(sid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
}
public void testSyntheticPasswordVerifyCredential() throws RemoteException {
- final byte[] password = "testSyntheticPasswordVerifyCredential-password".getBytes();
- final byte[] badPassword = "testSyntheticPasswordVerifyCredential-badpassword".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential badPassword = newPassword("badpassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
assertEquals(VerifyCredentialResponse.RESPONSE_ERROR, mService.verifyCredential(
- badPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ badPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
}
public void testSyntheticPasswordClearCredential() throws RemoteException {
- final byte[] password = "testSyntheticPasswordClearCredential-password".getBytes();
- final byte[] badPassword = "testSyntheticPasswordClearCredential-newpassword".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential badPassword = newPassword("newpassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
long sid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
// clear password
- mService.setLockCredential(null, LockPatternUtils.CREDENTIAL_TYPE_NONE, password,
- PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID, false);
+ mService.setLockCredential(nonePassword(), password, PRIMARY_USER_ID, false);
assertEquals(0 ,mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
// set a new password
- mService.setLockCredential(badPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
+ mService.setLockCredential(badPassword, nonePassword(),
+ PRIMARY_USER_ID, false);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- badPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ badPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
assertNotEquals(sid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
}
public void testSyntheticPasswordChangeCredentialKeepsAuthSecret() throws RemoteException {
- final byte[] password =
- "testSyntheticPasswordChangeCredentialKeepsAuthSecret-password".getBytes();
- final byte[] badPassword =
- "testSyntheticPasswordChangeCredentialKeepsAuthSecret-new".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential badPassword = newPassword("new");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
- mService.setLockCredential(badPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, password,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
+ mService.setLockCredential(badPassword, password, PRIMARY_USER_ID, false);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- badPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ badPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
// Check the same secret was passed each time
@@ -205,41 +194,35 @@
}
public void testSyntheticPasswordVerifyPassesPrimaryUserAuthSecret() throws RemoteException {
- final byte[] password =
- "testSyntheticPasswordVerifyPassesPrimaryUserAuthSecret-password".getBytes();
- final byte[] newPassword =
- "testSyntheticPasswordVerifyPassesPrimaryUserAuthSecret-new".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential newPassword = newPassword("new");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
reset(mAuthSecretService);
- assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(password,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
verify(mAuthSecretService).primaryUserCredential(any(ArrayList.class));
}
public void testSecondaryUserDoesNotPassAuthSecret() throws RemoteException {
- final byte[] password = "testSecondaryUserDoesNotPassAuthSecret-password".getBytes();
+ LockscreenCredential password = newPassword("password");
initializeCredentialUnderSP(password, SECONDARY_USER_ID);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, SECONDARY_USER_ID)
+ password, 0, SECONDARY_USER_ID)
.getResponseCode());
verify(mAuthSecretService, never()).primaryUserCredential(any(ArrayList.class));
}
public void testNoSyntheticPasswordOrCredentialDoesNotPassAuthSecret() throws RemoteException {
- // Setting null doesn't create a synthetic password
- initializeCredentialUnderSP(null, PRIMARY_USER_ID);
-
- reset(mAuthSecretService);
mService.onUnlockUser(PRIMARY_USER_ID);
flushHandlerTasks();
verify(mAuthSecretService, never()).primaryUserCredential(any(ArrayList.class));
}
public void testSyntheticPasswordAndCredentialDoesNotPassAuthSecret() throws RemoteException {
- final byte[] password = "passwordForASyntheticPassword".getBytes();
+ LockscreenCredential password = newPassword("passwordForASyntheticPassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
reset(mAuthSecretService);
@@ -249,10 +232,9 @@
}
public void testSyntheticPasswordButNoCredentialPassesAuthSecret() throws RemoteException {
- final byte[] password = "getASyntheticPassword".getBytes();
+ LockscreenCredential password = newPassword("getASyntheticPassword");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
- mService.setLockCredential(null, LockPatternUtils.CREDENTIAL_TYPE_NONE, password,
- PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID, false);
+ mService.setLockCredential(nonePassword(), password, PRIMARY_USER_ID, false);
reset(mAuthSecretService);
mService.onUnlockUser(PRIMARY_USER_ID);
@@ -261,15 +243,14 @@
}
public void testManagedProfileUnifiedChallengeMigration() throws RemoteException {
- final byte[] UnifiedPassword = "testManagedProfileUnifiedChallengeMigration-pwd".getBytes();
+ LockscreenCredential UnifiedPassword = newPassword("unified-pwd");
disableSyntheticPassword();
- mService.setLockCredential(UnifiedPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
+ mService.setLockCredential(UnifiedPassword, nonePassword(), PRIMARY_USER_ID, false);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
final long primarySid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
final long profileSid = mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID);
- final byte[] primaryStorageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
- final byte[] profileStorageKey = mStorageManager.getUserUnlockToken(MANAGED_PROFILE_USER_ID);
+ byte[] primaryStorageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
+ byte[] profileStorageKey = mStorageManager.getUserUnlockToken(MANAGED_PROFILE_USER_ID);
assertTrue(primarySid != 0);
assertTrue(profileSid != 0);
assertTrue(profileSid != primarySid);
@@ -277,12 +258,12 @@
// do migration
enableSyntheticPassword();
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- UnifiedPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ UnifiedPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
// verify
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- UnifiedPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ UnifiedPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
assertEquals(primarySid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertEquals(profileSid, mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID));
@@ -295,19 +276,16 @@
}
public void testManagedProfileSeparateChallengeMigration() throws RemoteException {
- final byte[] primaryPassword =
- "testManagedProfileSeparateChallengeMigration-primary".getBytes();
- final byte[] profilePassword =
- "testManagedProfileSeparateChallengeMigration-profile".getBytes();
+ LockscreenCredential primaryPassword = newPassword("primary");
+ LockscreenCredential profilePassword = newPassword("profile");
disableSyntheticPassword();
- mService.setLockCredential(primaryPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
- mService.setLockCredential(profilePassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, MANAGED_PROFILE_USER_ID, false);
+ mService.setLockCredential(primaryPassword, nonePassword(), PRIMARY_USER_ID, false);
+ mService.setLockCredential(profilePassword, nonePassword(),
+ MANAGED_PROFILE_USER_ID, false);
final long primarySid = mGateKeeperService.getSecureUserId(PRIMARY_USER_ID);
final long profileSid = mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID);
- final byte[] primaryStorageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
- final byte[] profileStorageKey = mStorageManager.getUserUnlockToken(MANAGED_PROFILE_USER_ID);
+ byte[] primaryStorageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
+ byte[] profileStorageKey = mStorageManager.getUserUnlockToken(MANAGED_PROFILE_USER_ID);
assertTrue(primarySid != 0);
assertTrue(profileSid != 0);
assertTrue(profileSid != primarySid);
@@ -315,19 +293,19 @@
// do migration
enableSyntheticPassword();
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- primaryPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ primaryPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- profilePassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
- 0, MANAGED_PROFILE_USER_ID).getResponseCode());
+ profilePassword, 0, MANAGED_PROFILE_USER_ID)
+ .getResponseCode());
// verify
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- primaryPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
- .getResponseCode());
+ primaryPassword, 0, PRIMARY_USER_ID)
+ .getResponseCode());
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- profilePassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
- 0, MANAGED_PROFILE_USER_ID).getResponseCode());
+ profilePassword, 0, MANAGED_PROFILE_USER_ID)
+ .getResponseCode());
assertEquals(primarySid, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertEquals(profileSid, mGateKeeperService.getSecureUserId(MANAGED_PROFILE_USER_ID));
assertArrayNotEquals(primaryStorageKey,
@@ -339,101 +317,92 @@
}
public void testTokenBasedResetPassword() throws RemoteException {
- final byte[] password = "password".getBytes();
- final byte[] pattern = "123654".getBytes();
- final byte[] token = "some-high-entropy-secure-token".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential pattern = newPattern("123654");
+ byte[] token = "some-high-entropy-secure-token".getBytes();
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
// Disregard any reportPasswordChanged() invocations as part of credential setup.
flushHandlerTasks();
reset(mDevicePolicyManager);
- final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
+ byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
assertFalse(mService.hasPendingEscrowToken(PRIMARY_USER_ID));
long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
assertTrue(mService.hasPendingEscrowToken(PRIMARY_USER_ID));
- mService.verifyCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0,
- PRIMARY_USER_ID).getResponseCode();
+ mService.verifyCredential(password, 0, PRIMARY_USER_ID).getResponseCode();
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
assertFalse(mService.hasPendingEscrowToken(PRIMARY_USER_ID));
- mLocalService.setLockCredentialWithToken(pattern, LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
- handle, token, PASSWORD_QUALITY_SOMETHING, PRIMARY_USER_ID);
+ mLocalService.setLockCredentialWithToken(pattern, handle, token, PRIMARY_USER_ID);
// Verify DPM gets notified about new device lock
flushHandlerTasks();
- final PasswordMetrics metric = PasswordMetrics.computeForCredential(
- LockscreenCredential.createPattern(LockPatternUtils.byteArrayToPattern(pattern)));
+ final PasswordMetrics metric = PasswordMetrics.computeForCredential(pattern);
assertEquals(metric, mService.getUserPasswordMetrics(PRIMARY_USER_ID));
verify(mDevicePolicyManager).reportPasswordChanged(PRIMARY_USER_ID);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- pattern, LockPatternUtils.CREDENTIAL_TYPE_PATTERN, 0, PRIMARY_USER_ID)
+ pattern, 0, PRIMARY_USER_ID)
.getResponseCode());
assertArrayEquals(storageKey, mStorageManager.getUserUnlockToken(PRIMARY_USER_ID));
}
public void testTokenBasedClearPassword() throws RemoteException {
- final byte[] password = "password".getBytes();
- final byte[] pattern = "123654".getBytes();
- final byte[] token = "some-high-entropy-secure-token".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential pattern = newPattern("123654");
+ byte[] token = "some-high-entropy-secure-token".getBytes();
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
- final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
+ byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
- mService.verifyCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
- 0, PRIMARY_USER_ID).getResponseCode();
+ mService.verifyCredential(password, 0, PRIMARY_USER_ID).getResponseCode();
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
- mLocalService.setLockCredentialWithToken(null, LockPatternUtils.CREDENTIAL_TYPE_NONE,
- handle, token, PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID);
+ mLocalService.setLockCredentialWithToken(nonePassword(), handle, token, PRIMARY_USER_ID);
flushHandlerTasks(); // flush the unlockUser() call before changing password again
- mLocalService.setLockCredentialWithToken(pattern, LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
- handle, token, PASSWORD_QUALITY_SOMETHING, PRIMARY_USER_ID);
+ mLocalService.setLockCredentialWithToken(pattern, handle, token,
+ PRIMARY_USER_ID);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- pattern, LockPatternUtils.CREDENTIAL_TYPE_PATTERN, 0, PRIMARY_USER_ID)
+ pattern, 0, PRIMARY_USER_ID)
.getResponseCode());
assertArrayEquals(storageKey, mStorageManager.getUserUnlockToken(PRIMARY_USER_ID));
}
public void testTokenBasedResetPasswordAfterCredentialChanges() throws RemoteException {
- final byte[] password = "password".getBytes();
- final byte[] pattern = "123654".getBytes();
- final byte[] newPassword = "password".getBytes();
- final byte[] token = "some-high-entropy-secure-token".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential pattern = newPattern("123654");
+ LockscreenCredential newPassword = newPassword("password");
+ byte[] token = "some-high-entropy-secure-token".getBytes();
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
- final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
+ byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
- mService.verifyCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
- 0, PRIMARY_USER_ID).getResponseCode();
+ mService.verifyCredential(password, 0, PRIMARY_USER_ID).getResponseCode();
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
- mService.setLockCredential(pattern, LockPatternUtils.CREDENTIAL_TYPE_PATTERN, password,
- PASSWORD_QUALITY_SOMETHING, PRIMARY_USER_ID, false);
+ mService.setLockCredential(pattern, password, PRIMARY_USER_ID, false);
- mLocalService.setLockCredentialWithToken(newPassword,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, handle, token,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID);
+ mLocalService.setLockCredentialWithToken(newPassword, handle, token, PRIMARY_USER_ID);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- newPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ newPassword, 0, PRIMARY_USER_ID)
.getResponseCode());
assertArrayEquals(storageKey, mStorageManager.getUserUnlockToken(PRIMARY_USER_ID));
}
public void testEscrowTokenActivatedImmediatelyIfNoUserPasswordNeedsMigration()
throws RemoteException {
- final String token = "some-high-entropy-secure-token";
+ final byte[] token = "some-high-entropy-secure-token".getBytes();
enableSyntheticPassword();
- long handle = mLocalService.addEscrowToken(token.getBytes(), PRIMARY_USER_ID, null);
+ long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertTrue(hasSyntheticPassword(PRIMARY_USER_ID));
@@ -441,9 +410,15 @@
public void testEscrowTokenActivatedImmediatelyIfNoUserPasswordNoMigration()
throws RemoteException {
- final String token = "some-high-entropy-secure-token";
- initializeCredentialUnderSP(null, PRIMARY_USER_ID);
- long handle = mLocalService.addEscrowToken(token.getBytes(), PRIMARY_USER_ID, null);
+ final byte[] token = "some-high-entropy-secure-token".getBytes();
+ // By first setting a password and then clearing it, we enter the state where SP is
+ // initialized but the user currently has no password
+ initializeCredentialUnderSP(newPassword("password"), PRIMARY_USER_ID);
+ assertTrue(mService.setLockCredential(nonePassword(), newPassword("password"),
+ PRIMARY_USER_ID, false));
+ assertTrue(mService.isSyntheticPasswordBasedCredential(PRIMARY_USER_ID));
+
+ long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
assertTrue(hasSyntheticPassword(PRIMARY_USER_ID));
@@ -451,12 +426,11 @@
public void testEscrowTokenActivatedLaterWithUserPasswordNeedsMigration()
throws RemoteException {
- final byte[] token = "some-high-entropy-secure-token".getBytes();
- final byte[] password = "password".getBytes();
+ byte[] token = "some-high-entropy-secure-token".getBytes();
+ LockscreenCredential password = newPassword("password");
// Set up pre-SP user password
disableSyntheticPassword();
- mService.setLockCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
+ mService.setLockCredential(password, nonePassword(), PRIMARY_USER_ID, false);
enableSyntheticPassword();
long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
@@ -464,14 +438,14 @@
assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
// Activate token (password gets migrated to SP at the same time)
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
// Verify token is activated
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
}
public void testEscrowTokenCannotBeActivatedOnUnmanagedUser() {
- final byte[] token = "some-high-entropy-secure-token".getBytes();
+ byte[] token = "some-high-entropy-secure-token".getBytes();
when(mUserManagerInternal.isDeviceManaged()).thenReturn(false);
when(mUserManagerInternal.isUserManaged(PRIMARY_USER_ID)).thenReturn(false);
when(mDeviceStateCache.isDeviceProvisioned()).thenReturn(true);
@@ -483,9 +457,9 @@
}
public void testSetLockCredentialWithTokenFailsWithoutLockScreen() throws Exception {
- final byte[] password = "password".getBytes();
- final byte[] pattern = "123654".getBytes();
- final byte[] token = "some-high-entropy-secure-token".getBytes();
+ LockscreenCredential password = newPassword("password");
+ LockscreenCredential pattern = newPattern("123654");
+ byte[] token = "some-high-entropy-secure-token".getBytes();
mHasSecureLockScreen = false;
enableSyntheticPassword();
@@ -493,57 +467,50 @@
assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
try {
- mLocalService.setLockCredentialWithToken(password,
- LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, handle, token,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID);
+ mLocalService.setLockCredentialWithToken(password, handle, token, PRIMARY_USER_ID);
fail("An exception should have been thrown.");
} catch (UnsupportedOperationException e) {
// Success - the exception was expected.
}
- assertFalse(mService.havePassword(PRIMARY_USER_ID));
+ assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(PRIMARY_USER_ID));
try {
- mLocalService.setLockCredentialWithToken(pattern,
- LockPatternUtils.CREDENTIAL_TYPE_PATTERN, handle, token,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID);
+ mLocalService.setLockCredentialWithToken(pattern, handle, token, PRIMARY_USER_ID);
fail("An exception should have been thrown.");
} catch (UnsupportedOperationException e) {
// Success - the exception was expected.
}
- assertFalse(mService.havePattern(PRIMARY_USER_ID));
+ assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(PRIMARY_USER_ID));
}
public void testGetHashFactorPrimaryUser() throws RemoteException {
- final byte[] password = "password".getBytes();
- mService.setLockCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
- final byte[] hashFactor = mService.getHashFactor(password, PRIMARY_USER_ID);
+ LockscreenCredential password = newPassword("password");
+ mService.setLockCredential(password, nonePassword(), PRIMARY_USER_ID, false);
+ byte[] hashFactor = mService.getHashFactor(password, PRIMARY_USER_ID);
assertNotNull(hashFactor);
- mService.setLockCredential(null, LockPatternUtils.CREDENTIAL_TYPE_NONE,
- password, PASSWORD_QUALITY_UNSPECIFIED, PRIMARY_USER_ID, false);
- final byte[] newHashFactor = mService.getHashFactor(null, PRIMARY_USER_ID);
+ mService.setLockCredential(nonePassword(), password, PRIMARY_USER_ID, false);
+ byte[] newHashFactor = mService.getHashFactor(nonePassword(), PRIMARY_USER_ID);
assertNotNull(newHashFactor);
// Hash factor should never change after password change/removal
assertArrayEquals(hashFactor, newHashFactor);
}
public void testGetHashFactorManagedProfileUnifiedChallenge() throws RemoteException {
- final byte[] pattern = "1236".getBytes();
- mService.setLockCredential(pattern, LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
- null, PASSWORD_QUALITY_SOMETHING, PRIMARY_USER_ID, false);
+ LockscreenCredential pattern = newPattern("1236");
+ mService.setLockCredential(pattern, nonePassword(), PRIMARY_USER_ID, false);
mService.setSeparateProfileChallengeEnabled(MANAGED_PROFILE_USER_ID, false, null);
assertNotNull(mService.getHashFactor(null, MANAGED_PROFILE_USER_ID));
}
public void testGetHashFactorManagedProfileSeparateChallenge() throws RemoteException {
- final byte[] primaryPassword = "primary".getBytes();
- final byte[] profilePassword = "profile".getBytes();
- mService.setLockCredential(primaryPassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID, false);
- mService.setLockCredential(profilePassword, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, null,
- PASSWORD_QUALITY_ALPHABETIC, MANAGED_PROFILE_USER_ID, false);
- assertNotNull(mService.getHashFactor(profilePassword, MANAGED_PROFILE_USER_ID));
+ LockscreenCredential primaryPassword = newPassword("primary");
+ LockscreenCredential profilePassword = newPassword("profile");
+ mService.setLockCredential(primaryPassword, nonePassword(), PRIMARY_USER_ID, false);
+ mService.setLockCredential(profilePassword, nonePassword(),
+ MANAGED_PROFILE_USER_ID, false);
+ assertNotNull(
+ mService.getHashFactor(profilePassword, MANAGED_PROFILE_USER_ID));
}
public void testPasswordData_serializeDeserialize() {
@@ -551,7 +518,7 @@
data.scryptN = 11;
data.scryptR = 22;
data.scryptP = 33;
- data.passwordType = CREDENTIAL_TYPE_PASSWORD;
+ data.credentialType = CREDENTIAL_TYPE_PASSWORD;
data.salt = PAYLOAD;
data.passwordHandle = PAYLOAD2;
@@ -560,7 +527,7 @@
assertEquals(11, deserialized.scryptN);
assertEquals(22, deserialized.scryptR);
assertEquals(33, deserialized.scryptP);
- assertEquals(CREDENTIAL_TYPE_PASSWORD, deserialized.passwordType);
+ assertEquals(CREDENTIAL_TYPE_PASSWORD, deserialized.credentialType);
assertArrayEquals(PAYLOAD, deserialized.salt);
assertArrayEquals(PAYLOAD2, deserialized.passwordHandle);
}
@@ -569,7 +536,7 @@
// Test that we can deserialize existing PasswordData and don't inadvertently change the
// wire format.
byte[] serialized = new byte[] {
- 0, 0, 0, 2, /* CREDENTIAL_TYPE_PASSWORD */
+ 0, 0, 0, 2, /* CREDENTIAL_TYPE_PASSWORD_OR_PIN */
11, /* scryptN */
22, /* scryptR */
33, /* scryptP */
@@ -583,7 +550,7 @@
assertEquals(11, deserialized.scryptN);
assertEquals(22, deserialized.scryptR);
assertEquals(33, deserialized.scryptP);
- assertEquals(CREDENTIAL_TYPE_PASSWORD, deserialized.passwordType);
+ assertEquals(CREDENTIAL_TYPE_PASSWORD_OR_PIN, deserialized.credentialType);
assertArrayEquals(PAYLOAD, deserialized.salt);
assertArrayEquals(PAYLOAD2, deserialized.passwordHandle);
}
@@ -591,11 +558,11 @@
public void testGsiDisablesAuthSecret() throws RemoteException {
mGsiService.setIsGsiRunning(true);
- final byte[] password = "testGsiDisablesAuthSecret-password".getBytes();
+ LockscreenCredential password = newPassword("testGsiDisablesAuthSecret-password");
initializeCredentialUnderSP(password, PRIMARY_USER_ID);
assertEquals(VerifyCredentialResponse.RESPONSE_OK, mService.verifyCredential(
- password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0, PRIMARY_USER_ID)
+ password, 0, PRIMARY_USER_ID)
.getResponseCode());
verify(mAuthSecretService, never()).primaryUserCredential(any(ArrayList.class));
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java
index a992dd1..7d3ec03 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java
@@ -23,6 +23,7 @@
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
import static com.google.common.truth.Truth.assertThat;
@@ -31,7 +32,6 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -162,21 +162,6 @@
}
@Test
- public void isPin_isTrueForNumericString() {
- assertTrue(KeySyncTask.isPin("3298432574398654376547".getBytes()));
- }
-
- @Test
- public void isPin_isFalseForStringContainingLetters() {
- assertFalse(KeySyncTask.isPin("398i54369548654".getBytes()));
- }
-
- @Test
- public void isPin_isFalseForStringContainingSymbols() {
- assertFalse(KeySyncTask.isPin("-3987543643".getBytes()));
- }
-
- @Test
public void hashCredentialsBySaltedSha256_returnsSameHashForSameCredentialsAndSalt() {
String credentials = "password1234";
byte[] salt = randomBytes(16);
@@ -221,19 +206,19 @@
@Test
public void getUiFormat_returnsPinIfPin() {
assertEquals(UI_FORMAT_PIN,
- KeySyncTask.getUiFormat(CREDENTIAL_TYPE_PASSWORD, "1234".getBytes()));
+ KeySyncTask.getUiFormat(CREDENTIAL_TYPE_PIN));
}
@Test
public void getUiFormat_returnsPasswordIfPassword() {
assertEquals(UI_FORMAT_PASSWORD,
- KeySyncTask.getUiFormat(CREDENTIAL_TYPE_PASSWORD, "1234a".getBytes()));
+ KeySyncTask.getUiFormat(CREDENTIAL_TYPE_PASSWORD));
}
@Test
public void getUiFormat_returnsPatternIfPattern() {
assertEquals(UI_FORMAT_PATTERN,
- KeySyncTask.getUiFormat(CREDENTIAL_TYPE_PATTERN, "1234".getBytes()));
+ KeySyncTask.getUiFormat(CREDENTIAL_TYPE_PATTERN));
}
@@ -683,7 +668,7 @@
mRecoverySnapshotStorage,
mSnapshotListenersStorage,
TEST_USER_ID,
- CREDENTIAL_TYPE_PASSWORD,
+ CREDENTIAL_TYPE_PIN,
/*credential=*/ pin.getBytes(),
/*credentialUpdated=*/ false,
mPlatformKeyManager,
@@ -799,7 +784,7 @@
mRecoverySnapshotStorage,
mSnapshotListenersStorage,
TEST_USER_ID,
- /*credentialType=*/ 3,
+ /*credentialType=*/ 5, // Some invalid credential type value
"12345".getBytes(),
/*credentialUpdated=*/ false,
mPlatformKeyManager,
diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
index 8a48904..64bd2c7 100644
--- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
@@ -122,6 +122,7 @@
import android.os.SimpleClock;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.platform.test.annotations.Presubmit;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionPlan;
@@ -142,6 +143,7 @@
import com.android.internal.util.test.BroadcastInterceptingContext.FutureIntent;
import com.android.server.DeviceIdleInternal;
import com.android.server.LocalServices;
+import com.android.server.usage.AppStandbyInternal;
import com.google.common.util.concurrent.AbstractFuture;
@@ -196,6 +198,7 @@
*/
@RunWith(AndroidJUnit4.class)
@MediumTest
+@Presubmit
public class NetworkPolicyManagerServiceTest {
private static final String TAG = "NetworkPolicyManagerServiceTest";
@@ -295,6 +298,7 @@
private void registerLocalServices() {
addLocalServiceMock(DeviceIdleInternal.class);
+ addLocalServiceMock(AppStandbyInternal.class);
final UsageStatsManagerInternal usageStats =
addLocalServiceMock(UsageStatsManagerInternal.class);
@@ -444,6 +448,7 @@
LocalServices.removeServiceForTest(ActivityManagerInternal.class);
LocalServices.removeServiceForTest(PowerManagerInternal.class);
LocalServices.removeServiceForTest(DeviceIdleInternal.class);
+ LocalServices.removeServiceForTest(AppStandbyInternal.class);
LocalServices.removeServiceForTest(UsageStatsManagerInternal.class);
LocalServices.removeServiceForTest(NetworkStatsManagerInternal.class);
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
new file mode 100644
index 0000000..6bb4202
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
@@ -0,0 +1,298 @@
+/*
+ * 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.pm;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertThrows;
+
+import android.apex.ApexInfo;
+import android.apex.ApexSessionInfo;
+import android.apex.IApexService;
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.os.FileUtils;
+import android.os.RemoteException;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.frameworks.servicestests.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+@SmallTest
+@Presubmit
+@RunWith(AndroidJUnit4.class)
+public class ApexManagerTest {
+ private static final String TEST_APEX_PKG = "com.android.apex.test";
+ private static final int TEST_SESSION_ID = 99999999;
+ private static final int[] TEST_CHILD_SESSION_ID = {8888, 7777};
+ private ApexManager mApexManager;
+ private Context mContext;
+
+ private IApexService mApexService = mock(IApexService.class);
+
+ @Before
+ public void setUp() throws RemoteException {
+ mContext = InstrumentationRegistry.getInstrumentation().getContext();
+ mApexManager = new ApexManager.ApexManagerImpl(mContext, mApexService);
+ }
+
+ @Test
+ public void testGetPackageInfo_setFlagsMatchActivePackage() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, false));
+ final PackageInfo activePkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_ACTIVE_PACKAGE);
+
+ assertThat(activePkgPi).isNotNull();
+ assertThat(activePkgPi.packageName).contains(TEST_APEX_PKG);
+
+ final PackageInfo factoryPkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_FACTORY_PACKAGE);
+
+ assertThat(factoryPkgPi).isNull();
+ }
+
+ @Test
+ public void testGetPackageInfo_setFlagsMatchFactoryPackage() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+ PackageInfo factoryPkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_FACTORY_PACKAGE);
+
+ assertThat(factoryPkgPi).isNotNull();
+ assertThat(factoryPkgPi.packageName).contains(TEST_APEX_PKG);
+
+ final PackageInfo activePkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_ACTIVE_PACKAGE);
+
+ assertThat(activePkgPi).isNull();
+ }
+
+ @Test
+ public void testGetPackageInfo_setFlagsNone() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getPackageInfo(TEST_APEX_PKG, 0)).isNull();
+ }
+
+ @Test
+ public void testGetActivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, true));
+
+ assertThat(mApexManager.getActivePackages()).isNotEmpty();
+ }
+
+ @Test
+ public void testGetActivePackages_noneActivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getActivePackages()).isEmpty();
+ }
+
+ @Test
+ public void testGetFactoryPackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getFactoryPackages()).isNotEmpty();
+ }
+
+ @Test
+ public void testGetFactoryPackages_noneFactoryPackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, false));
+
+ assertThat(mApexManager.getFactoryPackages()).isEmpty();
+ }
+
+ @Test
+ public void testGetInactivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getInactivePackages()).isNotEmpty();
+ }
+
+ @Test
+ public void testGetInactivePackages_noneInactivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, false));
+
+ assertThat(mApexManager.getInactivePackages()).isEmpty();
+ }
+
+ @Test
+ public void testIsApexPackage() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.isApexPackage(TEST_APEX_PKG)).isTrue();
+ }
+
+ @Test
+ public void testIsApexSupported() {
+ assertThat(mApexManager.isApexSupported()).isTrue();
+ }
+
+ @Test
+ public void testGetStagedSessionInfo() throws RemoteException {
+ when(mApexService.getStagedSessionInfo(anyInt())).thenReturn(
+ getFakeStagedSessionInfo());
+
+ mApexManager.getStagedSessionInfo(TEST_SESSION_ID);
+ verify(mApexService, times(1)).getStagedSessionInfo(TEST_SESSION_ID);
+ }
+
+ @Test
+ public void testGetStagedSessionInfo_unKnownStagedSessionId() throws RemoteException {
+ when(mApexService.getStagedSessionInfo(anyInt())).thenReturn(
+ getFakeUnknownSessionInfo());
+
+ assertThat(mApexManager.getStagedSessionInfo(TEST_SESSION_ID)).isNull();
+ }
+
+ @Test
+ public void testSubmitStagedSession_throwPackageManagerException() throws RemoteException {
+ doAnswer(invocation -> {
+ throw new Exception();
+ }).when(mApexService).submitStagedSession(anyInt(), any(), any());
+
+ assertThrows(PackageManagerException.class,
+ () -> mApexManager.submitStagedSession(TEST_SESSION_ID, TEST_CHILD_SESSION_ID));
+ }
+
+ @Test
+ public void testSubmitStagedSession_throwRunTimeException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).submitStagedSession(anyInt(), any(),
+ any());
+
+ assertThrows(RuntimeException.class,
+ () -> mApexManager.submitStagedSession(TEST_SESSION_ID, TEST_CHILD_SESSION_ID));
+ }
+
+ @Test
+ public void testMarkStagedSessionReady_throwPackageManagerException() throws RemoteException {
+ doAnswer(invocation -> {
+ throw new Exception();
+ }).when(mApexService).markStagedSessionReady(anyInt());
+
+ assertThrows(PackageManagerException.class,
+ () -> mApexManager.markStagedSessionReady(TEST_SESSION_ID));
+ }
+
+ @Test
+ public void testMarkStagedSessionReady_throwRunTimeException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).markStagedSessionReady(anyInt());
+
+ assertThrows(RuntimeException.class,
+ () -> mApexManager.markStagedSessionReady(TEST_SESSION_ID));
+ }
+
+ @Test
+ public void testAbortActiveSession_remoteException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).abortActiveSession();
+
+ try {
+ assertThat(mApexManager.abortActiveSession()).isFalse();
+ } catch (Exception e) {
+ throw new AssertionError("ApexManager should not raise Exception");
+ }
+ }
+
+ @Test
+ public void testMarkStagedSessionSuccessful_throwRemoteException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).markStagedSessionSuccessful(anyInt());
+
+ assertThrows(RuntimeException.class,
+ () -> mApexManager.markStagedSessionSuccessful(TEST_SESSION_ID));
+ }
+
+ @Test
+ public void testUninstallApex_throwException_returnFalse() throws RemoteException {
+ doAnswer(invocation -> {
+ throw new Exception();
+ }).when(mApexService).unstagePackages(any());
+
+ assertThat(mApexManager.uninstallApex(TEST_APEX_PKG)).isFalse();
+ }
+
+ private ApexInfo[] createApexInfo(boolean isActive, boolean isFactory) {
+ File apexFile = copyRawResourceToFile(TEST_APEX_PKG, R.raw.apex_test);
+ ApexInfo apexInfo = new ApexInfo();
+ apexInfo.isActive = isActive;
+ apexInfo.isFactory = isFactory;
+ apexInfo.moduleName = TEST_APEX_PKG;
+ apexInfo.modulePath = apexFile.getPath();
+ apexInfo.versionCode = 191000070;
+
+ return new ApexInfo[]{apexInfo};
+ }
+
+ private ApexSessionInfo getFakeStagedSessionInfo() {
+ ApexSessionInfo stagedSessionInfo = new ApexSessionInfo();
+ stagedSessionInfo.sessionId = TEST_SESSION_ID;
+ stagedSessionInfo.isStaged = true;
+
+ return stagedSessionInfo;
+ }
+
+ private ApexSessionInfo getFakeUnknownSessionInfo() {
+ ApexSessionInfo stagedSessionInfo = new ApexSessionInfo();
+ stagedSessionInfo.sessionId = TEST_SESSION_ID;
+ stagedSessionInfo.isUnknown = true;
+
+ return stagedSessionInfo;
+ }
+
+ /**
+ * Copies a specified {@code resourceId} to a temp file. Returns a non-null file if the copy
+ * succeeded
+ */
+ File copyRawResourceToFile(String baseName, int resourceId) {
+ File outFile;
+ try {
+ outFile = File.createTempFile(baseName, ".apex");
+ } catch (IOException e) {
+ throw new AssertionError("CreateTempFile IOException" + e);
+ }
+
+ try (InputStream is = mContext.getResources().openRawResource(resourceId);
+ FileOutputStream os = new FileOutputStream(outFile)) {
+ assertThat(FileUtils.copy(is, os)).isGreaterThan(0L);
+ } catch (FileNotFoundException e) {
+ throw new AssertionError("File not found exception " + e);
+ } catch (IOException e) {
+ throw new AssertionError("IOException" + e);
+ }
+
+ return outFile;
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeZoneDetectorStrategyTest.java b/services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeZoneDetectorStrategyTest.java
index 9e00077..d797955 100644
--- a/services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeZoneDetectorStrategyTest.java
+++ b/services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeZoneDetectorStrategyTest.java
@@ -23,7 +23,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.app.timedetector.TimeSignal;
+import android.app.timedetector.PhoneTimeSuggestion;
import android.content.Intent;
import android.icu.util.Calendar;
import android.icu.util.GregorianCalendar;
@@ -45,6 +45,8 @@
.setActualTimeUtc(2018, 1, 1, 12, 0, 0)
.build();
+ private static final int ARBITRARY_PHONE_ID = 123456;
+
private Script mScript;
@Before
@@ -53,30 +55,32 @@
}
@Test
- public void testSuggestTime_nitz_timeDetectionEnabled() {
+ public void testSuggestPhoneTime_nitz_timeDetectionEnabled() {
Scenario scenario = SCENARIO_1;
mScript.pokeFakeClocks(scenario)
.pokeTimeDetectionEnabled(true);
- TimeSignal timeSignal = scenario.createTimeSignalForActual(TimeSignal.SOURCE_ID_NITZ);
+ PhoneTimeSuggestion timeSuggestion =
+ scenario.createPhoneTimeSuggestionForActual(ARBITRARY_PHONE_ID);
final int clockIncrement = 1000;
long expectSystemClockMillis = scenario.getActualTimeMillis() + clockIncrement;
mScript.simulateTimePassing(clockIncrement)
- .simulateTimeSignalReceived(timeSignal)
+ .simulatePhoneTimeSuggestion(timeSuggestion)
.verifySystemClockWasSetAndResetCallTracking(expectSystemClockMillis);
}
@Test
- public void testSuggestTime_systemClockThreshold() {
+ public void testSuggestPhoneTime_systemClockThreshold() {
Scenario scenario = SCENARIO_1;
final int systemClockUpdateThresholdMillis = 1000;
mScript.pokeFakeClocks(scenario)
.pokeThresholds(systemClockUpdateThresholdMillis)
.pokeTimeDetectionEnabled(true);
- TimeSignal timeSignal1 = scenario.createTimeSignalForActual(TimeSignal.SOURCE_ID_NITZ);
- TimestampedValue<Long> utcTime1 = timeSignal1.getUtcTime();
+ PhoneTimeSuggestion timeSuggestion1 =
+ scenario.createPhoneTimeSuggestionForActual(ARBITRARY_PHONE_ID);
+ TimestampedValue<Long> utcTime1 = timeSuggestion1.getUtcTime();
final int clockIncrement = 100;
// Increment the the device clocks to simulate the passage of time.
@@ -86,7 +90,7 @@
TimeDetectorStrategy.getTimeAt(utcTime1, mScript.peekElapsedRealtimeMillis());
// Send the first time signal. It should be used.
- mScript.simulateTimeSignalReceived(timeSignal1)
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
.verifySystemClockWasSetAndResetCallTracking(expectSystemClockMillis1);
// Now send another time signal, but one that is too similar to the last one and should be
@@ -95,9 +99,9 @@
TimestampedValue<Long> utcTime2 = new TimestampedValue<>(
mScript.peekElapsedRealtimeMillis(),
mScript.peekSystemClockMillis() + underThresholdMillis);
- TimeSignal timeSignal2 = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, utcTime2);
+ PhoneTimeSuggestion timeSuggestion2 = new PhoneTimeSuggestion(ARBITRARY_PHONE_ID, utcTime2);
mScript.simulateTimePassing(clockIncrement)
- .simulateTimeSignalReceived(timeSignal2)
+ .simulatePhoneTimeSuggestion(timeSuggestion2)
.verifySystemClockWasNotSetAndResetCallTracking();
// Now send another time signal, but one that is on the threshold and so should be used.
@@ -105,42 +109,44 @@
mScript.peekElapsedRealtimeMillis(),
mScript.peekSystemClockMillis() + systemClockUpdateThresholdMillis);
- TimeSignal timeSignal3 = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, utcTime3);
+ PhoneTimeSuggestion timeSuggestion3 = new PhoneTimeSuggestion(ARBITRARY_PHONE_ID, utcTime3);
mScript.simulateTimePassing(clockIncrement);
long expectSystemClockMillis3 =
TimeDetectorStrategy.getTimeAt(utcTime3, mScript.peekElapsedRealtimeMillis());
- mScript.simulateTimeSignalReceived(timeSignal3)
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion3)
.verifySystemClockWasSetAndResetCallTracking(expectSystemClockMillis3);
}
@Test
- public void testSuggestTime_nitz_timeDetectionDisabled() {
+ public void testSuggestPhoneTime_nitz_timeDetectionDisabled() {
Scenario scenario = SCENARIO_1;
mScript.pokeFakeClocks(scenario)
.pokeTimeDetectionEnabled(false);
- TimeSignal timeSignal = scenario.createTimeSignalForActual(TimeSignal.SOURCE_ID_NITZ);
- mScript.simulateTimeSignalReceived(timeSignal)
+ PhoneTimeSuggestion timeSuggestion =
+ scenario.createPhoneTimeSuggestionForActual(ARBITRARY_PHONE_ID);
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion)
.verifySystemClockWasNotSetAndResetCallTracking();
}
@Test
- public void testSuggestTime_nitz_invalidNitzReferenceTimesIgnored() {
+ public void testSuggestPhoneTime_nitz_invalidNitzReferenceTimesIgnored() {
Scenario scenario = SCENARIO_1;
final int systemClockUpdateThreshold = 2000;
mScript.pokeFakeClocks(scenario)
.pokeThresholds(systemClockUpdateThreshold)
.pokeTimeDetectionEnabled(true);
- TimeSignal timeSignal1 = scenario.createTimeSignalForActual(TimeSignal.SOURCE_ID_NITZ);
- TimestampedValue<Long> utcTime1 = timeSignal1.getUtcTime();
+ PhoneTimeSuggestion timeSuggestion1 =
+ scenario.createPhoneTimeSuggestionForActual(ARBITRARY_PHONE_ID);
+ TimestampedValue<Long> utcTime1 = timeSuggestion1.getUtcTime();
// Initialize the strategy / device with a time set from NITZ.
mScript.simulateTimePassing(100);
long expectedSystemClockMillis1 =
TimeDetectorStrategy.getTimeAt(utcTime1, mScript.peekElapsedRealtimeMillis());
- mScript.simulateTimeSignalReceived(timeSignal1)
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis1);
// The UTC time increment should be larger than the system clock update threshold so we
@@ -152,8 +158,8 @@
long referenceTimeBeforeLastSignalMillis = utcTime1.getReferenceTimeMillis() - 1;
TimestampedValue<Long> utcTime2 = new TimestampedValue<>(
referenceTimeBeforeLastSignalMillis, validUtcTimeMillis);
- TimeSignal timeSignal2 = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, utcTime2);
- mScript.simulateTimeSignalReceived(timeSignal2)
+ PhoneTimeSuggestion timeSuggestion2 = new PhoneTimeSuggestion(ARBITRARY_PHONE_ID, utcTime2);
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion2)
.verifySystemClockWasNotSetAndResetCallTracking();
// Now supply a new signal that has an obviously bogus reference time : substantially in the
@@ -162,8 +168,8 @@
utcTime1.getReferenceTimeMillis() + Integer.MAX_VALUE + 1;
TimestampedValue<Long> utcTime3 = new TimestampedValue<>(
referenceTimeInFutureMillis, validUtcTimeMillis);
- TimeSignal timeSignal3 = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, utcTime3);
- mScript.simulateTimeSignalReceived(timeSignal3)
+ PhoneTimeSuggestion timeSuggestion3 = new PhoneTimeSuggestion(ARBITRARY_PHONE_ID, utcTime3);
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion3)
.verifySystemClockWasNotSetAndResetCallTracking();
// Just to prove validUtcTimeMillis is valid.
@@ -172,13 +178,13 @@
validReferenceTimeMillis, validUtcTimeMillis);
long expectedSystemClockMillis4 =
TimeDetectorStrategy.getTimeAt(utcTime4, mScript.peekElapsedRealtimeMillis());
- TimeSignal timeSignal4 = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, utcTime4);
- mScript.simulateTimeSignalReceived(timeSignal4)
+ PhoneTimeSuggestion timeSuggestion4 = new PhoneTimeSuggestion(ARBITRARY_PHONE_ID, utcTime4);
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion4)
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis4);
}
@Test
- public void testSuggestTime_timeDetectionToggled() {
+ public void testSuggestPhoneTime_timeDetectionToggled() {
Scenario scenario = SCENARIO_1;
final int clockIncrementMillis = 100;
final int systemClockUpdateThreshold = 2000;
@@ -186,15 +192,16 @@
.pokeThresholds(systemClockUpdateThreshold)
.pokeTimeDetectionEnabled(false);
- TimeSignal timeSignal1 = scenario.createTimeSignalForActual(TimeSignal.SOURCE_ID_NITZ);
- TimestampedValue<Long> utcTime1 = timeSignal1.getUtcTime();
+ PhoneTimeSuggestion timeSuggestion1 =
+ scenario.createPhoneTimeSuggestionForActual(ARBITRARY_PHONE_ID);
+ TimestampedValue<Long> utcTime1 = timeSuggestion1.getUtcTime();
// Simulate time passing.
mScript.simulateTimePassing(clockIncrementMillis);
// Simulate the time signal being received. It should not be used because auto time
// detection is off but it should be recorded.
- mScript.simulateTimeSignalReceived(timeSignal1)
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
.verifySystemClockWasNotSetAndResetCallTracking();
// Simulate more time passing.
@@ -216,7 +223,7 @@
TimestampedValue<Long> utcTime2 = new TimestampedValue<>(
mScript.peekElapsedRealtimeMillis(),
mScript.peekSystemClockMillis() + systemClockUpdateThreshold);
- TimeSignal timeSignal2 = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, utcTime2);
+ PhoneTimeSuggestion timeSuggestion2 = new PhoneTimeSuggestion(ARBITRARY_PHONE_ID, utcTime2);
// Simulate more time passing.
mScript.simulateTimePassing(clockIncrementMillis);
@@ -226,7 +233,7 @@
// The new time, though valid, should not be set in the system clock because auto time is
// disabled.
- mScript.simulateTimeSignalReceived(timeSignal2)
+ mScript.simulatePhoneTimeSuggestion(timeSuggestion2)
.verifySystemClockWasNotSetAndResetCallTracking();
// Turn on auto time detection.
@@ -234,17 +241,6 @@
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis2);
}
- @Test
- public void testSuggestTime_unknownSource() {
- Scenario scenario = SCENARIO_1;
- mScript.pokeFakeClocks(scenario)
- .pokeTimeDetectionEnabled(true);
-
- TimeSignal timeSignal = scenario.createTimeSignalForActual("unknown");
- mScript.simulateTimeSignalReceived(timeSignal)
- .verifySystemClockWasNotSetAndResetCallTracking();
- }
-
/**
* A fake implementation of TimeDetectorStrategy.Callback. Besides tracking changes and behaving
* like the real thing should, it also asserts preconditions.
@@ -407,8 +403,8 @@
return mFakeCallback.peekSystemClockMillis();
}
- Script simulateTimeSignalReceived(TimeSignal timeSignal) {
- mSimpleTimeDetectorStrategy.suggestTime(timeSignal);
+ Script simulatePhoneTimeSuggestion(PhoneTimeSuggestion timeSuggestion) {
+ mSimpleTimeDetectorStrategy.suggestPhoneTime(timeSuggestion);
return this;
}
@@ -466,10 +462,10 @@
return mActualTimeMillis;
}
- TimeSignal createTimeSignalForActual(String sourceId) {
+ PhoneTimeSuggestion createPhoneTimeSuggestionForActual(int phoneId) {
TimestampedValue<Long> time = new TimestampedValue<>(
mInitialDeviceRealtimeMillis, mActualTimeMillis);
- return new TimeSignal(sourceId, time);
+ return new PhoneTimeSuggestion(phoneId, time);
}
static class Builder {
diff --git a/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java b/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
index 45fef76..37da018 100644
--- a/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
@@ -28,7 +28,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.app.timedetector.TimeSignal;
+import android.app.timedetector.PhoneTimeSuggestion;
import android.content.Context;
import android.content.pm.PackageManager;
import android.util.TimestampedValue;
@@ -67,10 +67,10 @@
public void testStubbedCall_withoutPermission() {
doThrow(new SecurityException("Mock"))
.when(mMockContext).enforceCallingPermission(anyString(), any());
- TimeSignal timeSignal = createNitzTimeSignal();
+ PhoneTimeSuggestion phoneTimeSuggestion = createPhoneTimeSuggestion();
try {
- mTimeDetectorService.suggestTime(timeSignal);
+ mTimeDetectorService.suggestPhoneTime(phoneTimeSuggestion);
} finally {
verify(mMockContext).enforceCallingPermission(
eq(android.Manifest.permission.SET_TIME), anyString());
@@ -78,15 +78,15 @@
}
@Test
- public void testSuggestTime() {
+ public void testSuggestPhoneTime() {
doNothing().when(mMockContext).enforceCallingPermission(anyString(), any());
- TimeSignal timeSignal = createNitzTimeSignal();
- mTimeDetectorService.suggestTime(timeSignal);
+ PhoneTimeSuggestion phoneTimeSuggestion = createPhoneTimeSuggestion();
+ mTimeDetectorService.suggestPhoneTime(phoneTimeSuggestion);
verify(mMockContext)
.enforceCallingPermission(eq(android.Manifest.permission.SET_TIME), anyString());
- mStubbedTimeDetectorStrategy.verifySuggestTimeCalled(timeSignal);
+ mStubbedTimeDetectorStrategy.verifySuggestPhoneTimeCalled(phoneTimeSuggestion);
}
@Test
@@ -115,15 +115,16 @@
mStubbedTimeDetectorStrategy.verifyHandleAutoTimeDetectionToggleCalled(false);
}
- private static TimeSignal createNitzTimeSignal() {
+ private static PhoneTimeSuggestion createPhoneTimeSuggestion() {
+ int phoneId = 1234;
TimestampedValue<Long> timeValue = new TimestampedValue<>(100L, 1_000_000L);
- return new TimeSignal(TimeSignal.SOURCE_ID_NITZ, timeValue);
+ return new PhoneTimeSuggestion(phoneId, timeValue);
}
private static class StubbedTimeDetectorStrategy implements TimeDetectorStrategy {
// Call tracking.
- private TimeSignal mLastSuggestedTime;
+ private PhoneTimeSuggestion mLastPhoneSuggestion;
private Boolean mLastAutoTimeDetectionToggle;
private boolean mDumpCalled;
@@ -132,9 +133,9 @@
}
@Override
- public void suggestTime(TimeSignal timeSignal) {
+ public void suggestPhoneTime(PhoneTimeSuggestion timeSuggestion) {
resetCallTracking();
- mLastSuggestedTime = timeSignal;
+ mLastPhoneSuggestion = timeSuggestion;
}
@Override
@@ -150,13 +151,13 @@
}
void resetCallTracking() {
- mLastSuggestedTime = null;
+ mLastPhoneSuggestion = null;
mLastAutoTimeDetectionToggle = null;
mDumpCalled = false;
}
- void verifySuggestTimeCalled(TimeSignal expectedSignal) {
- assertEquals(expectedSignal, mLastSuggestedTime);
+ void verifySuggestPhoneTimeCalled(PhoneTimeSuggestion expectedSignal) {
+ assertEquals(expectedSignal, mLastPhoneSuggestion);
}
void verifyHandleAutoTimeDetectionToggleCalled(boolean expectedEnable) {
diff --git a/services/tests/servicestests/src/com/android/server/usage/UsageStatsDatabaseTest.java b/services/tests/servicestests/src/com/android/server/usage/UsageStatsDatabaseTest.java
index df0c37a..e32103f 100644
--- a/services/tests/servicestests/src/com/android/server/usage/UsageStatsDatabaseTest.java
+++ b/services/tests/servicestests/src/com/android/server/usage/UsageStatsDatabaseTest.java
@@ -21,6 +21,7 @@
import static junit.framework.TestCase.fail;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
import android.app.usage.TimeSparseArray;
import android.app.usage.UsageEvents.Event;
@@ -35,6 +36,7 @@
import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -423,6 +425,11 @@
prevDB.putUsageStats(UsageStatsManager.INTERVAL_DAILY, mIntervalStats);
// Create a backup with a specific version
byte[] blob = prevDB.getBackupPayload(KEY_USAGE_STATS, version);
+ if (version >= 1 && version <= 3) {
+ assertFalse(blob != null && blob.length != 0,
+ "UsageStatsDatabase shouldn't be able to write backups as XML");
+ return;
+ }
clearUsageStatsFiles();
@@ -434,11 +441,9 @@
List<IntervalStats> stats = newDB.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, 0, mEndTime,
mIntervalStatsVerifier);
-
- if (version > newDB.BACKUP_VERSION || version < 1) {
- if (stats != null && stats.size() != 0) {
- fail("UsageStatsDatabase should ne be able to restore from unknown data versions");
- }
+ if (version > UsageStatsDatabase.BACKUP_VERSION || version < 1) {
+ assertFalse(stats != null && !stats.isEmpty(),
+ "UsageStatsDatabase shouldn't be able to restore from unknown data versions");
return;
}
@@ -455,9 +460,12 @@
/**
* Test the version upgrade from 3 to 4
+ *
+ * Ignored - version 3 is now deprecated.
*/
+ @Ignore
@Test
- public void testVersionUpgradeFrom3to4() throws IOException {
+ public void ignore_testVersionUpgradeFrom3to4() throws IOException {
runVersionChangeTest(3, 4, UsageStatsManager.INTERVAL_DAILY);
runVersionChangeTest(3, 4, UsageStatsManager.INTERVAL_WEEKLY);
runVersionChangeTest(3, 4, UsageStatsManager.INTERVAL_MONTHLY);
@@ -477,9 +485,12 @@
/**
* Test the version upgrade from 3 to 5
+ *
+ * Ignored - version 3 is now deprecated.
*/
+ @Ignore
@Test
- public void testVersionUpgradeFrom3to5() throws IOException {
+ public void ignore_testVersionUpgradeFrom3to5() throws IOException {
runVersionChangeTest(3, 5, UsageStatsManager.INTERVAL_DAILY);
runVersionChangeTest(3, 5, UsageStatsManager.INTERVAL_WEEKLY);
runVersionChangeTest(3, 5, UsageStatsManager.INTERVAL_MONTHLY);
@@ -488,13 +499,15 @@
/**
- * Test the version upgrade from 3 to 4
+ * Test backup/restore
*/
@Test
public void testBackupRestore() throws IOException {
- runBackupRestoreTest(1);
runBackupRestoreTest(4);
+ // test deprecated versions
+ runBackupRestoreTest(1);
+
// test invalid backup versions as well
runBackupRestoreTest(0);
runBackupRestoreTest(99999);
diff --git a/services/tests/uiservicestests/Android.bp b/services/tests/uiservicestests/Android.bp
index 4a9cef1..92198fa 100644
--- a/services/tests/uiservicestests/Android.bp
+++ b/services/tests/uiservicestests/Android.bp
@@ -55,6 +55,6 @@
"libui",
"libunwindstack",
"libutils",
- "netd_aidl_interface-V2-cpp",
+ "netd_aidl_interface-cpp",
],
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryDatabaseTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryDatabaseTest.java
new file mode 100644
index 0000000..bcff2f8
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryDatabaseTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.notification;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.app.NotificationHistory.HistoricalNotification;
+import android.graphics.drawable.Icon;
+import android.os.Handler;
+import android.util.AtomicFile;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.UiServiceTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.File;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+@RunWith(AndroidJUnit4.class)
+public class NotificationHistoryDatabaseTest extends UiServiceTestCase {
+
+ File mRootDir;
+ @Mock
+ Handler mFileWriteHandler;
+
+ NotificationHistoryDatabase mDataBase;
+
+ private HistoricalNotification getHistoricalNotification(int index) {
+ return getHistoricalNotification("package" + index, index);
+ }
+
+ private HistoricalNotification getHistoricalNotification(String packageName, int index) {
+ String expectedChannelName = "channelName" + index;
+ String expectedChannelId = "channelId" + index;
+ int expectedUid = 1123456 + index;
+ int expectedUserId = 11 + index;
+ long expectedPostTime = 987654321 + index;
+ String expectedTitle = "title" + index;
+ String expectedText = "text" + index;
+ Icon expectedIcon = Icon.createWithResource(InstrumentationRegistry.getContext(),
+ index);
+
+ return new HistoricalNotification.Builder()
+ .setPackage(packageName)
+ .setChannelName(expectedChannelName)
+ .setChannelId(expectedChannelId)
+ .setUid(expectedUid)
+ .setUserId(expectedUserId)
+ .setPostedTimeMs(expectedPostTime)
+ .setTitle(expectedTitle)
+ .setText(expectedText)
+ .setIcon(expectedIcon)
+ .build();
+ }
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
+ mRootDir = new File(mContext.getFilesDir(), "NotificationHistoryDatabaseTest");
+
+ mDataBase = new NotificationHistoryDatabase(mRootDir);
+ mDataBase.init(mFileWriteHandler);
+ }
+
+ @Test
+ public void testPrune() {
+ int retainDays = 1;
+ for (long i = 10; i >= 5; i--) {
+ File file = mock(File.class);
+ when(file.lastModified()).thenReturn(i);
+ AtomicFile af = new AtomicFile(file);
+ mDataBase.mHistoryFiles.addLast(af);
+ }
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTimeInMillis(5);
+ cal.add(Calendar.DATE, -1 * retainDays);
+ for (int i = 5; i >= 0; i--) {
+ File file = mock(File.class);
+ when(file.lastModified()).thenReturn(cal.getTimeInMillis() - i);
+ AtomicFile af = new AtomicFile(file);
+ mDataBase.mHistoryFiles.addLast(af);
+ }
+ mDataBase.prune(retainDays, 10);
+
+ for (AtomicFile file : mDataBase.mHistoryFiles) {
+ assertThat(file.getBaseFile().lastModified() > 0);
+ }
+ }
+
+ @Test
+ public void testOnPackageRemove_posts() {
+ mDataBase.onPackageRemoved("test");
+ verify(mFileWriteHandler, times(1)).post(any());
+ }
+
+ @Test
+ public void testForceWriteToDisk() {
+ mDataBase.forceWriteToDisk();
+ verify(mFileWriteHandler, times(1)).post(any());
+ }
+
+ @Test
+ public void testOnlyOneWriteRunnableInQueue() {
+ when(mFileWriteHandler.hasCallbacks(any())).thenReturn(true);
+ mDataBase.forceWriteToDisk();
+ verify(mFileWriteHandler, never()).post(any());
+ }
+
+ @Test
+ public void testAddNotification() {
+ HistoricalNotification n = getHistoricalNotification(1);
+ HistoricalNotification n2 = getHistoricalNotification(2);
+
+ mDataBase.addNotification(n);
+ assertThat(mDataBase.mBuffer.getNotificationsToWrite()).contains(n);
+ verify(mFileWriteHandler, times(1)).postDelayed(any(), anyLong());
+
+ // second add should not trigger another write
+ mDataBase.addNotification(n2);
+ assertThat(mDataBase.mBuffer.getNotificationsToWrite()).contains(n2);
+ verify(mFileWriteHandler, times(1)).postDelayed(any(), anyLong());
+ }
+
+ @Test
+ public void testReadNotificationHistory_readsAllFiles() throws Exception {
+ for (long i = 10; i >= 5; i--) {
+ AtomicFile af = mock(AtomicFile.class);
+ mDataBase.mHistoryFiles.addLast(af);
+ }
+
+ mDataBase.readNotificationHistory();
+
+ for (AtomicFile file : mDataBase.mHistoryFiles) {
+ verify(file, times(1)).openRead();
+ }
+ }
+
+ @Test
+ public void testReadNotificationHistory_withNumFilterDoesNotReadExtraFiles() throws Exception {
+ AtomicFile af = mock(AtomicFile.class);
+ when(af.getBaseFile()).thenReturn(new File(mRootDir, "af"));
+ mDataBase.mHistoryFiles.addLast(af);
+
+ AtomicFile af2 = mock(AtomicFile.class);
+ when(af2.getBaseFile()).thenReturn(new File(mRootDir, "af2"));
+ mDataBase.mHistoryFiles.addLast(af2);
+
+ mDataBase.readNotificationHistory(null, null, 0);
+
+ verify(af, times(1)).openRead();
+ verify(af2, never()).openRead();
+ }
+
+}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryFilterTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryFilterTest.java
new file mode 100644
index 0000000..10bfcf1
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryFilterTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.notification;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.NotificationHistory;
+import android.app.NotificationHistory.HistoricalNotification;
+import android.graphics.drawable.Icon;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.UiServiceTestCase;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class NotificationHistoryFilterTest extends UiServiceTestCase {
+
+ private HistoricalNotification getHistoricalNotification(int index) {
+ return getHistoricalNotification("package" + index, "channelId" + index, index);
+ }
+ private HistoricalNotification getHistoricalNotification(String pkg, int index) {
+ return getHistoricalNotification(pkg, "channelId" + index, index);
+ }
+
+ private HistoricalNotification getHistoricalNotification(String packageName, String channelId,
+ int index) {
+ String expectedChannelName = "channelName" + index;
+ int expectedUid = 1123456 + index;
+ int expectedUserId = 11 + index;
+ long expectedPostTime = 987654321 + index;
+ String expectedTitle = "title" + index;
+ String expectedText = "text" + index;
+ Icon expectedIcon = Icon.createWithResource(InstrumentationRegistry.getContext(),
+ index);
+
+ return new HistoricalNotification.Builder()
+ .setPackage(packageName)
+ .setChannelName(expectedChannelName)
+ .setChannelId(channelId)
+ .setUid(expectedUid)
+ .setUserId(expectedUserId)
+ .setPostedTimeMs(expectedPostTime)
+ .setTitle(expectedTitle)
+ .setText(expectedText)
+ .setIcon(expectedIcon)
+ .build();
+ }
+
+ @Test
+ public void testBuilder() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setChannel("pkg", "channel")
+ .setMaxNotifications(3)
+ .build();
+
+ assertThat(filter.getPackage()).isEqualTo("pkg");
+ assertThat(filter.getChannel()).isEqualTo("channel");
+ assertThat(filter.getMaxNotifications()).isEqualTo(3);
+ }
+
+ @Test
+ public void testMatchesCountFilter() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setMaxNotifications(3)
+ .build();
+
+ NotificationHistory history = new NotificationHistory();
+ assertThat(filter.matchesCountFilter(history)).isTrue();
+ history.addNotificationToWrite(getHistoricalNotification(1));
+ assertThat(filter.matchesCountFilter(history)).isTrue();
+ history.addNotificationToWrite(getHistoricalNotification(2));
+ assertThat(filter.matchesCountFilter(history)).isTrue();
+ history.addNotificationToWrite(getHistoricalNotification(3));
+ assertThat(filter.matchesCountFilter(history)).isFalse();
+ }
+
+ @Test
+ public void testMatchesCountFilter_noCountFilter() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .build();
+
+ NotificationHistory history = new NotificationHistory();
+ assertThat(filter.matchesCountFilter(history)).isTrue();
+ history.addNotificationToWrite(getHistoricalNotification(1));
+ assertThat(filter.matchesCountFilter(history)).isTrue();
+ }
+
+ @Test
+ public void testMatchesPackageAndChannelFilter_pkgOnly() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setPackage("pkg")
+ .build();
+
+ HistoricalNotification hnMatches = getHistoricalNotification("pkg", 1);
+ assertThat(filter.matchesPackageAndChannelFilter(hnMatches)).isTrue();
+ HistoricalNotification hnMatches2 = getHistoricalNotification("pkg", 2);
+ assertThat(filter.matchesPackageAndChannelFilter(hnMatches2)).isTrue();
+
+ HistoricalNotification hnNoMatch = getHistoricalNotification("pkg2", 2);
+ assertThat(filter.matchesPackageAndChannelFilter(hnNoMatch)).isFalse();
+ }
+
+ @Test
+ public void testMatchesPackageAndChannelFilter_channelAlso() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setChannel("pkg", "channel")
+ .build();
+
+ HistoricalNotification hn1 = getHistoricalNotification("pkg", 1);
+ assertThat(filter.matchesPackageAndChannelFilter(hn1)).isFalse();
+
+ HistoricalNotification hn2 = getHistoricalNotification("pkg", "channel", 1);
+ assertThat(filter.matchesPackageAndChannelFilter(hn2)).isTrue();
+
+ HistoricalNotification hn3 = getHistoricalNotification("pkg2", "channel", 1);
+ assertThat(filter.matchesPackageAndChannelFilter(hn3)).isFalse();
+ }
+
+ @Test
+ public void testIsFiltering() {
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .build();
+ assertThat(filter.isFiltering()).isFalse();
+
+ filter = new NotificationHistoryFilter.Builder()
+ .setPackage("pkg")
+ .build();
+ assertThat(filter.isFiltering()).isTrue();
+
+ filter = new NotificationHistoryFilter.Builder()
+ .setChannel("pkg", "channel")
+ .build();
+ assertThat(filter.isFiltering()).isTrue();
+
+ filter = new NotificationHistoryFilter.Builder()
+ .setMaxNotifications(5)
+ .build();
+ assertThat(filter.isFiltering()).isTrue();
+ }
+}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryProtoHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryProtoHelperTest.java
new file mode 100644
index 0000000..458117d
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationHistoryProtoHelperTest.java
@@ -0,0 +1,297 @@
+/*
+ * 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.notification;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.NotificationHistory;
+import android.app.NotificationHistory.HistoricalNotification;
+import android.graphics.drawable.Icon;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.UiServiceTestCase;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class NotificationHistoryProtoHelperTest extends UiServiceTestCase {
+
+ private HistoricalNotification getHistoricalNotification(int index) {
+ return getHistoricalNotification("package" + index, index);
+ }
+
+ private HistoricalNotification getHistoricalNotification(String packageName, int index) {
+ String expectedChannelName = "channelName" + index;
+ String expectedChannelId = "channelId" + index;
+ int expectedUid = 1123456 + index;
+ int expectedUserId = 11 + index;
+ long expectedPostTime = 987654321 + index;
+ String expectedTitle = "title" + index;
+ String expectedText = "text" + index;
+ Icon expectedIcon = Icon.createWithResource(InstrumentationRegistry.getContext(),
+ index);
+
+ return new HistoricalNotification.Builder()
+ .setPackage(packageName)
+ .setChannelName(expectedChannelName)
+ .setChannelId(expectedChannelId)
+ .setUid(expectedUid)
+ .setUserId(expectedUserId)
+ .setPostedTimeMs(expectedPostTime)
+ .setTitle(expectedTitle)
+ .setText(expectedText)
+ .setIcon(expectedIcon)
+ .build();
+ }
+
+ @Test
+ public void testReadWriteNotifications() throws Exception {
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ // loops backwards just to maintain the post time newest -> oldest expectation
+ for (int i = 10; i >= 1; i--) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedEntries.add(n);
+ history.addNotificationToWrite(n);
+ }
+ history.poolStringsFromNotifications();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NotificationHistoryProtoHelper.write(baos, history, 1);
+
+ NotificationHistory actualHistory = new NotificationHistory();
+ NotificationHistoryProtoHelper.read(
+ new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())),
+ actualHistory,
+ new NotificationHistoryFilter.Builder().build());
+
+ assertThat(actualHistory.getHistoryCount()).isEqualTo(history.getHistoryCount());
+ assertThat(actualHistory.getNotificationsToWrite())
+ .containsExactlyElementsIn(expectedEntries);
+ }
+
+ @Test
+ public void testReadWriteNotifications_stringFieldsPersistedEvenIfNoPool() throws Exception {
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ // loops backwards just to maintain the post time newest -> oldest expectation
+ for (int i = 10; i >= 1; i--) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedEntries.add(n);
+ history.addNotificationToWrite(n);
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NotificationHistoryProtoHelper.write(baos, history, 1);
+
+ NotificationHistory actualHistory = new NotificationHistory();
+ NotificationHistoryProtoHelper.read(
+ new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())),
+ actualHistory,
+ new NotificationHistoryFilter.Builder().build());
+
+ assertThat(actualHistory.getHistoryCount()).isEqualTo(history.getHistoryCount());
+ assertThat(actualHistory.getNotificationsToWrite())
+ .containsExactlyElementsIn(expectedEntries);
+ }
+
+ @Test
+ public void testReadNotificationsWithPkgFilter() throws Exception {
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ Set<String> expectedStrings = new HashSet<>();
+ // loops backwards just to maintain the post time newest -> oldest expectation
+ for (int i = 10; i >= 1; i--) {
+ HistoricalNotification n =
+ getHistoricalNotification((i % 2 == 0) ? "pkgEven" : "pkgOdd", i);
+
+ if (i % 2 == 0) {
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ expectedEntries.add(n);
+ }
+ history.addNotificationToWrite(n);
+ }
+ history.poolStringsFromNotifications();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NotificationHistoryProtoHelper.write(baos, history, 1);
+
+ NotificationHistory actualHistory = new NotificationHistory();
+
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setPackage("pkgEven")
+ .build();
+ NotificationHistoryProtoHelper.read(
+ new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())),
+ actualHistory,
+ filter);
+
+ assertThat(actualHistory.getNotificationsToWrite())
+ .containsExactlyElementsIn(expectedEntries);
+ assertThat(Arrays.asList(actualHistory.getPooledStringsToWrite()))
+ .containsExactlyElementsIn(expectedStrings);
+ }
+
+ @Test
+ public void testReadNotificationsWithNumberFilter() throws Exception {
+ int maxCount = 3;
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ Set<String> expectedStrings = new HashSet<>();
+ for (int i = 1; i < 10; i++) {
+ HistoricalNotification n = getHistoricalNotification(i);
+
+ if (i <= maxCount) {
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ expectedEntries.add(n);
+ }
+ history.addNotificationToWrite(n);
+ }
+ history.poolStringsFromNotifications();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NotificationHistoryProtoHelper.write(baos, history, 1);
+
+ NotificationHistory actualHistory = new NotificationHistory();
+
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setMaxNotifications(maxCount)
+ .build();
+ NotificationHistoryProtoHelper.read(
+ new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())),
+ actualHistory,
+ filter);
+
+ assertThat(actualHistory.getNotificationsToWrite())
+ .containsExactlyElementsIn(expectedEntries);
+ assertThat(Arrays.asList(actualHistory.getPooledStringsToWrite()))
+ .containsExactlyElementsIn(expectedStrings);
+ }
+
+ @Test
+ public void testReadNotificationsWithNumberFilter_preExistingNotifs() throws Exception {
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ Set<String> expectedStrings = new HashSet<>();
+ int maxCount = 3;
+
+ NotificationHistory history = new NotificationHistory();
+ HistoricalNotification old1 = getHistoricalNotification(40);
+ history.addNotificationToWrite(old1);
+ expectedEntries.add(old1);
+
+ HistoricalNotification old2 = getHistoricalNotification(50);
+ history.addNotificationToWrite(old2);
+ expectedEntries.add(old2);
+ history.poolStringsFromNotifications();
+ expectedStrings.addAll(Arrays.asList(history.getPooledStringsToWrite()));
+
+ for (int i = 1; i < 10; i++) {
+ HistoricalNotification n = getHistoricalNotification(i);
+
+ if (i <= (maxCount - 2)) {
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ expectedEntries.add(n);
+ }
+ history.addNotificationToWrite(n);
+ }
+ history.poolStringsFromNotifications();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NotificationHistoryProtoHelper.write(baos, history, 1);
+
+ NotificationHistory actualHistory = new NotificationHistory();
+
+ NotificationHistoryFilter filter = new NotificationHistoryFilter.Builder()
+ .setMaxNotifications(maxCount)
+ .build();
+ NotificationHistoryProtoHelper.read(
+ new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())),
+ actualHistory,
+ filter);
+
+ assertThat(actualHistory.getNotificationsToWrite())
+ .containsExactlyElementsIn(expectedEntries);
+ assertThat(Arrays.asList(actualHistory.getPooledStringsToWrite()))
+ .containsExactlyElementsIn(expectedStrings);
+ }
+
+ @Test
+ public void testReadMergeIntoExistingHistory() throws Exception {
+ NotificationHistory history = new NotificationHistory();
+
+ List<HistoricalNotification> expectedEntries = new ArrayList<>();
+ Set<String> expectedStrings = new HashSet<>();
+ for (int i = 1; i < 10; i++) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedEntries.add(n);
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ history.addNotificationToWrite(n);
+ }
+ history.poolStringsFromNotifications();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NotificationHistoryProtoHelper.write(baos, history, 1);
+
+ // set up pre-existing notification history, as though read from a different file
+ NotificationHistory actualHistory = new NotificationHistory();
+ for (int i = 10; i < 20; i++) {
+ HistoricalNotification n = getHistoricalNotification(i);
+ expectedEntries.add(n);
+ expectedStrings.add(n.getPackage());
+ expectedStrings.add(n.getChannelName());
+ expectedStrings.add(n.getChannelId());
+ actualHistory.addNotificationToWrite(n);
+ }
+ actualHistory.poolStringsFromNotifications();
+
+ NotificationHistoryProtoHelper.read(
+ new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())),
+ actualHistory,
+ new NotificationHistoryFilter.Builder().build());
+
+ // Make sure history contains the original and new entries
+ assertThat(actualHistory.getNotificationsToWrite())
+ .containsExactlyElementsIn(expectedEntries);
+ assertThat(Arrays.asList(actualHistory.getPooledStringsToWrite()))
+ .containsExactlyElementsIn(expectedStrings);
+ }
+}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
index fff3221..4daf6d3 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
@@ -38,9 +38,11 @@
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.when;
import android.app.TaskStackListener;
import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
import android.os.IBinder;
import android.platform.test.annotations.Presubmit;
@@ -348,10 +350,12 @@
final ActivityRecord activity = createFullscreenStackWithSimpleActivityAt(
display).topRunningActivityLocked();
activity.setState(ActivityStack.ActivityState.RESUMED, "testHandleActivitySizeCompatMode");
+ when(activity.getRequestedOrientation()).thenReturn(
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
activity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
activity.info.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
- activity.getTaskRecord().getConfiguration().windowConfiguration.setAppBounds(
- 0, 0, 1000, 2000);
+ activity.visible = true;
+ activity.ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */);
final ArrayList<CompletableFuture<IBinder>> resultWrapper = new ArrayList<>();
mService.getTaskChangeNotificationController().registerTaskStackListener(
@@ -363,11 +367,14 @@
}
});
- // Expect the exact token when the activity is in size compatibility mode.
- activity.getResolvedOverrideConfiguration().windowConfiguration.setAppBounds(
- 0, 0, 800, 1600);
resultWrapper.add(new CompletableFuture<>());
- display.handleActivitySizeCompatModeIfNeeded(activity);
+
+ // resize the display to exercise size-compat mode
+ final DisplayContent displayContent = display.mDisplayContent;
+ displayContent.mBaseDisplayHeight = (int) (0.8f * displayContent.mBaseDisplayHeight);
+ Configuration c = new Configuration();
+ displayContent.computeScreenConfiguration(c);
+ display.onRequestedOverrideConfigurationChanged(c);
assertEquals(activity.appToken, resultWrapper.get(0).get(2, TimeUnit.SECONDS));
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
index 2836e69..03367db 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
@@ -18,8 +18,6 @@
import static android.app.ActivityManager.START_SUCCESS;
import static android.app.ActivityManager.START_TASK_TO_FRONT;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
@@ -63,10 +61,8 @@
private ActivityMetricsLaunchObserver mLaunchObserver;
private ActivityMetricsLaunchObserverRegistry mLaunchObserverRegistry;
- private ActivityStack mStack;
- private TaskRecord mTask;
- private ActivityRecord mActivityRecord;
- private ActivityRecord mActivityRecordTrampoline;
+ private ActivityRecord mTrampolineActivity;
+ private ActivityRecord mTopActivity;
@Before
public void setUpAMLO() {
@@ -80,15 +76,10 @@
// Sometimes we need an ActivityRecord for ActivityMetricsLogger to do anything useful.
// This seems to be the easiest way to create an ActivityRecord.
- mStack = new StackBuilder(mRootActivityContainer)
- .setActivityType(ACTIVITY_TYPE_STANDARD)
- .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
- .setOnTop(true)
- .setCreateActivity(true)
+ mTrampolineActivity = new ActivityBuilder(mService).setCreateTask(true).build();
+ mTopActivity = new ActivityBuilder(mService)
+ .setTask(mTrampolineActivity.getTaskRecord())
.build();
- mTask = mStack.topTask();
- mActivityRecord = mTask.getTopActivity();
- mActivityRecordTrampoline = new ActivityBuilder(mService).setTask(mTask).build();
}
@After
@@ -123,8 +114,7 @@
return verify(mock, timeout(TimeUnit.SECONDS.toMillis(5)));
}
- @Test
- public void testOnIntentStarted() throws Exception {
+ private void onIntentStarted() {
Intent intent = new Intent("action 1");
mActivityMetricsLogger.notifyActivityLaunching(intent);
@@ -134,123 +124,120 @@
}
@Test
- public void testOnIntentFailed() throws Exception {
- testOnIntentStarted();
-
- ActivityRecord activityRecord = null;
+ public void testOnIntentFailed() {
+ onIntentStarted();
// Bringing an intent that's already running 'to front' is not considered
// as an ACTIVITY_LAUNCHED state transition.
mActivityMetricsLogger.notifyActivityLaunched(START_TASK_TO_FRONT,
- activityRecord);
+ null /* launchedActivity */);
verifyAsync(mLaunchObserver).onIntentFailed();
verifyNoMoreInteractions(mLaunchObserver);
}
- @Test
- public void testOnActivityLaunched() throws Exception {
- testOnIntentStarted();
+ private void onActivityLaunched() {
+ onIntentStarted();
- mActivityMetricsLogger.notifyActivityLaunched(START_SUCCESS,
- mActivityRecord);
+ mActivityMetricsLogger.notifyActivityLaunched(START_SUCCESS, mTopActivity);
- verifyAsync(mLaunchObserver).onActivityLaunched(eqProto(mActivityRecord), anyInt());
+ verifyAsync(mLaunchObserver).onActivityLaunched(eqProto(mTopActivity), anyInt());
verifyNoMoreInteractions(mLaunchObserver);
}
@Test
- public void testOnActivityLaunchFinished() throws Exception {
- testOnActivityLaunched();
+ public void testOnActivityLaunchFinished() {
+ onActivityLaunched();
- mActivityMetricsLogger.notifyTransitionStarting(new SparseIntArray(),
- SystemClock.elapsedRealtimeNanos());
+ mActivityMetricsLogger.notifyTransitionStarting(new SparseIntArray(),
+ SystemClock.elapsedRealtimeNanos());
- mActivityMetricsLogger.notifyWindowsDrawn(mActivityRecord.getWindowingMode(),
- SystemClock.elapsedRealtimeNanos());
+ notifyWindowsDrawn(mTopActivity);
- verifyAsync(mLaunchObserver).onActivityLaunchFinished(eqProto(mActivityRecord), anyLong());
- verifyNoMoreInteractions(mLaunchObserver);
- }
-
- @Test
- public void testOnActivityLaunchCancelled() throws Exception {
- testOnActivityLaunched();
-
- mActivityRecord.mDrawn = true;
-
- // Cannot time already-visible activities.
- mActivityMetricsLogger.notifyActivityLaunched(START_TASK_TO_FRONT, mActivityRecord);
-
- verifyAsync(mLaunchObserver).onActivityLaunchCancelled(eqProto(mActivityRecord));
- verifyNoMoreInteractions(mLaunchObserver);
- }
-
- @Test
- public void testOnReportFullyDrawn() throws Exception {
- testOnActivityLaunched();
-
- mActivityMetricsLogger.logAppTransitionReportedDrawn(mActivityRecord, false);
-
- verifyAsync(mLaunchObserver).onReportFullyDrawn(eqProto(mActivityRecord), anyLong());
+ verifyAsync(mLaunchObserver).onActivityLaunchFinished(eqProto(mTopActivity), anyLong());
verifyNoMoreInteractions(mLaunchObserver);
}
@Test
- public void testOnActivityLaunchedTrampoline() throws Exception {
- testOnIntentStarted();
+ public void testOnActivityLaunchCancelled() {
+ onActivityLaunched();
- mActivityMetricsLogger.notifyActivityLaunched(START_SUCCESS,
- mActivityRecord);
+ mTopActivity.mDrawn = true;
- verifyAsync(mLaunchObserver).onActivityLaunched(eqProto(mActivityRecord), anyInt());
+ // Cannot time already-visible activities.
+ mActivityMetricsLogger.notifyActivityLaunched(START_TASK_TO_FRONT, mTopActivity);
+
+ verifyAsync(mLaunchObserver).onActivityLaunchCancelled(eqProto(mTopActivity));
+ verifyNoMoreInteractions(mLaunchObserver);
+ }
+
+ @Test
+ public void testOnReportFullyDrawn() {
+ onActivityLaunched();
+
+ mActivityMetricsLogger.logAppTransitionReportedDrawn(mTopActivity, false);
+
+ verifyAsync(mLaunchObserver).onReportFullyDrawn(eqProto(mTopActivity), anyLong());
+ verifyNoMoreInteractions(mLaunchObserver);
+ }
+
+ private void onActivityLaunchedTrampoline() {
+ onIntentStarted();
+
+ mActivityMetricsLogger.notifyActivityLaunched(START_SUCCESS, mTopActivity);
+
+ verifyAsync(mLaunchObserver).onActivityLaunched(eqProto(mTopActivity), anyInt());
// A second, distinct, activity launch is coalesced into the the current app launch sequence
- mActivityMetricsLogger.notifyActivityLaunched(START_SUCCESS,
- mActivityRecordTrampoline);
+ mActivityMetricsLogger.notifyActivityLaunched(START_SUCCESS, mTrampolineActivity);
verifyNoMoreInteractions(mLaunchObserver);
}
- @Test
- public void testOnActivityLaunchFinishedTrampoline() throws Exception {
- testOnActivityLaunchedTrampoline();
-
- mActivityMetricsLogger.notifyTransitionStarting(new SparseIntArray(),
- SystemClock.elapsedRealtimeNanos());
-
- mActivityMetricsLogger.notifyWindowsDrawn(mActivityRecordTrampoline.getWindowingMode(),
- SystemClock.elapsedRealtimeNanos());
-
- verifyAsync(mLaunchObserver).onActivityLaunchFinished(eqProto(mActivityRecordTrampoline),
- anyLong());
- verifyNoMoreInteractions(mLaunchObserver);
+ private void notifyWindowsDrawn(ActivityRecord r) {
+ mActivityMetricsLogger.notifyWindowsDrawn(r.getWindowingMode(),
+ SystemClock.elapsedRealtimeNanos());
}
@Test
- public void testOnActivityLaunchCancelledTrampoline() throws Exception {
- testOnActivityLaunchedTrampoline();
+ public void testOnActivityLaunchFinishedTrampoline() {
+ onActivityLaunchedTrampoline();
- mActivityRecordTrampoline.mDrawn = true;
+ mActivityMetricsLogger.notifyTransitionStarting(new SparseIntArray(),
+ SystemClock.elapsedRealtimeNanos());
- // Cannot time already-visible activities.
- mActivityMetricsLogger.notifyActivityLaunched(START_TASK_TO_FRONT,
- mActivityRecordTrampoline);
+ notifyWindowsDrawn(mTrampolineActivity);
- verifyAsync(mLaunchObserver).onActivityLaunchCancelled(eqProto(mActivityRecordTrampoline));
- verifyNoMoreInteractions(mLaunchObserver);
+ notifyWindowsDrawn(mTopActivity);
+
+ verifyAsync(mLaunchObserver).onActivityLaunchFinished(eqProto(mTrampolineActivity),
+ anyLong());
+ verifyNoMoreInteractions(mLaunchObserver);
}
@Test
- public void testActivityRecordProtoIsNotTooBig() throws Exception {
+ public void testOnActivityLaunchCancelledTrampoline() {
+ onActivityLaunchedTrampoline();
+
+ mTrampolineActivity.mDrawn = true;
+
+ // Cannot time already-visible activities.
+ mActivityMetricsLogger.notifyActivityLaunched(START_TASK_TO_FRONT, mTrampolineActivity);
+
+ verifyAsync(mLaunchObserver).onActivityLaunchCancelled(eqProto(mTrampolineActivity));
+ verifyNoMoreInteractions(mLaunchObserver);
+ }
+
+ @Test
+ public void testActivityRecordProtoIsNotTooBig() {
// The ActivityRecordProto must not be too big, otherwise converting it at runtime
// will become prohibitively expensive.
- assertWithMessage("mActivityRecord: %s", mActivityRecord).
- that(activityRecordToProto(mActivityRecord).length).
- isAtMost(ActivityMetricsLogger.LAUNCH_OBSERVER_ACTIVITY_RECORD_PROTO_CHUNK_SIZE);
+ assertWithMessage("mTopActivity: %s", mTopActivity)
+ .that(activityRecordToProto(mTopActivity).length)
+ .isAtMost(ActivityMetricsLogger.LAUNCH_OBSERVER_ACTIVITY_RECORD_PROTO_CHUNK_SIZE);
- assertWithMessage("mActivityRecordTrampoline: %s", mActivityRecordTrampoline).
- that(activityRecordToProto(mActivityRecordTrampoline).length).
- isAtMost(ActivityMetricsLogger.LAUNCH_OBSERVER_ACTIVITY_RECORD_PROTO_CHUNK_SIZE);
+ assertWithMessage("mTrampolineActivity: %s", mTrampolineActivity)
+ .that(activityRecordToProto(mTrampolineActivity).length)
+ .isAtMost(ActivityMetricsLogger.LAUNCH_OBSERVER_ACTIVITY_RECORD_PROTO_CHUNK_SIZE);
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index bf1508a..99ecdcb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -40,7 +40,6 @@
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
import static com.android.server.wm.ActivityRecord.FINISH_RESULT_CANCELLED;
import static com.android.server.wm.ActivityRecord.FINISH_RESULT_REMOVED;
import static com.android.server.wm.ActivityRecord.FINISH_RESULT_REQUESTED;
@@ -70,10 +69,12 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.when;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.ActivityOptions;
+import android.app.WindowConfiguration;
import android.app.servertransaction.ActivityConfigurationChangeItem;
import android.app.servertransaction.ClientTransaction;
import android.app.servertransaction.PauseActivityItem;
@@ -129,13 +130,13 @@
@Test
public void testStackCleanupOnClearingTask() {
- mActivity.setTask(null);
+ mActivity.onParentChanged(null /*newParent*/, mActivity.getTask());
verify(mStack, times(1)).onActivityRemovedFromStack(any());
}
@Test
public void testStackCleanupOnActivityRemoval() {
- mTask.removeActivity(mActivity);
+ mTask.mTask.removeChild(mActivity);
verify(mStack, times(1)).onActivityRemovedFromStack(any());
}
@@ -485,6 +486,43 @@
}
@Test
+ public void testSizeCompatMode_KeepBoundsWhenChangingFromFreeformToFullscreen() {
+ setupDisplayContentForCompatDisplayInsets();
+
+ // put display in freeform mode
+ ActivityDisplay display = mActivity.getDisplay();
+ final Configuration c = new Configuration(display.getRequestedOverrideConfiguration());
+ c.windowConfiguration.setBounds(new Rect(0, 0, 2000, 1000));
+ c.densityDpi = 300;
+ c.windowConfiguration.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM);
+ display.onRequestedOverrideConfigurationChanged(c);
+
+ // launch compat activity in freeform and store bounds
+ when(mActivity.getRequestedOrientation()).thenReturn(
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ mTask.getRequestedOverrideConfiguration().orientation = Configuration.ORIENTATION_PORTRAIT;
+ mTask.setBounds(100, 100, 400, 600);
+ mActivity.info.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+ mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
+ mActivity.visible = true;
+ ensureActivityConfiguration();
+
+ final Rect bounds = new Rect(mActivity.getBounds());
+ final int density = mActivity.getConfiguration().densityDpi;
+
+ // change display configuration to fullscreen
+ c.windowConfiguration.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FULLSCREEN);
+ display.onRequestedOverrideConfigurationChanged(c);
+
+ // check if dimensions stay the same
+ assertTrue(mActivity.inSizeCompatMode());
+ assertEquals(bounds.width(), mActivity.getBounds().width());
+ assertEquals(bounds.height(), mActivity.getBounds().height());
+ assertEquals(density, mActivity.getConfiguration().densityDpi);
+ assertEquals(WindowConfiguration.WINDOWING_MODE_FULLSCREEN, mActivity.getWindowingMode());
+ }
+
+ @Test
public void testSizeCompatMode_FixedAspectRatioBoundsWithDecor() {
setupDisplayContentForCompatDisplayInsets();
final int decorHeight = 200; // e.g. The device has cutout.
@@ -501,11 +539,17 @@
return null;
}).when(policy).getNonDecorInsetsLw(anyInt() /* rotation */, anyInt() /* width */,
anyInt() /* height */, any() /* displayCutout */, any() /* outInsets */);
+ // set appBounds to incorporate decor
+ final Configuration c =
+ new Configuration(mStack.getDisplay().getRequestedOverrideConfiguration());
+ c.windowConfiguration.getAppBounds().top = decorHeight;
+ mStack.getDisplay().onRequestedOverrideConfigurationChanged(c);
doReturn(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
.when(mActivity).getRequestedOrientation();
mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
mActivity.info.minAspectRatio = mActivity.info.maxAspectRatio = 1;
+ mActivity.visible = true;
ensureActivityConfiguration();
// The parent configuration doesn't change since the first resolved configuration, so the
// activity shouldn't be in the size compatibility mode.
@@ -555,7 +599,10 @@
// Move the non-resizable activity to the new display.
mStack.reparent(newDisplay, true /* onTop */, false /* displayRemoved */);
- assertEquals(originalBounds, mActivity.getWindowConfiguration().getBounds());
+ assertEquals(originalBounds.width(),
+ mActivity.getWindowConfiguration().getBounds().width());
+ assertEquals(originalBounds.height(),
+ mActivity.getWindowConfiguration().getBounds().height());
assertEquals(originalDpi, mActivity.getConfiguration().densityDpi);
assertTrue(mActivity.inSizeCompatMode());
}
@@ -566,9 +613,11 @@
when(mActivity.getRequestedOrientation()).thenReturn(
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mTask.getWindowConfiguration().setAppBounds(mStack.getDisplay().getBounds());
- mTask.getConfiguration().orientation = ORIENTATION_PORTRAIT;
+ mTask.getRequestedOverrideConfiguration().orientation = Configuration.ORIENTATION_PORTRAIT;
mActivity.info.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
- mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
+ mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
+ mActivity.visible = true;
+
ensureActivityConfiguration();
final Rect originalBounds = new Rect(mActivity.getBounds());
@@ -576,7 +625,10 @@
setupDisplayAndParentSize(1000, 2000);
ensureActivityConfiguration();
- assertEquals(originalBounds, mActivity.getWindowConfiguration().getBounds());
+ assertEquals(originalBounds.width(),
+ mActivity.getWindowConfiguration().getBounds().width());
+ assertEquals(originalBounds.height(),
+ mActivity.getWindowConfiguration().getBounds().height());
assertTrue(mActivity.inSizeCompatMode());
}
@@ -584,13 +636,16 @@
public void testSizeCompatMode_FixedScreenLayoutSizeBits() {
final int fixedScreenLayout = Configuration.SCREENLAYOUT_LONG_NO
| Configuration.SCREENLAYOUT_SIZE_NORMAL;
+ final int layoutMask = Configuration.SCREENLAYOUT_LONG_MASK
+ | Configuration.SCREENLAYOUT_SIZE_MASK
+ | Configuration.SCREENLAYOUT_LAYOUTDIR_MASK;
mTask.getRequestedOverrideConfiguration().screenLayout = fixedScreenLayout
| Configuration.SCREENLAYOUT_LAYOUTDIR_LTR;
prepareFixedAspectRatioUnresizableActivity();
// The initial configuration should inherit from parent.
- assertEquals(mTask.getConfiguration().screenLayout,
- mActivity.getConfiguration().screenLayout);
+ assertEquals(mTask.getConfiguration().screenLayout & layoutMask,
+ mActivity.getConfiguration().screenLayout & layoutMask);
mTask.getConfiguration().screenLayout = Configuration.SCREENLAYOUT_LAYOUTDIR_RTL
| Configuration.SCREENLAYOUT_LONG_YES | Configuration.SCREENLAYOUT_SIZE_LARGE;
@@ -598,7 +653,7 @@
// The size and aspect ratio bits don't change, but the layout direction should be updated.
assertEquals(fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_RTL,
- mActivity.getConfiguration().screenLayout);
+ mActivity.getConfiguration().screenLayout & layoutMask);
}
@Test
@@ -618,13 +673,18 @@
| ActivityInfo.CONFIG_WINDOW_CONFIGURATION)
.when(display).getLastOverrideConfigurationChanges();
mActivity.onConfigurationChanged(mTask.getConfiguration());
+ when(display.getLastOverrideConfigurationChanges()).thenCallRealMethod();
// The override configuration should not change so it is still in size compatibility mode.
assertTrue(mActivity.inSizeCompatMode());
- // Simulate the display changes density.
- doReturn(ActivityInfo.CONFIG_DENSITY).when(display).getLastOverrideConfigurationChanges();
+ // Change display density
+ final DisplayContent displayContent = mStack.getDisplay().mDisplayContent;
+ displayContent.mBaseDisplayDensity = (int) (0.7f * displayContent.mBaseDisplayDensity);
+ final Configuration c = new Configuration();
+ displayContent.computeScreenConfiguration(c);
mService.mAmInternal = mock(ActivityManagerInternal.class);
- mActivity.onConfigurationChanged(mTask.getConfiguration());
+ mStack.getDisplay().onRequestedOverrideConfigurationChanged(c);
+
// The override configuration should be reset and the activity's process will be killed.
assertFalse(mActivity.inSizeCompatMode());
verify(mActivity).restartProcessIfVisible();
@@ -735,7 +795,7 @@
// Remove activity from task
mActivity.finishing = false;
- mActivity.setTask(null);
+ mActivity.onParentChanged(null /*newParent*/, mActivity.getTask());
assertEquals("Activity outside of task/stack cannot be finished", FINISH_RESULT_CANCELLED,
mActivity.finishIfPossible("test", false /* oomAdj */));
assertFalse(mActivity.finishing);
@@ -935,6 +995,35 @@
}
/**
+ * Verify that finish request won't change the state of next top activity if the current
+ * finishing activity doesn't need to be destroyed immediately. The case is usually like
+ * from {@link ActivityStack#completePauseLocked(boolean, ActivityRecord)} to
+ * {@link ActivityRecord#completeFinishing(String)}, so the complete-pause should take the
+ * responsibility to resume the next activity with updating the state.
+ */
+ @Test
+ public void testCompleteFinishing_keepStateOfNextInvisible() {
+ final ActivityRecord currentTop = mActivity;
+ currentTop.visible = currentTop.nowVisible = true;
+
+ // Simulates that {@code currentTop} starts an existing activity from background (so its
+ // state is stopped) and the starting flow just goes to place it at top.
+ final ActivityStack nextStack = new StackBuilder(mRootActivityContainer).build();
+ final ActivityRecord nextTop = nextStack.getTopActivity();
+ nextTop.setState(STOPPED, "test");
+
+ mStack.mPausingActivity = currentTop;
+ currentTop.finishing = true;
+ currentTop.setState(PAUSED, "test");
+ currentTop.completeFinishing("completePauseLocked");
+
+ // Current top becomes stopping because it is visible and the next is invisible.
+ assertEquals(STOPPING, currentTop.getState());
+ // The state of next activity shouldn't be changed.
+ assertEquals(STOPPED, nextTop.getState());
+ }
+
+ /**
* Verify that complete finish request for visible activity must be delayed before the next one
* becomes visible.
*/
@@ -1242,6 +1331,8 @@
c.windowConfiguration.setBounds(new Rect(0, 0, width, height));
c.windowConfiguration.setAppBounds(0, 0, width, height);
c.windowConfiguration.setRotation(ROTATION_0);
+ c.orientation = width > height
+ ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT;
mStack.getDisplay().onRequestedOverrideConfigurationChanged(c);
return displayContent;
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
index 2835c1f..fcebb81 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
@@ -1140,12 +1140,50 @@
}
@Test
+ public void testClearUnknownAppVisibilityBehindFullscreenActivity() {
+ final UnknownAppVisibilityController unknownAppVisibilityController =
+ mDefaultDisplay.mDisplayContent.mUnknownAppVisibilityController;
+ final KeyguardController keyguardController = mSupervisor.getKeyguardController();
+ doReturn(true).when(keyguardController).isKeyguardLocked();
+
+ // Start 2 activities that their processes have not yet started.
+ final ActivityRecord[] activities = new ActivityRecord[2];
+ mSupervisor.beginDeferResume();
+ for (int i = 0; i < activities.length; i++) {
+ final ActivityRecord r = new ActivityBuilder(mService).setTask(mTask).build();
+ activities[i] = r;
+ doReturn(null).when(mService).getProcessController(
+ eq(r.processName), eq(r.info.applicationInfo.uid));
+ r.setState(ActivityStack.ActivityState.INITIALIZING, "test");
+ // Ensure precondition that the activity is opaque.
+ assertTrue(r.occludesParent());
+ mSupervisor.startSpecificActivityLocked(r, false /* andResume */,
+ false /* checkConfig */);
+ }
+ mSupervisor.endDeferResume();
+
+ doReturn(false).when(mService).isBooting();
+ doReturn(true).when(mService).isBooted();
+ // 2 activities are started while keyguard is locked, so they are waiting to be resolved.
+ assertFalse(unknownAppVisibilityController.allResolved());
+
+ // Assume the top activity is going to resume and
+ // {@link RootActivityContainer#cancelInitializingActivities} should clear the unknown
+ // visibility records that are occluded.
+ mStack.resumeTopActivityUncheckedLocked(null /* prev */, null /* options */);
+ // Assume the top activity relayouted, just remove it directly.
+ unknownAppVisibilityController.appRemovedOrHidden(activities[1]);
+ // All unresolved records should be removed.
+ assertTrue(unknownAppVisibilityController.allResolved());
+ }
+
+ @Test
public void testNonTopVisibleActivityNotResume() {
final ActivityRecord nonTopVisibleActivity =
new ActivityBuilder(mService).setTask(mTask).build();
new ActivityBuilder(mService).setTask(mTask).build();
doReturn(false).when(nonTopVisibleActivity).attachedToProcess();
- doReturn(true).when(nonTopVisibleActivity).shouldBeVisibleIgnoringKeyguard(anyBoolean());
+ doReturn(true).when(nonTopVisibleActivity).shouldBeVisible(anyBoolean(), anyBoolean());
doNothing().when(mSupervisor).startSpecificActivityLocked(any(), anyBoolean(),
anyBoolean());
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
index 8a9423a..ace5d4e 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
@@ -44,6 +44,7 @@
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.server.wm.ActivityDisplay.POSITION_BOTTOM;
@@ -99,6 +100,7 @@
private ActivityStarter mStarter;
private ActivityStartController mController;
private ActivityMetricsLogger mActivityMetricsLogger;
+ private PackageManagerInternal mMockPackageManager;
private static final int PRECONDITION_NO_CALLER_APP = 1;
private static final int PRECONDITION_NO_INTENT_COMPONENT = 1 << 1;
@@ -359,17 +361,20 @@
}
// Set up mock package manager internal and make sure no unmocked methods are called
- PackageManagerInternal mockPackageManager = mock(PackageManagerInternal.class,
+ mMockPackageManager = mock(PackageManagerInternal.class,
invocation -> {
throw new RuntimeException("Not stubbed");
});
- doReturn(mockPackageManager).when(mService).getPackageManagerInternalLocked();
+ doReturn(mMockPackageManager).when(mService).getPackageManagerInternalLocked();
+ doReturn(false).when(mMockPackageManager).isInstantAppInstallerComponent(any());
+ doReturn(null).when(mMockPackageManager).resolveIntent(any(), any(), anyInt(), anyInt(),
+ anyBoolean(), anyInt());
// Never review permissions
- doReturn(false).when(mockPackageManager).isPermissionsReviewRequired(any(), anyInt());
- doNothing().when(mockPackageManager).grantImplicitAccess(
+ doReturn(false).when(mMockPackageManager).isPermissionsReviewRequired(any(), anyInt());
+ doNothing().when(mMockPackageManager).grantImplicitAccess(
anyInt(), any(), anyInt(), anyInt());
- doNothing().when(mockPackageManager).notifyPackageUse(anyString(), anyInt());
+ doNothing().when(mMockPackageManager).notifyPackageUse(anyString(), anyInt());
final Intent intent = new Intent();
intent.addFlags(launchFlags);
@@ -710,7 +715,7 @@
if (startedActivity != null && startedActivity.getTaskRecord() != null) {
// Remove the activity so it doesn't interfere with with subsequent activity launch
// tests from this method.
- startedActivity.getTaskRecord().removeActivity(startedActivity);
+ startedActivity.getTaskRecord().mTask.removeChild(startedActivity);
}
}
@@ -913,4 +918,46 @@
verify(recentTasks, times(1)).setFreezeTaskListReordering();
verify(recentTasks, times(1)).resetFreezeTaskListReorderingOnTimeout();
}
+
+ @Test
+ public void testNoActivityInfo() {
+ final ActivityStarter starter = prepareStarter(0 /* flags */);
+ spyOn(starter.mRequest);
+
+ final Intent intent = new Intent();
+ intent.setComponent(ActivityBuilder.getDefaultComponent());
+ starter.setReason("testNoActivityInfo").setIntent(intent)
+ .setActivityInfo(null).execute();
+ verify(starter.mRequest).resolveActivity(any());
+ }
+
+ @Test
+ public void testResolveEphemeralInstaller() {
+ final ActivityStarter starter = prepareStarter(0 /* flags */);
+ final Intent intent = new Intent();
+ intent.setComponent(ActivityBuilder.getDefaultComponent());
+
+ doReturn(true).when(mMockPackageManager).isInstantAppInstallerComponent(any());
+ starter.setIntent(intent).mRequest.resolveActivity(mService.mStackSupervisor);
+
+ // Make sure the client intent won't be modified.
+ assertThat(intent.getComponent()).isNotNull();
+ assertThat(starter.getIntent().getComponent()).isNull();
+ }
+
+ @Test
+ public void testNotAllowIntentWithFd() {
+ final ActivityStarter starter = prepareStarter(0 /* flags */);
+ final Intent intent = spy(new Intent());
+ intent.setComponent(ActivityBuilder.getDefaultComponent());
+ doReturn(true).when(intent).hasFileDescriptors();
+
+ boolean exceptionCaught = false;
+ try {
+ starter.setIntent(intent).execute();
+ } catch (IllegalArgumentException ex) {
+ exceptionCaught = true;
+ }
+ assertThat(exceptionCaught).isTrue();
+ }
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
index d43fe63..80f0851 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
@@ -19,6 +19,7 @@
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
+import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@@ -42,7 +43,6 @@
import android.os.Build;
import android.os.UserHandle;
import android.service.voice.IVoiceInteractionSession;
-import android.util.Pair;
import android.view.DisplayInfo;
import com.android.server.AttributeCache;
@@ -388,7 +388,7 @@
private final RootActivityContainer mRootActivityContainer;
private ActivityDisplay mDisplay;
private int mStackId = -1;
- private int mWindowingMode = WINDOWING_MODE_FULLSCREEN;
+ private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
private int mActivityType = ACTIVITY_TYPE_STANDARD;
private boolean mOnTop = true;
private boolean mCreateActivity = true;
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java
index 7449efd..1fb6a56 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java
@@ -60,11 +60,9 @@
private ActivityRecord mActivity;
public void setUpOnDisplay(DisplayContent dc) {
- mStack = createTaskStackOnDisplay(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_STANDARD, dc);
- mTask = createTaskInStack(mStack, 0 /* userId */);
- mActivity = WindowTestUtils.createTestActivityRecord(dc);
-
- mTask.addChild(mActivity, 0);
+ mActivity = createTestActivityRecord(dc, WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_STANDARD);
+ mTask = mActivity.getTask();
+ mStack = mTask.mStack;
// Set a remote animator with snapshot disabled. Snapshots don't work in wmtests.
RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
@@ -167,7 +165,7 @@
// setup currently defaults to no snapshot.
setUpOnDisplay(mDisplayContent);
- mTask.setWindowingMode(WINDOWING_MODE_FREEFORM);
+ mTask.mTaskRecord.setWindowingMode(WINDOWING_MODE_FREEFORM);
assertEquals(1, mDisplayContent.mChangingApps.size());
assertTrue(mActivity.isInChangeTransition());
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
index d68aef0..2f0486d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
@@ -35,6 +35,7 @@
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM;
@@ -208,6 +209,9 @@
@Test
public void testSizeCompatBounds() {
+ // Disable the real configuration resolving because we only simulate partial flow.
+ // TODO: Have test use full flow.
+ doNothing().when(mTask.mTaskRecord).computeConfigResourceOverrides(any(), any());
final Rect fixedBounds = mActivity.getRequestedOverrideConfiguration().windowConfiguration
.getBounds();
fixedBounds.set(0, 0, 1200, 1600);
@@ -249,6 +253,8 @@
@Test
@Presubmit
public void testGetOrientation() {
+ mActivity.setHidden(false);
+
mActivity.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
mActivity.setOccludesParent(false);
@@ -309,6 +315,8 @@
@Test
public void testSetOrientation() {
+ mActivity.setHidden(false);
+
// Assert orientation is unspecified to start.
assertEquals(SCREEN_ORIENTATION_UNSPECIFIED, mActivity.getOrientation());
diff --git a/services/tests/wmtests/src/com/android/server/wm/ConfigurationContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/ConfigurationContainerTests.java
index e7f7d21..bcd93715 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ConfigurationContainerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ConfigurationContainerTests.java
@@ -334,8 +334,9 @@
private TestConfigurationContainer mParent;
TestConfigurationContainer addChild(TestConfigurationContainer childContainer) {
+ final ConfigurationContainer oldParent = childContainer.getParent();
childContainer.mParent = this;
- childContainer.onParentChanged();
+ childContainer.onParentChanged(this, oldParent);
mChildren.add(childContainer);
return childContainer;
}
@@ -349,8 +350,9 @@
}
void removeChild(TestConfigurationContainer child) {
+ final ConfigurationContainer oldParent = child.getParent();
child.mParent = null;
- child.onParentChanged();
+ child.onParentChanged(null, oldParent);
}
@Override
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
index 2a3731a..67b7a66 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
@@ -24,6 +24,7 @@
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
+import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
@@ -56,15 +57,23 @@
import android.view.DisplayInfo;
import android.view.WindowManager;
+import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
import com.android.server.policy.WindowManagerPolicy;
import com.android.server.wm.utils.WmDisplayCutout;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/**
+ * Tests for the {@link DisplayPolicy} class.
+ *
+ * Build/Install/Run:
+ * atest WmTests:DisplayPolicyLayoutTests
+ */
@SmallTest
@Presubmit
@RunWith(WindowTestRunner.class)
@@ -93,6 +102,12 @@
attrs.format = PixelFormat.TRANSLUCENT;
}
+ @After
+ public void tearDown() {
+ PolicyControl.setFilters("");
+ mWindow.getDisplayContent().mInputMethodTarget = null;
+ }
+
public void setRotation(int rotation) {
mRotation = rotation;
updateDisplayFrames();
@@ -393,6 +408,105 @@
assertInsetBy(mWindow.getDisplayFrameLw(), 0, 0, 0, 0);
}
+ @FlakyTest(bugId = 129711077)
+ @Test
+ public void layoutWindowLw_withImmersive_SoftInputAdjustResize() {
+ synchronized (mWm.mGlobalLock) {
+ mWindow.mAttrs.softInputMode = SOFT_INPUT_ADJUST_RESIZE;
+ mWindow.mAttrs.flags = 0;
+ mWindow.mAttrs.systemUiVisibility =
+ SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | SYSTEM_UI_FLAG_FULLSCREEN | SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+
+ addWindow(mWindow);
+
+ mWindow.getDisplayContent().mInputMethodTarget = mWindow;
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mFrames.mContent.bottom = mFrames.mVoiceContent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mFrames.mCurrent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+
+ int bottomInset = mFrames.mDisplayHeight - INPUT_METHOD_WINDOW_TOP;
+ assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), 0, 0);
+ assertInsetByTopBottom(mWindow.getVisibleFrameLw(), STATUS_BAR_HEIGHT, bottomInset);
+ }
+ }
+
+ @FlakyTest(bugId = 129711077)
+ @Test
+ public void layoutWindowLw_withImmersive_SoftInputAdjustNothing() {
+ synchronized (mWm.mGlobalLock) {
+ mWindow.mAttrs.softInputMode = SOFT_INPUT_ADJUST_NOTHING;
+ mWindow.mAttrs.flags = 0;
+ mWindow.mAttrs.systemUiVisibility =
+ SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | SYSTEM_UI_FLAG_FULLSCREEN | SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+
+ addWindow(mWindow);
+
+ mWindow.getDisplayContent().mInputMethodTarget = mWindow;
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mFrames.mContent.bottom = mFrames.mVoiceContent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mFrames.mCurrent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+
+ assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), 0, 0);
+ assertInsetByTopBottom(mWindow.getVisibleFrameLw(), 0, 0);
+ }
+ }
+
+ @FlakyTest(bugId = 129711077)
+ @Test
+ public void layoutWindowLw_withForceImmersive_fullscreen() {
+ synchronized (mWm.mGlobalLock) {
+ mWindow.mAttrs.softInputMode = SOFT_INPUT_ADJUST_RESIZE;
+ mWindow.mAttrs.flags = 0;
+ mWindow.mAttrs.systemUiVisibility = 0;
+ PolicyControl.setFilters(PolicyControl.NAME_IMMERSIVE_FULL + "=*");
+
+ addWindow(mWindow);
+
+ mWindow.getDisplayContent().mInputMethodTarget = mWindow;
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mFrames.mContent.bottom = mFrames.mVoiceContent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mFrames.mCurrent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+
+ int bottomInset = mFrames.mDisplayHeight - INPUT_METHOD_WINDOW_TOP;
+ assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), 0, 0);
+ assertInsetByTopBottom(mWindow.getVisibleFrameLw(), STATUS_BAR_HEIGHT, bottomInset);
+ }
+ }
+
+ @FlakyTest(bugId = 129711077)
+ @Test
+ public void layoutWindowLw_withForceImmersive_nonFullscreen() {
+ synchronized (mWm.mGlobalLock) {
+ mWindow.mAttrs.softInputMode = SOFT_INPUT_ADJUST_RESIZE;
+ mWindow.mAttrs.flags = 0;
+ mWindow.mAttrs.systemUiVisibility = 0;
+ mWindow.mAttrs.width = DISPLAY_WIDTH / 2;
+ mWindow.mAttrs.height = DISPLAY_HEIGHT / 2;
+ PolicyControl.setFilters(PolicyControl.NAME_IMMERSIVE_FULL + "=*");
+
+ addWindow(mWindow);
+
+ mWindow.getDisplayContent().mInputMethodTarget = mWindow;
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mFrames.mContent.bottom = mFrames.mVoiceContent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mFrames.mCurrent.bottom = INPUT_METHOD_WINDOW_TOP;
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+
+ int bottomInset = mFrames.mDisplayHeight - INPUT_METHOD_WINDOW_TOP;
+ assertInsetByTopBottom(mWindow.getParentFrame(), STATUS_BAR_HEIGHT, bottomInset);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, bottomInset);
+ assertInsetByTopBottom(mWindow.getVisibleFrameLw(), STATUS_BAR_HEIGHT, bottomInset);
+ }
+ }
+
@Test
public void layoutHint_appWindow() {
// Initialize DisplayFrames
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java
index 2933b4a..d4558dc 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java
@@ -62,6 +62,7 @@
static final int STATUS_BAR_HEIGHT = 10;
static final int NAV_BAR_HEIGHT = 15;
static final int DISPLAY_CUTOUT_HEIGHT = 8;
+ static final int INPUT_METHOD_WINDOW_TOP = 585;
DisplayPolicy mDisplayPolicy;
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
index fff77f5..7026004 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -152,7 +152,7 @@
hiddenActivity.setHidden(true);
mDisplayContent.getConfiguration().windowConfiguration.setRotation(
mDisplayContent.getRotation());
- mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray());
+ mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
// Ensure that we are animating the target activity as well
assertTrue(mController.isAnimatingTask(homeActivity.getTask()));
@@ -181,7 +181,7 @@
mDisplayContent.getConfiguration().windowConfiguration.setRotation(
mDisplayContent.getRotation());
- mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray());
+ mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeAppWindow);
mController.startAnimation();
// Ensure that we are animating the app and wallpaper target
@@ -210,7 +210,7 @@
mDisplayContent.getConfiguration().windowConfiguration.setRotation(
mDisplayContent.getRotation());
- mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray());
+ mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
mController.startAnimation();
// Cancel the animation and ensure the controller is still running
@@ -242,7 +242,7 @@
doReturn(true).when(mDisplayContent.mWallpaperController).isWallpaperVisible();
// Start and finish the animation
- mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray());
+ mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
mController.startAnimation();
// Reset at this point since we may remove adapters that couldn't be created
reset(mController);
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
index ebedde7..839ddb2 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
@@ -78,7 +78,7 @@
mRecentsAnimationController = mock(RecentsAnimationController.class);
mService.mWindowManager.setRecentsAnimationController(mRecentsAnimationController);
doNothing().when(mService.mWindowManager).initializeRecentsAnimation(
- anyInt(), any(), any(), anyInt(), any());
+ anyInt(), any(), any(), anyInt(), any(), any());
doReturn(true).when(mService.mWindowManager).canStartRecentsAnimation();
final RecentTasks recentTasks = mService.getRecentTasks();
@@ -385,7 +385,8 @@
return null;
}).when(mService.mWindowManager).initializeRecentsAnimation(
anyInt() /* targetActivityType */, any() /* recentsAnimationRunner */,
- any() /* callbacks */, anyInt() /* displayId */, any() /* recentTaskIds */);
+ any() /* callbacks */, anyInt() /* displayId */, any() /* recentTaskIds */,
+ any() /* targetActivity */);
}
Intent recentsIntent = new Intent();
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index dd85f69..5a141ae 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -410,51 +410,8 @@
}
@Test
- public void testForceMaximizesPreDApp() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
- WINDOWING_MODE_FREEFORM);
-
- final ActivityOptions options = ActivityOptions.makeBasic();
- options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
- options.setLaunchBounds(new Rect(0, 0, 200, 100));
-
- mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
- mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
- mCurrent.mBounds.set(0, 0, 200, 100);
-
- mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.CUPCAKE;
-
- assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
- mActivity, /* source */ null, options, mCurrent, mResult));
-
- assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
- WINDOWING_MODE_FREEFORM);
- }
-
- @Test
- public void testForceMaximizesAppWithoutMultipleDensitySupport() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
- WINDOWING_MODE_FREEFORM);
-
- final ActivityOptions options = ActivityOptions.makeBasic();
- options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
- options.setLaunchBounds(new Rect(0, 0, 200, 100));
-
- mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
- mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
- mCurrent.mBounds.set(0, 0, 200, 100);
-
- mActivity.info.applicationInfo.flags = 0;
-
- assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
- mActivity, /* source */ null, options, mCurrent, mResult));
-
- assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
- WINDOWING_MODE_FREEFORM);
- }
-
- @Test
public void testForceMaximizesUnresizeableApp() {
+ mService.mSizeCompatFreeform = false;
final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
WINDOWING_MODE_FREEFORM);
@@ -476,6 +433,33 @@
}
@Test
+ public void testLaunchesAppInWindowOnFreeformDisplay() {
+ mService.mSizeCompatFreeform = true;
+ final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ WINDOWING_MODE_FREEFORM);
+
+ Rect expectedLaunchBounds = new Rect(0, 0, 200, 100);
+
+ final ActivityOptions options = ActivityOptions.makeBasic();
+ options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
+ options.setLaunchBounds(expectedLaunchBounds);
+
+ mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
+ mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
+ mCurrent.mBounds.set(expectedLaunchBounds);
+
+ mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
+
+ assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
+ mActivity, /* source */ null, options, mCurrent, mResult));
+
+ assertEquals(expectedLaunchBounds, mResult.mBounds);
+
+ assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode,
+ WINDOWING_MODE_FREEFORM);
+ }
+
+ @Test
public void testSkipsForceMaximizingAppsOnNonFreeformDisplay() {
final ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java
index dc89f50..f8d49ad 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java
@@ -16,6 +16,8 @@
package com.android.server.wm;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.any;
@@ -64,6 +66,7 @@
any(InputChannel.class))).thenReturn(true);
mWindow = createWindow(null, TYPE_BASE_APPLICATION, "window");
+ mWindow.getTask().setResizeable(RESIZE_MODE_RESIZEABLE);
mWindow.mInputChannel = new InputChannel();
mWm.mWindowMap.put(mWindow.mClient.asBinder(), mWindow);
doReturn(mock(InputMonitor.class)).when(mDisplayContent).getInputMonitor();
@@ -129,4 +132,23 @@
assertFalse(mTarget.isPositioningLocked());
assertNull(mTarget.getDragWindowHandleLocked());
}
+
+ @Test
+ public void testHandleTapOutsideNonResizableTask() {
+ assertFalse(mTarget.isPositioningLocked());
+ assertNull(mTarget.getDragWindowHandleLocked());
+
+ final DisplayContent content = mock(DisplayContent.class);
+ doReturn(mWindow.getTask()).when(content).findTaskForResizePoint(anyInt(), anyInt());
+ assertNotNull(mWindow.getTask().getTopVisibleAppMainWindow());
+
+ mWindow.getTask().setResizeable(RESIZE_MODE_UNRESIZEABLE);
+
+ mTarget.handleTapOutsideTask(content, 0, 0);
+ // Wait until the looper processes finishTaskPositioning.
+ assertTrue(waitHandlerIdle(mWm.mH, TIMEOUT_MS));
+
+ assertFalse(mTarget.isPositioningLocked());
+ }
+
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
index 0f8fb04..a4e38f1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
@@ -403,7 +403,9 @@
// Without limiting to be inside the parent bounds, the out screen size should keep relative
// to the input bounds.
final ActivityRecord.CompatDisplayInsets compatIntsets =
- new ActivityRecord.CompatDisplayInsets(displayContent);
+ new ActivityRecord.CompatDisplayInsets(displayContent, new Rect(0, 0,
+ displayContent.mBaseDisplayWidth, displayContent.mBaseDisplayHeight),
+ false);
task.computeConfigResourceOverrides(inOutConfig, parentConfig, compatIntsets);
assertEquals((shortSide - statusBarHeight) * DENSITY_DEFAULT / parentConfig.densityDpi,
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java
index 5b9a785..2fc03c7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java
@@ -21,12 +21,15 @@
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
@@ -119,7 +122,7 @@
@Test
public void testRemoveContainer() {
final TaskStack stack = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stack);
+ final Task task = createTaskInStack(stack, 0 /* userId */);
assertNotNull(stack);
assertNotNull(task);
@@ -135,10 +138,10 @@
@Test
public void testRemoveContainer_deferRemoval() {
final TaskStack stack = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stack);
+ final Task task = createTaskInStack(stack, 0 /* userId */);
// Stack removal is deferred if one of its child is animating.
- task.setLocalIsAnimating(true);
+ doReturn(true).when(task).isSelfAnimating();
stack.removeIfPossible();
// For the case of deferred removal the task controller will still be connected to the its
@@ -157,8 +160,7 @@
public void testReparent() {
// Create first stack on primary display.
final TaskStack stack1 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task1 = WindowTestUtils.createTestTask(stack1);
- task1.mOnDisplayChangedCalled = false;
+ final Task task1 = createTaskInStack(stack1, 0 /* userId */);
// Create second display and put second stack on it.
final DisplayContent dc = createNewDisplay();
@@ -170,7 +172,7 @@
final int stack1PositionInParent = stack1.getParent().mChildren.indexOf(stack1);
final int stack2PositionInParent = stack1.getParent().mChildren.indexOf(stack2);
assertEquals(stack1PositionInParent, stack2PositionInParent + 1);
- assertTrue(task1.mOnDisplayChangedCalled);
+ verify(task1, times(1)).onDisplayChanged(any());
}
@Test
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
index 2ba1834..4dfa2664 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
@@ -16,11 +16,16 @@
package com.android.server.wm;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import android.graphics.Point;
import android.graphics.Rect;
@@ -45,7 +50,7 @@
@Test
public void testRemoveContainer() {
final TaskStack stackController1 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stackController1);
+ final Task task = createTaskInStack(stackController1, 0 /* userId */);
final ActivityRecord activity =
WindowTestUtils.createActivityRecordInTask(mDisplayContent, task);
@@ -59,11 +64,11 @@
@Test
public void testRemoveContainer_deferRemoval() {
final TaskStack stackController1 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stackController1);
+ final Task task = createTaskInStack(stackController1, 0 /* userId */);
final ActivityRecord activity =
WindowTestUtils.createActivityRecordInTask(mDisplayContent, task);
- task.mShouldDeferRemoval = true;
+ doReturn(true).when(task).shouldDeferRemoval();
task.removeIfPossible();
// For the case of deferred removal the task will still be connected to the its app token
@@ -81,9 +86,9 @@
@Test
public void testReparent() {
final TaskStack stackController1 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stackController1);
+ final Task task = createTaskInStack(stackController1, 0 /* userId */);
final TaskStack stackController2 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task2 = WindowTestUtils.createTestTask(stackController2);
+ final Task task2 = createTaskInStack(stackController2, 0 /* userId */);
boolean gotException = false;
try {
@@ -104,34 +109,33 @@
task.reparent(stackController2, 0, false/* moveParents */);
assertEquals(stackController2, task.getParent());
- assertEquals(0, task.positionInParent());
- assertEquals(1, task2.positionInParent());
+ assertEquals(0, task.getParent().mChildren.indexOf(task));
+ assertEquals(1, task2.getParent().mChildren.indexOf(task2));
}
@Test
public void testReparent_BetweenDisplays() {
// Create first stack on primary display.
final TaskStack stack1 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stack1);
- task.mOnDisplayChangedCalled = false;
+ final Task task = createTaskInStack(stack1, 0 /* userId */);
assertEquals(mDisplayContent, stack1.getDisplayContent());
// Create second display and put second stack on it.
final DisplayContent dc = createNewDisplay();
final TaskStack stack2 = createTaskStackOnDisplay(dc);
- final WindowTestUtils.TestTask task2 = WindowTestUtils.createTestTask(stack2);
+ final Task task2 = createTaskInStack(stack2, 0 /* userId */);
// Reparent and check state
task.reparent(stack2, 0, false /* moveParents */);
assertEquals(stack2, task.getParent());
- assertEquals(0, task.positionInParent());
- assertEquals(1, task2.positionInParent());
- assertTrue(task.mOnDisplayChangedCalled);
+ assertEquals(0, task.getParent().mChildren.indexOf(task));
+ assertEquals(1, task2.getParent().mChildren.indexOf(task2));
+ verify(task, times(1)).onDisplayChanged(any());
}
@Test
public void testBounds() {
final TaskStack stack1 = createTaskStackOnDisplay(mDisplayContent);
- final WindowTestUtils.TestTask task = WindowTestUtils.createTestTask(stack1);
+ final Task task = createTaskInStack(stack1, 0 /* userId */);
// Check that setting bounds also updates surface position
Rect bounds = new Rect(10, 10, 100, 200);
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java
index 8117ff6..85aff7f 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java
@@ -772,7 +772,7 @@
}
@Override
- void onParentChanged() {
+ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
mOnParentChangedCalled = true;
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java
index 5c547c2..8cd97cb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java
@@ -16,24 +16,24 @@
package com.android.server.wm;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.view.DisplayCutout.BOUNDS_POSITION_TOP;
import static android.view.DisplayCutout.fromBoundingRect;
-import static android.view.WindowManager.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
+
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
import android.view.DisplayInfo;
import android.view.Gravity;
-import android.view.IWindow;
import android.view.WindowManager;
import androidx.test.filters.FlakyTest;
@@ -57,29 +57,11 @@
@RunWith(WindowTestRunner.class)
public class WindowFrameTests extends WindowTestsBase {
- private final IWindow mIWindow = new TestIWindow();
private final Rect mEmptyRect = new Rect();
private DisplayContent mTestDisplayContent;
- static class FrameTestWindowState extends WindowState {
- boolean mDockedResizingForTest = false;
- FrameTestWindowState(WindowManagerService wm, IWindow iWindow, WindowToken windowToken,
- WindowManager.LayoutParams attrs) {
- super(wm, mock(Session.class), iWindow, windowToken, null, 0, 0, attrs, 0, 0,
- false /* ownerCanAddInternalSystemWindow */);
- }
-
- @Override
- boolean isDockedResizing() {
- return mDockedResizingForTest;
- }
- }
-
- TaskStack mStubStack;
-
@Before
public void setUp() throws Exception {
- mStubStack = mock(TaskStack.class);
DisplayInfo testDisplayInfo = new DisplayInfo(mDisplayInfo);
testDisplayInfo.displayCutout = null;
mTestDisplayContent = createNewDisplay(testDisplayInfo);
@@ -129,8 +111,7 @@
expectedRect.bottom);
}
- private void assertPolicyCrop(
- FrameTestWindowState w, int left, int top, int right, int bottom) {
+ private void assertPolicyCrop(WindowState w, int left, int top, int right, int bottom) {
Rect policyCrop = new Rect();
w.calculatePolicyCrop(policyCrop);
assertRect(policyCrop, left, top, right, bottom);
@@ -139,7 +120,7 @@
@Test
public void testLayoutInFullscreenTaskInsets() {
// fullscreen task doesn't use bounds for computeFrame
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ WindowState w = createWindow();
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
final int bottomContentInset = 100;
@@ -196,7 +177,7 @@
@Test
public void testLayoutInFullscreenTaskNoInsets() {
// fullscreen task doesn't use bounds for computeFrame
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ WindowState w = createWindow();
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
// With no insets or system decor all the frames incoming from PhoneWindowManager
@@ -278,16 +259,16 @@
final int logicalWidth = displayInfo.logicalWidth;
final int logicalHeight = displayInfo.logicalHeight;
- final int taskLeft = logicalWidth / 4;
- final int taskTop = logicalHeight / 4;
- final int taskRight = logicalWidth / 4 * 3;
- final int taskBottom = logicalHeight / 4 * 3;
- final Rect taskBounds = new Rect(taskLeft, taskTop, taskRight, taskBottom);
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ final Rect taskBounds = new Rect(
+ logicalWidth / 4, logicalHeight / 4, logicalWidth / 4 * 3, logicalHeight / 4 * 3);
+ WindowState w = createWindow();
final Task task = w.getTask();
// Use split-screen because it is non-fullscreen, but also not floating
- task.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
- task.setBounds(taskBounds);
+ task.mTaskRecord.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
+ task.mTaskRecord.setBounds(taskBounds);
+ // The bounds we are requesting might be different from what the system resolved based on
+ // other factors.
+ final Rect resolvedTaskBounds = task.getBounds();
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight);
@@ -296,8 +277,8 @@
w.computeFrameLw();
// For non fullscreen tasks the containing frame is based off the
// task bounds not the parent frame.
- assertFrame(w, taskLeft, taskTop, taskRight, taskBottom);
- assertContentFrame(w, taskBounds);
+ assertEquals(resolvedTaskBounds, w.getFrameLw());
+ assertContentFrame(w, resolvedTaskBounds);
assertContentInset(w, 0, 0, 0, 0);
pf.set(0, 0, logicalWidth, logicalHeight);
@@ -307,36 +288,38 @@
final Rect cf = new Rect(0, 0, cfRight, cfBottom);
windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect);
w.computeFrameLw();
- assertFrame(w, taskLeft, taskTop, taskRight, taskBottom);
- int contentInsetRight = taskRight - cfRight;
- int contentInsetBottom = taskBottom - cfBottom;
+ assertEquals(resolvedTaskBounds, w.getFrameLw());
+ int contentInsetRight = resolvedTaskBounds.right - cfRight;
+ int contentInsetBottom = resolvedTaskBounds.bottom - cfBottom;
assertContentInset(w, 0, 0, contentInsetRight, contentInsetBottom);
- assertContentFrame(w, new Rect(taskLeft, taskTop, taskRight - contentInsetRight,
- taskBottom - contentInsetBottom));
+ assertContentFrame(w, new Rect(resolvedTaskBounds.left, resolvedTaskBounds.top,
+ resolvedTaskBounds.right - contentInsetRight,
+ resolvedTaskBounds.bottom - contentInsetBottom));
pf.set(0, 0, logicalWidth, logicalHeight);
// If we set displayed bounds, the insets will be computed with the main task bounds
// but the frame will be positioned according to the displayed bounds.
final int insetLeft = logicalWidth / 5;
final int insetTop = logicalHeight / 5;
- final int insetRight = insetLeft + (taskRight - taskLeft);
- final int insetBottom = insetTop + (taskBottom - taskTop);
- task.setOverrideDisplayedBounds(taskBounds);
- task.setBounds(insetLeft, insetTop, insetRight, insetBottom);
+ final int insetRight = insetLeft + (resolvedTaskBounds.right - resolvedTaskBounds.left);
+ final int insetBottom = insetTop + (resolvedTaskBounds.bottom - resolvedTaskBounds.top);
+ task.mTaskRecord.setDisplayedBounds(resolvedTaskBounds);
+ task.mTaskRecord.setBounds(insetLeft, insetTop, insetRight, insetBottom);
windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect);
w.computeFrameLw();
- assertFrame(w, taskLeft, taskTop, taskRight, taskBottom);
+ assertEquals(resolvedTaskBounds, w.getFrameLw());
contentInsetRight = insetRight - cfRight;
contentInsetBottom = insetBottom - cfBottom;
assertContentInset(w, 0, 0, contentInsetRight, contentInsetBottom);
- assertContentFrame(w, new Rect(taskLeft, taskTop, taskRight - contentInsetRight,
- taskBottom - contentInsetBottom));
+ assertContentFrame(w, new Rect(resolvedTaskBounds.left, resolvedTaskBounds.top,
+ resolvedTaskBounds.right - contentInsetRight,
+ resolvedTaskBounds.bottom - contentInsetBottom));
}
@Test
@FlakyTest(bugId = 130388666)
public void testCalculatePolicyCrop() {
- final FrameTestWindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ final WindowState w = createWindow();
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
final DisplayInfo displayInfo = w.getDisplayContent().getDisplayInfo();
@@ -381,7 +364,7 @@
// to the computed window frame.
assertPolicyCrop(w, 0, 0, logicalWidth / 2, logicalHeight / 2);
- w.mDockedResizingForTest = true;
+ doReturn(true).when(w).isDockedResizing();
// But if we are docked resizing it won't be, however we will still be
// shrunk to the decor frame and the display.
assertPolicyCrop(w, 0, 0,
@@ -402,7 +385,7 @@
final int taskRight = logicalWidth / 4 * 3;
final int taskBottom = logicalHeight / 4 * 3;
final Rect taskBounds = new Rect(taskLeft, taskTop, taskRight, taskBottom);
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ WindowState w = createWindow();
final Task task = w.getTask();
// Use split-screen because it is non-fullscreen, but also not floating
task.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
@@ -440,7 +423,7 @@
@FlakyTest(bugId = 130388666)
public void testDisplayCutout() {
// Regular fullscreen task and window
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ WindowState w = createWindow();
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
final Rect pf = new Rect(0, 0, 1000, 2000);
@@ -464,7 +447,7 @@
@FlakyTest(bugId = 130388666)
public void testDisplayCutout_tempDisplayedBounds() {
// Regular fullscreen task and window
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ WindowState w = createWindow();
final Task task = w.getTask();
task.setBounds(new Rect(0, 0, 1000, 2000));
task.setOverrideDisplayedBounds(new Rect(0, -500, 1000, 1500));
@@ -489,11 +472,12 @@
@Test
public void testFreeformContentInsets() {
+ removeGlobalMinSizeRestriction();
// fullscreen task doesn't use bounds for computeFrame
- WindowState w = createWindow(MATCH_PARENT, MATCH_PARENT);
+ WindowState w = createWindow();
final Task task = w.getTask();
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
- task.setWindowingMode(WINDOWING_MODE_FREEFORM);
+ task.mTaskRecord.setWindowingMode(WINDOWING_MODE_FREEFORM);
DisplayContent dc = mTestDisplayContent;
dc.mInputMethodTarget = w;
@@ -515,7 +499,7 @@
// First check that it only gets moved up enough to show window.
final Rect winRect = new Rect(200, 200, 300, 500);
- task.setBounds(winRect);
+ task.mTaskRecord.setBounds(winRect);
w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect);
w.computeFrameLw();
@@ -527,7 +511,7 @@
// Now check that it won't get moved beyond the top and then has appropriate insets
winRect.bottom = 600;
- task.setBounds(winRect);
+ task.mTaskRecord.setBounds(winRect);
w.setBounds(winRect);
w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect);
w.computeFrameLw();
@@ -544,16 +528,9 @@
assertEquals(winRect, w.getFrameLw());
}
- private FrameTestWindowState createWindow(int width, int height) {
- final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(TYPE_APPLICATION);
- attrs.width = width;
- attrs.height = height;
-
- ActivityRecord activity = createActivityRecord(mTestDisplayContent,
- WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
-
- FrameTestWindowState ws = new FrameTestWindowState(mWm, mIWindow, activity, attrs);
- activity.addWindow(ws);
+ private WindowState createWindow() {
+ final WindowState ws = createWindow(null, TYPE_APPLICATION, mTestDisplayContent, "WindowFrameTests");
+ spyOn(ws);
return ws;
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerSettingsTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerSettingsTests.java
index 86f0f8b..1c9eed2 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerSettingsTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerSettingsTests.java
@@ -17,6 +17,7 @@
package com.android.server.wm;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
+import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
@@ -77,6 +78,20 @@
}
}
+ @Test
+ public void testEnableSizeCompatFreeform() {
+ try (SettingsSession enableSizeCompatFreeformSession = new
+ SettingsSession(DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM)) {
+ final boolean enableSizeCompatFreeform =
+ !enableSizeCompatFreeformSession.getSetting();
+ final Uri enableSizeCompatFreeformUri =
+ enableSizeCompatFreeformSession.setSetting(enableSizeCompatFreeform);
+ mWm.mSettingsObserver.onChange(false, enableSizeCompatFreeformUri);
+
+ assertEquals(mWm.mAtmService.mSizeCompatFreeform, enableSizeCompatFreeform);
+ }
+ }
+
private class SettingsSession implements AutoCloseable {
private static final int SETTING_VALUE_OFF = 0;
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
index 4fbf820..51daf65 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
@@ -33,16 +33,16 @@
* A collection of static functions that provide access to WindowManager related test functionality.
*/
class WindowTestUtils {
- private static int sNextTaskId = 0;
/** Creates a {@link Task} and adds it to the specified {@link TaskStack}. */
- static Task createTaskInStack(WindowManagerService service, TaskStack stack,
- int userId) {
+ static Task createTaskInStack(WindowManagerService service, TaskStack stack, int userId) {
synchronized (service.mGlobalLock) {
- final Task newTask = new Task(sNextTaskId++, stack, userId, service, 0, false,
- new ActivityManager.TaskDescription(), null);
- stack.addTask(newTask, POSITION_TOP);
- return newTask;
+ final TaskRecord task = new ActivityTestsBase.TaskBuilder(
+ stack.mActivityStack.mStackSupervisor)
+ .setUserId(userId)
+ .setStack(stack.mActivityStack)
+ .build();
+ return task.mTask;
}
}
@@ -53,17 +53,33 @@
return activity;
}
+ static ActivityRecord createTestActivityRecord(ActivityStack stack) {
+ synchronized (stack.mService.mGlobalLock) {
+ final ActivityRecord activity = new ActivityTestsBase.ActivityBuilder(
+ stack.mService)
+ .setStack(stack)
+ .setCreateTask(true)
+ .build();
+ postCreateActivitySetup(activity, stack.mTaskStack.getDisplayContent());
+ return activity;
+ }
+ }
+
static ActivityRecord createTestActivityRecord(DisplayContent dc) {
synchronized (dc.mWmService.mGlobalLock) {
final ActivityRecord activity = new ActivityBuilder(dc.mWmService.mAtmService).build();
- activity.onDisplayChanged(dc);
- activity.setOccludesParent(true);
- activity.setHidden(false);
- activity.hiddenRequested = false;
+ postCreateActivitySetup(activity, dc);
return activity;
}
}
+ private static void postCreateActivitySetup(ActivityRecord activity, DisplayContent dc) {
+ activity.onDisplayChanged(dc);
+ activity.setOccludesParent(true);
+ activity.setHidden(false);
+ activity.hiddenRequested = false;
+ }
+
static TestWindowToken createTestWindowToken(int type, DisplayContent dc) {
return createTestWindowToken(type, dc, false /* persistOnEmpty */);
}
@@ -92,49 +108,6 @@
}
}
- /* Used so we can gain access to some protected members of the {@link Task} class */
- static class TestTask extends Task {
- boolean mShouldDeferRemoval = false;
- boolean mOnDisplayChangedCalled = false;
- private boolean mIsAnimating = false;
-
- TestTask(int taskId, TaskStack stack, int userId, WindowManagerService service,
- int resizeMode, boolean supportsPictureInPicture,
- TaskRecord taskRecord) {
- super(taskId, stack, userId, service, resizeMode, supportsPictureInPicture,
- new ActivityManager.TaskDescription(), taskRecord);
- stack.addTask(this, POSITION_TOP);
- }
-
- boolean shouldDeferRemoval() {
- return mShouldDeferRemoval;
- }
-
- int positionInParent() {
- return getParent().mChildren.indexOf(this);
- }
-
- @Override
- void onDisplayChanged(DisplayContent dc) {
- super.onDisplayChanged(dc);
- mOnDisplayChangedCalled = true;
- }
-
- @Override
- boolean isSelfAnimating() {
- return mIsAnimating;
- }
-
- void setLocalIsAnimating(boolean isAnimating) {
- mIsAnimating = isAnimating;
- }
- }
-
- static TestTask createTestTask(TaskStack stack) {
- return new TestTask(sNextTaskId++, stack, 0, stack.mWmService, RESIZE_MODE_UNRESIZEABLE,
- false, mock(TaskRecord.class));
- }
-
/** Used to track resize reports. */
static class TestWindowState extends WindowState {
boolean mResizeReported;
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index af9c510..780fed9 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -211,11 +211,7 @@
ActivityRecord createTestActivityRecord(DisplayContent dc, int
windowingMode, int activityType) {
final TaskStack stack = createTaskStackOnDisplay(windowingMode, activityType, dc);
- final Task task = createTaskInStack(stack, 0 /* userId */);
- final ActivityRecord activity =
- WindowTestUtils.createTestActivityRecord(dc);
- task.addChild(activity, 0);
- return activity;
+ return WindowTestUtils.createTestActivityRecord(stack.mActivityStack);
}
WindowState createWindow(WindowState parent, int type, String name) {
@@ -327,14 +323,14 @@
TaskStack createTaskStackOnDisplay(int windowingMode, int activityType, DisplayContent dc) {
synchronized (mWm.mGlobalLock) {
- final Configuration overrideConfig = new Configuration();
- overrideConfig.windowConfiguration.setWindowingMode(windowingMode);
- overrideConfig.windowConfiguration.setActivityType(activityType);
- final int stackId = ++sNextStackId;
- final TaskStack stack = new TaskStack(mWm, stackId, mock(ActivityStack.class));
- dc.setStackOnDisplay(stackId, true, stack);
- stack.onRequestedOverrideConfigurationChanged(overrideConfig);
- return stack;
+ final ActivityStack stack = new ActivityTestsBase.StackBuilder(
+ dc.mWmService.mAtmService.mRootActivityContainer)
+ .setDisplay(dc.mActivityDisplay)
+ .setWindowingMode(windowingMode)
+ .setActivityType(activityType)
+ .setCreateActivity(false)
+ .build();
+ return stack.mTaskStack;
}
}
@@ -386,4 +382,9 @@
displayInfo.ownerUid = SYSTEM_UID;
return createNewDisplay(displayInfo);
}
+
+ /** Sets the default minimum task size to 1 so that tests can use small task sizes */
+ public void removeGlobalMinSizeRestriction() {
+ mWm.mAtmService.mRootActivityContainer.mDefaultMinSizeOfResizeableTaskDp = 1;
+ }
}
diff --git a/services/usage/java/com/android/server/usage/TEST_MAPPING b/services/usage/java/com/android/server/usage/TEST_MAPPING
new file mode 100644
index 0000000..7b53d09
--- /dev/null
+++ b/services/usage/java/com/android/server/usage/TEST_MAPPING
@@ -0,0 +1,33 @@
+{
+ "presubmit": [
+ {
+ "name": "FrameworksCoreTests",
+ "options": [
+ {
+ "include-filter": "android.app.usage"
+ }
+ ]
+ },
+ {
+ "name": "FrameworksServicesTests",
+ "options": [
+ {
+ "include-filter": "com.android.server.usage"
+ },
+ {
+ "exclude-filter": "com.android.server.usage.StorageStatsServiceTest"
+ }
+ ]
+ }
+ ],
+ "postsubmit": [
+ {
+ "name": "CtsUsageStatsTestCases",
+ "options": [
+ {
+ "include-filter": "android.app.usage.cts.UsageStatsTest"
+ }
+ ]
+ }
+ ]
+}
diff --git a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
index db7ed1f..27d7360 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
@@ -373,7 +373,12 @@
Slog.e(TAG, "Failed read version upgrade breadcrumb");
throw new RuntimeException(e);
}
- continueUpgradeLocked(previousVersion, token);
+ if (mCurrentVersion >= 4) {
+ continueUpgradeLocked(previousVersion, token);
+ } else {
+ Slog.wtf(TAG, "Attempting to upgrade to an unsupported version: "
+ + mCurrentVersion);
+ }
}
if (version != mCurrentVersion || mNewUpdate) {
@@ -487,6 +492,9 @@
}
private void continueUpgradeLocked(int version, long token) {
+ if (version <= 3) {
+ Slog.w(TAG, "Reading UsageStats as XML; current database version: " + mCurrentVersion);
+ }
final File backupDir = new File(mBackupsDir, Long.toString(token));
// Upgrade step logic for the entire usage stats directory, not individual interval dirs.
@@ -876,6 +884,10 @@
}
private void writeLocked(AtomicFile file, IntervalStats stats) throws IOException {
+ if (mCurrentVersion <= 3) {
+ Slog.wtf(TAG, "Attempting to write UsageStats as XML with version " + mCurrentVersion);
+ return;
+ }
writeLocked(file, stats, mCurrentVersion, mPackagesTokenData);
}
@@ -892,17 +904,13 @@
}
}
- private void writeLocked(OutputStream out, IntervalStats stats) throws IOException {
- writeLocked(out, stats, mCurrentVersion, mPackagesTokenData);
- }
-
private static void writeLocked(OutputStream out, IntervalStats stats, int version,
PackagesTokenData packagesTokenData) throws IOException {
switch (version) {
case 1:
case 2:
case 3:
- UsageStatsXml.write(out, stats);
+ Slog.wtf(TAG, "Attempting to write UsageStats as XML with version " + version);
break;
case 4:
try {
@@ -927,6 +935,10 @@
}
private void readLocked(AtomicFile file, IntervalStats statsOut) throws IOException {
+ if (mCurrentVersion <= 3) {
+ Slog.wtf(TAG, "Reading UsageStats as XML; current database version: "
+ + mCurrentVersion);
+ }
readLocked(file, statsOut, mCurrentVersion, mPackagesTokenData);
}
@@ -951,17 +963,18 @@
}
}
- private void readLocked(InputStream in, IntervalStats statsOut) throws IOException {
- readLocked(in, statsOut, mCurrentVersion, mPackagesTokenData);
- }
-
private static void readLocked(InputStream in, IntervalStats statsOut, int version,
PackagesTokenData packagesTokenData) throws IOException {
switch (version) {
case 1:
case 2:
case 3:
- UsageStatsXml.read(in, statsOut);
+ Slog.w(TAG, "Reading UsageStats as XML; database version: " + version);
+ try {
+ UsageStatsXml.read(in, statsOut);
+ } catch (Exception e) {
+ Slog.e(TAG, "Unable to read interval stats from XML", e);
+ }
break;
case 4:
try {
@@ -1076,6 +1089,10 @@
*/
@VisibleForTesting
public byte[] getBackupPayload(String key, int version) {
+ if (version >= 1 && version <= 3) {
+ Slog.wtf(TAG, "Attempting to backup UsageStats as XML with version " + version);
+ return null;
+ }
synchronized (mLock) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (KEY_USAGE_STATS.equals(key)) {
diff --git a/services/usage/java/com/android/server/usage/UsageStatsProto.java b/services/usage/java/com/android/server/usage/UsageStatsProto.java
index 5d1f730..87e077e 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsProto.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsProto.java
@@ -334,8 +334,6 @@
proto.write(IntervalStatsProto.UsageStats.PACKAGE_INDEX, packageIndex + 1);
} else {
// Package not in Stringpool for some reason, write full string instead
- Slog.w(TAG, "UsageStats package name (" + usageStats.mPackageName
- + ") not found in IntervalStats string cache");
proto.write(IntervalStatsProto.UsageStats.PACKAGE, usageStats.mPackageName);
}
// Time attributes stored as an offset of the beginTime.
@@ -430,8 +428,6 @@
proto.write(IntervalStatsProto.Event.PACKAGE_INDEX, packageIndex + 1);
} else {
// Package not in Stringpool for some reason, write full string instead
- Slog.w(TAG, "Usage event package name (" + event.mPackage
- + ") not found in IntervalStats string cache");
proto.write(IntervalStatsProto.Event.PACKAGE, event.mPackage);
}
if (event.mClass != null) {
@@ -440,8 +436,6 @@
proto.write(IntervalStatsProto.Event.CLASS_INDEX, classIndex + 1);
} else {
// Class not in Stringpool for some reason, write full string instead
- Slog.w(TAG, "Usage event class name (" + event.mClass
- + ") not found in IntervalStats string cache");
proto.write(IntervalStatsProto.Event.CLASS, event.mClass);
}
}
@@ -454,10 +448,6 @@
if (taskRootPackageIndex >= 0) {
proto.write(IntervalStatsProto.Event.TASK_ROOT_PACKAGE_INDEX,
taskRootPackageIndex + 1);
- } else {
- // Task root package not in Stringpool for some reason.
- Slog.w(TAG, "Usage event task root package name (" + event.mTaskRootPackage
- + ") not found in IntervalStats string cache");
}
}
if (event.mTaskRootClass != null) {
@@ -465,10 +455,6 @@
if (taskRootClassIndex >= 0) {
proto.write(IntervalStatsProto.Event.TASK_ROOT_CLASS_INDEX,
taskRootClassIndex + 1);
- } else {
- // Task root class not in Stringpool for some reason.
- Slog.w(TAG, "Usage event task root class name (" + event.mTaskRootClass
- + ") not found in IntervalStats string cache");
}
}
switch (event.mEventType) {
@@ -496,9 +482,6 @@
channelIndex + 1);
} else {
// Channel not in Stringpool for some reason, write full string instead
- Slog.w(TAG, "Usage event notification channel name ("
- + event.mNotificationChannelId
- + ") not found in IntervalStats string cache");
proto.write(IntervalStatsProto.Event.NOTIFICATION_CHANNEL,
event.mNotificationChannelId);
}
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 5d03e151..6a80568 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -86,6 +86,7 @@
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.LocalServices;
import com.android.server.SystemService;
+import com.android.server.usage.AppStandbyInternal.AppIdleStateChangeListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -180,8 +181,8 @@
}
}
- private UsageStatsManagerInternal.AppIdleStateChangeListener mStandbyChangeListener =
- new UsageStatsManagerInternal.AppIdleStateChangeListener() {
+ private AppIdleStateChangeListener mStandbyChangeListener =
+ new AppIdleStateChangeListener() {
@Override
public void onAppIdleStateChanged(String packageName, int userId, boolean idle,
int bucket, int reason) {
@@ -253,6 +254,7 @@
null, mHandler);
publishLocalService(UsageStatsManagerInternal.class, new LocalService());
+ publishLocalService(AppStandbyInternal.class, mAppStandby);
publishBinderService(Context.USAGE_STATS_SERVICE, new BinderService());
}
@@ -2029,17 +2031,6 @@
}
@Override
- public void addAppIdleStateChangeListener(AppIdleStateChangeListener listener) {
- mAppStandby.addListener(listener);
- }
-
- @Override
- public void removeAppIdleStateChangeListener(
- AppIdleStateChangeListener listener) {
- mAppStandby.removeListener(listener);
- }
-
- @Override
public byte[] getBackupPayload(int user, String key) {
synchronized (mLock) {
if (!mUserUnlockedStates.get(user)) {
diff --git a/services/usage/java/com/android/server/usage/UsageStatsXml.java b/services/usage/java/com/android/server/usage/UsageStatsXml.java
index f8d1113..3100310 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsXml.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsXml.java
@@ -16,14 +16,11 @@
package com.android.server.usage;
-import android.util.AtomicFile;
import android.util.Slog;
import android.util.Xml;
-import android.util.proto.ProtoInputStream;
-import android.util.proto.ProtoOutputStream;
-import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.XmlUtils;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -31,7 +28,6 @@
public class UsageStatsXml {
private static final String TAG = "UsageStatsXml";
- private static final int CURRENT_VERSION = 1;
private static final String USAGESTATS_TAG = "usagestats";
private static final String VERSION_ATTR = "version";
static final String CHECKED_IN_SUFFIX = "-c";
@@ -61,18 +57,4 @@
throw new IOException(e);
}
}
-
- public static void write(OutputStream out, IntervalStats stats) throws IOException {
- FastXmlSerializer xml = new FastXmlSerializer();
- xml.setOutput(out, "utf-8");
- xml.startDocument("utf-8", true);
- xml.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
- xml.startTag(null, USAGESTATS_TAG);
- xml.attribute(null, VERSION_ATTR, Integer.toString(CURRENT_VERSION));
-
- UsageStatsXmlV1.write(xml, stats);
-
- xml.endTag(null, USAGESTATS_TAG);
- xml.endDocument();
- }
}
\ No newline at end of file
diff --git a/services/usage/java/com/android/server/usage/UsageStatsXmlV1.java b/services/usage/java/com/android/server/usage/UsageStatsXmlV1.java
index 565ca9e..2598739 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsXmlV1.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsXmlV1.java
@@ -26,7 +26,6 @@
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.net.ProtocolException;
@@ -243,135 +242,6 @@
statsOut.addEvent(event);
}
- private static void writeUsageStats(XmlSerializer xml, final IntervalStats stats,
- final UsageStats usageStats) throws IOException {
- xml.startTag(null, PACKAGE_TAG);
-
- // Write the time offset.
- XmlUtils.writeLongAttribute(xml, LAST_TIME_ACTIVE_ATTR,
- usageStats.mLastTimeUsed - stats.beginTime);
- XmlUtils.writeLongAttribute(xml, LAST_TIME_VISIBLE_ATTR,
- usageStats.mLastTimeVisible - stats.beginTime);
- XmlUtils.writeLongAttribute(xml, LAST_TIME_SERVICE_USED_ATTR,
- usageStats.mLastTimeForegroundServiceUsed - stats.beginTime);
- XmlUtils.writeStringAttribute(xml, PACKAGE_ATTR, usageStats.mPackageName);
- XmlUtils.writeLongAttribute(xml, TOTAL_TIME_ACTIVE_ATTR, usageStats.mTotalTimeInForeground);
- XmlUtils.writeLongAttribute(xml, TOTAL_TIME_VISIBLE_ATTR, usageStats.mTotalTimeVisible);
- XmlUtils.writeLongAttribute(xml, TOTAL_TIME_SERVICE_USED_ATTR,
- usageStats.mTotalTimeForegroundServiceUsed);
- XmlUtils.writeIntAttribute(xml, LAST_EVENT_ATTR, usageStats.mLastEvent);
- if (usageStats.mAppLaunchCount > 0) {
- XmlUtils.writeIntAttribute(xml, APP_LAUNCH_COUNT_ATTR, usageStats.mAppLaunchCount);
- }
- writeChooserCounts(xml, usageStats);
- xml.endTag(null, PACKAGE_TAG);
- }
-
- private static void writeCountAndTime(XmlSerializer xml, String tag, int count, long time)
- throws IOException {
- xml.startTag(null, tag);
- XmlUtils.writeIntAttribute(xml, COUNT_ATTR, count);
- XmlUtils.writeLongAttribute(xml, TIME_ATTR, time);
- xml.endTag(null, tag);
- }
-
- private static void writeChooserCounts(XmlSerializer xml, final UsageStats usageStats)
- throws IOException {
- if (usageStats == null || usageStats.mChooserCounts == null ||
- usageStats.mChooserCounts.keySet().isEmpty()) {
- return;
- }
- final int chooserCountSize = usageStats.mChooserCounts.size();
- for (int i = 0; i < chooserCountSize; i++) {
- final String action = usageStats.mChooserCounts.keyAt(i);
- final ArrayMap<String, Integer> counts = usageStats.mChooserCounts.valueAt(i);
- if (action == null || counts == null || counts.isEmpty()) {
- continue;
- }
- xml.startTag(null, CHOOSER_COUNT_TAG);
- XmlUtils.writeStringAttribute(xml, NAME, action);
- writeCountsForAction(xml, counts);
- xml.endTag(null, CHOOSER_COUNT_TAG);
- }
- }
-
- private static void writeCountsForAction(XmlSerializer xml, ArrayMap<String, Integer> counts)
- throws IOException {
- final int countsSize = counts.size();
- for (int i = 0; i < countsSize; i++) {
- String key = counts.keyAt(i);
- int count = counts.valueAt(i);
- if (count > 0) {
- xml.startTag(null, CATEGORY_TAG);
- XmlUtils.writeStringAttribute(xml, NAME, key);
- XmlUtils.writeIntAttribute(xml, COUNT, count);
- xml.endTag(null, CATEGORY_TAG);
- }
- }
- }
-
- private static void writeConfigStats(XmlSerializer xml, final IntervalStats stats,
- final ConfigurationStats configStats, boolean isActive) throws IOException {
- xml.startTag(null, CONFIG_TAG);
-
- // Write the time offset.
- XmlUtils.writeLongAttribute(xml, LAST_TIME_ACTIVE_ATTR,
- configStats.mLastTimeActive - stats.beginTime);
-
- XmlUtils.writeLongAttribute(xml, TOTAL_TIME_ACTIVE_ATTR, configStats.mTotalTimeActive);
- XmlUtils.writeIntAttribute(xml, COUNT_ATTR, configStats.mActivationCount);
- if (isActive) {
- XmlUtils.writeBooleanAttribute(xml, ACTIVE_ATTR, true);
- }
-
- // Now write the attributes representing the configuration object.
- Configuration.writeXmlAttrs(xml, configStats.mConfiguration);
-
- xml.endTag(null, CONFIG_TAG);
- }
-
- private static void writeEvent(XmlSerializer xml, final IntervalStats stats,
- final UsageEvents.Event event) throws IOException {
- xml.startTag(null, EVENT_TAG);
-
- // Store the time offset.
- XmlUtils.writeLongAttribute(xml, TIME_ATTR, event.mTimeStamp - stats.beginTime);
-
- XmlUtils.writeStringAttribute(xml, PACKAGE_ATTR, event.mPackage);
- if (event.mClass != null) {
- XmlUtils.writeStringAttribute(xml, CLASS_ATTR, event.mClass);
- }
- XmlUtils.writeIntAttribute(xml, FLAGS_ATTR, event.mFlags);
- XmlUtils.writeIntAttribute(xml, TYPE_ATTR, event.mEventType);
- XmlUtils.writeIntAttribute(xml, INSTANCE_ID_ATTR, event.mInstanceId);
-
- switch (event.mEventType) {
- case UsageEvents.Event.CONFIGURATION_CHANGE:
- if (event.mConfiguration != null) {
- Configuration.writeXmlAttrs(xml, event.mConfiguration);
- }
- break;
- case UsageEvents.Event.SHORTCUT_INVOCATION:
- if (event.mShortcutId != null) {
- XmlUtils.writeStringAttribute(xml, SHORTCUT_ID_ATTR, event.mShortcutId);
- }
- break;
- case UsageEvents.Event.STANDBY_BUCKET_CHANGED:
- if (event.mBucketAndReason != 0) {
- XmlUtils.writeIntAttribute(xml, STANDBY_BUCKET_ATTR, event.mBucketAndReason);
- }
- break;
- case UsageEvents.Event.NOTIFICATION_INTERRUPTION:
- if (event.mNotificationChannelId != null) {
- XmlUtils.writeStringAttribute(
- xml, NOTIFICATION_CHANNEL_ATTR, event.mNotificationChannelId);
- }
- break;
- }
-
- xml.endTag(null, EVENT_TAG);
- }
-
/**
* Reads from the {@link XmlPullParser}, assuming that it is already on the
* <code><usagestats></code> tag.
@@ -440,51 +310,6 @@
}
}
- /**
- * Writes the stats object to an XML file. The {@link XmlSerializer}
- * has already written the <code><usagestats></code> tag, but attributes may still
- * be added.
- *
- * @param xml The serializer to which to write the packageStats data.
- * @param stats The stats object to write to the XML file.
- */
- public static void write(XmlSerializer xml, IntervalStats stats) throws IOException {
- XmlUtils.writeLongAttribute(xml, END_TIME_ATTR, stats.endTime - stats.beginTime);
- XmlUtils.writeIntAttribute(xml, MAJOR_VERSION_ATTR, stats.majorVersion);
- XmlUtils.writeIntAttribute(xml, MINOR_VERSION_ATTR, stats.minorVersion);
-
- writeCountAndTime(xml, INTERACTIVE_TAG, stats.interactiveTracker.count,
- stats.interactiveTracker.duration);
- writeCountAndTime(xml, NON_INTERACTIVE_TAG, stats.nonInteractiveTracker.count,
- stats.nonInteractiveTracker.duration);
- writeCountAndTime(xml, KEYGUARD_SHOWN_TAG, stats.keyguardShownTracker.count,
- stats.keyguardShownTracker.duration);
- writeCountAndTime(xml, KEYGUARD_HIDDEN_TAG, stats.keyguardHiddenTracker.count,
- stats.keyguardHiddenTracker.duration);
-
- xml.startTag(null, PACKAGES_TAG);
- final int statsCount = stats.packageStats.size();
- for (int i = 0; i < statsCount; i++) {
- writeUsageStats(xml, stats, stats.packageStats.valueAt(i));
- }
- xml.endTag(null, PACKAGES_TAG);
-
- xml.startTag(null, CONFIGURATIONS_TAG);
- final int configCount = stats.configurations.size();
- for (int i = 0; i < configCount; i++) {
- boolean active = stats.activeConfiguration.equals(stats.configurations.keyAt(i));
- writeConfigStats(xml, stats, stats.configurations.valueAt(i), active);
- }
- xml.endTag(null, CONFIGURATIONS_TAG);
-
- xml.startTag(null, EVENT_LOG_TAG);
- final int eventCount = stats.events.size();
- for (int i = 0; i < eventCount; i++) {
- writeEvent(xml, stats, stats.events.get(i));
- }
- xml.endTag(null, EVENT_LOG_TAG);
- }
-
private UsageStatsXmlV1() {
}
}
diff --git a/services/usage/java/com/android/server/usage/UserUsageStatsService.java b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
index 23df1c5..5783932 100644
--- a/services/usage/java/com/android/server/usage/UserUsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
@@ -146,17 +146,16 @@
}
// During system reboot, add a DEVICE_SHUTDOWN event to the end of event list, the timestamp
- // is last time UsageStatsDatabase is persisted to disk.
+ // is last time UsageStatsDatabase is persisted to disk or the last event's time whichever
+ // is higher (because the file system timestamp is round down to integral seconds).
// Also add a DEVICE_STARTUP event with current system timestamp.
final IntervalStats currentDailyStats = mCurrentStats[INTERVAL_DAILY];
if (currentDailyStats != null) {
- // File system timestamp only has precision of 1 second, add 1000ms to make up
- // for the loss of round up.
- final Event shutdownEvent =
- new Event(DEVICE_SHUTDOWN, currentDailyStats.lastTimeSaved + 1000);
+ final Event shutdownEvent = new Event(DEVICE_SHUTDOWN,
+ Math.max(currentDailyStats.lastTimeSaved, currentDailyStats.endTime));
shutdownEvent.mPackage = Event.DEVICE_EVENT_PACKAGE_NAME;
currentDailyStats.addEvent(shutdownEvent);
- final Event startupEvent = new Event(DEVICE_STARTUP, currentTimeMillis);
+ final Event startupEvent = new Event(DEVICE_STARTUP, System.currentTimeMillis());
startupEvent.mPackage = Event.DEVICE_EVENT_PACKAGE_NAME;
currentDailyStats.addEvent(startupEvent);
}
diff --git a/services/usb/java/com/android/server/usb/UsbPermissionManager.java b/services/usb/java/com/android/server/usb/UsbPermissionManager.java
index ef9ee73..1e46f98 100644
--- a/services/usb/java/com/android/server/usb/UsbPermissionManager.java
+++ b/services/usb/java/com/android/server/usb/UsbPermissionManager.java
@@ -20,14 +20,20 @@
import android.annotation.UserIdInt;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.UserInfo;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.UserHandle;
+import android.os.UserManager;
+import android.service.usb.UsbSettingsManagerProto;
import android.util.Slog;
import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.util.dump.DualDumpOutputStream;
+
+import java.util.List;
class UsbPermissionManager {
private static final String LOG_TAG = UsbPermissionManager.class.getSimpleName();
@@ -112,4 +118,18 @@
mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
}
+ void dump(@NonNull DualDumpOutputStream dump, String idName, long id) {
+ long token = dump.start(idName, id);
+ UserManager userManager = mContext.getSystemService(UserManager.class);
+ synchronized (mPermissionsByUser) {
+ List<UserInfo> users = userManager.getUsers();
+ int numUsers = users.size();
+ for (int i = 0; i < numUsers; i++) {
+ getPermissionsForUser(users.get(i).id).dump(dump, "user_permissions",
+ UsbSettingsManagerProto.USER_SETTINGS);
+ }
+ }
+ dump.end(token);
+ }
+
}
diff --git a/services/usb/java/com/android/server/usb/UsbService.java b/services/usb/java/com/android/server/usb/UsbService.java
index ce6f592..0493637 100644
--- a/services/usb/java/com/android/server/usb/UsbService.java
+++ b/services/usb/java/com/android/server/usb/UsbService.java
@@ -740,6 +740,8 @@
mSettingsManager.dump(dump, "settings_manager",
UsbServiceDumpProto.SETTINGS_MANAGER);
+ mPermissionManager.dump(dump, "permissions_manager",
+ UsbServiceDumpProto.PERMISSIONS_MANAGER);
dump.flush();
} else if ("set-port-roles".equals(args[0]) && args.length == 4) {
final String portId = args[1];
diff --git a/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java b/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java
index 0cb64a3..e700f19 100644
--- a/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java
+++ b/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java
@@ -36,9 +36,12 @@
import android.os.Environment;
import android.os.Process;
import android.os.UserHandle;
-import android.service.usb.UsbSettingsAccessoryPermissionProto;
-import android.service.usb.UsbSettingsDevicePermissionProto;
-import android.service.usb.UsbUserSettingsManagerProto;
+import android.service.usb.UsbAccessoryPermissionProto;
+import android.service.usb.UsbAccessoryPersistentPermissionProto;
+import android.service.usb.UsbDevicePermissionProto;
+import android.service.usb.UsbDevicePersistentPermissionProto;
+import android.service.usb.UsbUidPermissionProto;
+import android.service.usb.UsbUserPermissionsManagerProto;
import android.util.ArrayMap;
import android.util.AtomicFile;
import android.util.Slog;
@@ -261,7 +264,7 @@
}
if (isChanged) {
- scheduleWritePermissionLocked();
+ scheduleWritePermissionsLocked();
}
}
}
@@ -288,7 +291,7 @@
}
if (isChanged) {
- scheduleWritePermissionLocked();
+ scheduleWritePermissionsLocked();
}
}
}
@@ -370,7 +373,7 @@
}
@GuardedBy("mLock")
- private void scheduleWritePermissionLocked() {
+ private void scheduleWritePermissionsLocked() {
if (mIsCopyPermissionsScheduled) {
return;
}
@@ -393,15 +396,18 @@
devices = new DeviceFilter[numDevices];
uidsForDevices = new int[numDevices][];
grantedValuesForDevices = new boolean[numDevices][];
- for (int i = 0; i < numDevices; i++) {
- devices[i] = new DeviceFilter(mDevicePersistentPermissionMap.keyAt(i));
- SparseBooleanArray permissions = mDevicePersistentPermissionMap.valueAt(i);
+ for (int deviceIdx = 0; deviceIdx < numDevices; deviceIdx++) {
+ devices[deviceIdx] =
+ new DeviceFilter(mDevicePersistentPermissionMap.keyAt(deviceIdx));
+ SparseBooleanArray permissions =
+ mDevicePersistentPermissionMap.valueAt(deviceIdx);
int numPermissions = permissions.size();
- uidsForDevices[i] = new int[numPermissions];
- grantedValuesForDevices[i] = new boolean[numPermissions];
- for (int j = 0; j < numPermissions; j++) {
- uidsForDevices[i][j] = permissions.keyAt(j);
- grantedValuesForDevices[i][j] = permissions.valueAt(j);
+ uidsForDevices[deviceIdx] = new int[numPermissions];
+ grantedValuesForDevices[deviceIdx] = new boolean[numPermissions];
+ for (int permissionIdx = 0; permissionIdx < numPermissions; permissionIdx++) {
+ uidsForDevices[deviceIdx][permissionIdx] = permissions.keyAt(permissionIdx);
+ grantedValuesForDevices[deviceIdx][permissionIdx] =
+ permissions.valueAt(permissionIdx);
}
}
@@ -409,16 +415,19 @@
accessories = new AccessoryFilter[numAccessories];
uidsForAccessories = new int[numAccessories][];
grantedValuesForAccessories = new boolean[numAccessories][];
- for (int i = 0; i < numAccessories; i++) {
- accessories[i] =
- new AccessoryFilter(mAccessoryPersistentPermissionMap.keyAt(i));
- SparseBooleanArray permissions = mAccessoryPersistentPermissionMap.valueAt(i);
+ for (int accessoryIdx = 0; accessoryIdx < numAccessories; accessoryIdx++) {
+ accessories[accessoryIdx] = new AccessoryFilter(
+ mAccessoryPersistentPermissionMap.keyAt(accessoryIdx));
+ SparseBooleanArray permissions =
+ mAccessoryPersistentPermissionMap.valueAt(accessoryIdx);
int numPermissions = permissions.size();
- uidsForAccessories[i] = new int[numPermissions];
- grantedValuesForAccessories[i] = new boolean[numPermissions];
- for (int j = 0; j < numPermissions; j++) {
- uidsForAccessories[i][j] = permissions.keyAt(j);
- grantedValuesForAccessories[i][j] = permissions.valueAt(j);
+ uidsForAccessories[accessoryIdx] = new int[numPermissions];
+ grantedValuesForAccessories[accessoryIdx] = new boolean[numPermissions];
+ for (int permissionIdx = 0; permissionIdx < numPermissions; permissionIdx++) {
+ uidsForAccessories[accessoryIdx][permissionIdx] =
+ permissions.keyAt(permissionIdx);
+ grantedValuesForAccessories[accessoryIdx][permissionIdx] =
+ permissions.valueAt(permissionIdx);
}
}
mIsCopyPermissionsScheduled = false;
@@ -477,22 +486,22 @@
* Creates UI dialog to request permission for the given package to access the device
* or accessory.
*
- * @param device The USB device attached
- * @param accessory The USB accessory attached
+ * @param device The USB device attached
+ * @param accessory The USB accessory attached
* @param canBeDefault Whether the calling pacakge can set as default handler
- * of the USB device or accessory
- * @param packageName The package name of the calling package
- * @param uid The uid of the calling package
- * @param userContext The context to start the UI dialog
- * @param pi PendingIntent for returning result
+ * of the USB device or accessory
+ * @param packageName The package name of the calling package
+ * @param uid The uid of the calling package
+ * @param userContext The context to start the UI dialog
+ * @param pi PendingIntent for returning result
*/
void requestPermissionDialog(@Nullable UsbDevice device,
- @Nullable UsbAccessory accessory,
- boolean canBeDefault,
- @NonNull String packageName,
- int uid,
- @NonNull Context userContext,
- @NonNull PendingIntent pi) {
+ @Nullable UsbAccessory accessory,
+ boolean canBeDefault,
+ @NonNull String packageName,
+ int uid,
+ @NonNull Context userContext,
+ @NonNull PendingIntent pi) {
long identity = Binder.clearCallingIdentity();
Intent intent = new Intent();
if (device != null) {
@@ -517,48 +526,96 @@
}
}
- void dump(@NonNull DualDumpOutputStream dump) {
+ void dump(@NonNull DualDumpOutputStream dump, String idName, long id) {
+ long token = dump.start(idName, id);
synchronized (mLock) {
- for (String deviceName : mDevicePermissionMap.keySet()) {
+ dump.write("user_id", UsbUserPermissionsManagerProto.USER_ID, mUser.getIdentifier());
+ int numMappings = mDevicePermissionMap.size();
+ for (int mappingsIdx = 0; mappingsIdx < numMappings; mappingsIdx++) {
+ String deviceName = mDevicePermissionMap.keyAt(mappingsIdx);
long devicePermissionToken = dump.start("device_permissions",
- UsbUserSettingsManagerProto.DEVICE_PERMISSIONS);
+ UsbUserPermissionsManagerProto.DEVICE_PERMISSIONS);
- dump.write("device_name", UsbSettingsDevicePermissionProto.DEVICE_NAME, deviceName);
+ dump.write("device_name", UsbDevicePermissionProto.DEVICE_NAME, deviceName);
- SparseBooleanArray uidList = mDevicePermissionMap.get(deviceName);
- int count = uidList.size();
- for (int i = 0; i < count; i++) {
- dump.write("uids", UsbSettingsDevicePermissionProto.UIDS, uidList.keyAt(i));
+ SparseBooleanArray uidList = mDevicePermissionMap.valueAt(mappingsIdx);
+ int numUids = uidList.size();
+ for (int uidsIdx = 0; uidsIdx < numUids; uidsIdx++) {
+ dump.write("uids", UsbDevicePermissionProto.UIDS, uidList.keyAt(uidsIdx));
}
dump.end(devicePermissionToken);
}
- for (UsbAccessory accessory : mAccessoryPermissionMap.keySet()) {
+ numMappings = mAccessoryPermissionMap.size();
+ for (int mappingsIdx = 0; mappingsIdx < numMappings; ++mappingsIdx) {
+ UsbAccessory accessory = mAccessoryPermissionMap.keyAt(mappingsIdx);
long accessoryPermissionToken = dump.start("accessory_permissions",
- UsbUserSettingsManagerProto.ACCESSORY_PERMISSIONS);
+ UsbUserPermissionsManagerProto.ACCESSORY_PERMISSIONS);
dump.write("accessory_description",
- UsbSettingsAccessoryPermissionProto.ACCESSORY_DESCRIPTION,
+ UsbAccessoryPermissionProto.ACCESSORY_DESCRIPTION,
accessory.getDescription());
- SparseBooleanArray uidList = mAccessoryPermissionMap.get(accessory);
- int count = uidList.size();
- for (int i = 0; i < count; i++) {
- dump.write("uids", UsbSettingsAccessoryPermissionProto.UIDS, uidList.keyAt(i));
+ SparseBooleanArray uidList = mAccessoryPermissionMap.valueAt(mappingsIdx);
+ int numUids = uidList.size();
+ for (int uidsIdx = 0; uidsIdx < numUids; uidsIdx++) {
+ dump.write("uids", UsbAccessoryPermissionProto.UIDS, uidList.keyAt(uidsIdx));
}
dump.end(accessoryPermissionToken);
}
+
+ numMappings = mDevicePersistentPermissionMap.size();
+ for (int mappingsIdx = 0; mappingsIdx < numMappings; mappingsIdx++) {
+ DeviceFilter filter = mDevicePersistentPermissionMap.keyAt(mappingsIdx);
+ long devicePermissionToken = dump.start("device_persistent_permissions",
+ UsbUserPermissionsManagerProto.DEVICE_PERSISTENT_PERMISSIONS);
+ filter.dump(dump, "device",
+ UsbDevicePersistentPermissionProto.DEVICE_FILTER);
+ SparseBooleanArray permissions =
+ mDevicePersistentPermissionMap.valueAt(mappingsIdx);
+ int numPermissions = permissions.size();
+ for (int permissionsIdx = 0; permissionsIdx < numPermissions; permissionsIdx++) {
+ long uidPermissionToken = dump.start("uid_permission",
+ UsbDevicePersistentPermissionProto.PERMISSION_VALUES);
+ dump.write("uid", UsbUidPermissionProto.UID, permissions.keyAt(permissionsIdx));
+ dump.write("is_granted",
+ UsbUidPermissionProto.IS_GRANTED, permissions.valueAt(permissionsIdx));
+ dump.end(uidPermissionToken);
+ }
+ dump.end(devicePermissionToken);
+ }
+
+ numMappings = mAccessoryPersistentPermissionMap.size();
+ for (int mappingsIdx = 0; mappingsIdx < numMappings; mappingsIdx++) {
+ AccessoryFilter filter = mAccessoryPersistentPermissionMap.keyAt(mappingsIdx);
+ long accessoryPermissionToken = dump.start("accessory_persistent_permissions",
+ UsbUserPermissionsManagerProto.ACCESSORY_PERSISTENT_PERMISSIONS);
+ filter.dump(dump, "accessory",
+ UsbAccessoryPersistentPermissionProto.ACCESSORY_FILTER);
+ SparseBooleanArray permissions =
+ mAccessoryPersistentPermissionMap.valueAt(mappingsIdx);
+ int numPermissions = permissions.size();
+ for (int permissionsIdx = 0; permissionsIdx < numPermissions; permissionsIdx++) {
+ long uidPermissionToken = dump.start("uid_permission",
+ UsbAccessoryPersistentPermissionProto.PERMISSION_VALUES);
+ dump.write("uid", UsbUidPermissionProto.UID, permissions.keyAt(permissionsIdx));
+ dump.write("is_granted",
+ UsbUidPermissionProto.IS_GRANTED, permissions.valueAt(permissionsIdx));
+ dump.end(uidPermissionToken);
+ }
+ dump.end(accessoryPermissionToken);
+ }
}
+ dump.end(token);
}
/**
* Check for camera permission of the calling process.
*
* @param packageName Package name of the caller.
- * @param uid Linux uid of the calling process.
- *
+ * @param uid Linux uid of the calling process.
* @return True in case camera permission is available, False otherwise.
*/
private boolean isCameraPermissionGranted(String packageName, int uid) {
@@ -677,7 +734,7 @@
*
* @param device The device that needs to get scanned
* @return True in case a VIDEO device or interface is present,
- * False otherwise.
+ * False otherwise.
*/
private boolean isCameraDevicePresent(UsbDevice device) {
if (device.getDeviceClass() == UsbConstants.USB_CLASS_VIDEO) {
diff --git a/startop/apps/test/Android.bp b/startop/apps/test/Android.bp
index 2ff26b8..3f20273 100644
--- a/startop/apps/test/Android.bp
+++ b/startop/apps/test/Android.bp
@@ -18,9 +18,12 @@
name: "startop_test_app",
srcs: [
"src/ComplexLayoutInflationActivity.java",
- "src/CPUIntensive.java",
+ "src/CPUIntensiveBenchmarkActivity.java",
+ "src/CPUIntensiveBenchmarks.java",
"src/EmptyActivity.java",
"src/FrameLayoutInflationActivity.java",
+ "src/InitCheckOverheadBenchmarkActivity.java",
+ "src/InitCheckOverheadBenchmarks.java",
"src/LayoutInflationActivity.java",
"src/NonInteractiveSystemServerBenchmarkActivity.java",
"src/SystemServerBenchmarkActivity.java",
diff --git a/startop/apps/test/AndroidManifest.xml b/startop/apps/test/AndroidManifest.xml
index ebe2584..235aa0d 100644
--- a/startop/apps/test/AndroidManifest.xml
+++ b/startop/apps/test/AndroidManifest.xml
@@ -37,6 +37,18 @@
</activity>
<activity
+ android:label="CPU Intensive Benchmark Test"
+ android:name=".CPUIntensiveBenchmarkActivity"
+ android:exported="true" >
+
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity
android:label="Empty Activity Layout Test"
android:name=".EmptyActivity"
android:exported="true" >
@@ -61,6 +73,18 @@
</activity>
<activity
+ android:label="Initialization Check Overhead Test"
+ android:name=".InitCheckOverheadBenchmarkActivity"
+ android:exported="true" >
+
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity
android:label="TextView Layout Test"
android:name=".TextViewInflationActivity"
android:exported="true" >
diff --git a/startop/apps/test/src/CPUIntensive.java b/startop/apps/test/src/CPUIntensive.java
deleted file mode 100644
index a411e8c..0000000
--- a/startop/apps/test/src/CPUIntensive.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * A threaded CPU intensive class for use in benchmarks.
- */
-
-package com.android.startop.test;
-
-final class CPUIntensive {
- public static final int THREAD_COUNT = 8;
- public static final int ARRAY_SIZE = 30000;
- public static int[][] array = new int[THREAD_COUNT][ARRAY_SIZE];
-
- static class WorkerThread extends Thread {
- int mThreadNumber;
- WorkerThread(int number) {
- mThreadNumber = number;
- }
- public void run() {
- final int arrayLength = array[mThreadNumber].length;
- for (int i = 0; i < arrayLength; ++i) {
- array[mThreadNumber][i] = i * i;
- }
- for (int i = 0; i < arrayLength; ++i) {
- for (int j = 0; j < arrayLength; ++j) {
- int swap = array[mThreadNumber][j];
- array[mThreadNumber][j] = array[mThreadNumber][(j + i) % arrayLength];
- array[mThreadNumber][(j + i) % arrayLength] = swap;
- }
- }
- }
- };
-
- public static void doSomeWork(int threadCount) {
- WorkerThread[] threads = new WorkerThread[threadCount];
- // Create the threads.
- for (int i = 0; i < threadCount; ++i) {
- threads[i] = new WorkerThread(i);
- }
- // Start the threads.
- for (int i = 0; i < threadCount; ++i) {
- threads[i].start();
- }
- // Join the threads.
- for (int i = 0; i < threadCount; ++i) {
- try {
- threads[i].join();
- } catch (Exception ex) {
- }
- }
- }
-}
-
diff --git a/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java b/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java
new file mode 100644
index 0000000..2ec5308
--- /dev/null
+++ b/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java
@@ -0,0 +1,30 @@
+/*
+ * 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.startop.test;
+
+import android.os.Bundle;
+
+public class CPUIntensiveBenchmarkActivity extends SystemServerBenchmarkActivity {
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.system_server_benchmark_page);
+
+ mBenchmarkList = findViewById(R.id.benchmark_list);
+
+ CPUIntensiveBenchmarks.initializeBenchmarks(this, this);
+ }
+}
diff --git a/startop/apps/test/src/CPUIntensiveBenchmarks.java b/startop/apps/test/src/CPUIntensiveBenchmarks.java
new file mode 100644
index 0000000..19d0b63
--- /dev/null
+++ b/startop/apps/test/src/CPUIntensiveBenchmarks.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+/**
+ * A threaded CPU intensive class for use in benchmarks.
+ */
+
+package com.android.startop.test;
+
+import android.app.Activity;
+
+public class CPUIntensiveBenchmarks {
+ public static final int ARRAY_SIZE = 30000;
+ public static int[][] mArray;
+
+ static class WorkerThread extends Thread {
+ int mThreadNumber;
+ WorkerThread(int number) {
+ mThreadNumber = number;
+ }
+ public void run() {
+ final int arrayLength = mArray[mThreadNumber].length;
+ for (int i = 0; i < arrayLength; ++i) {
+ mArray[mThreadNumber][i] = i * i;
+ }
+ for (int i = 0; i < arrayLength; ++i) {
+ for (int j = 0; j < arrayLength; ++j) {
+ int swap = mArray[mThreadNumber][j];
+ mArray[mThreadNumber][j] = mArray[mThreadNumber][(j + i) % arrayLength];
+ mArray[mThreadNumber][(j + i) % arrayLength] = swap;
+ }
+ }
+ }
+ };
+
+ static void doSomeWork(int threadCount) {
+ mArray = new int[threadCount][ARRAY_SIZE];
+ WorkerThread[] threads = new WorkerThread[threadCount];
+ // Create the threads.
+ for (int i = 0; i < threadCount; ++i) {
+ threads[i] = new WorkerThread(i);
+ }
+ // Start the threads.
+ for (int i = 0; i < threadCount; ++i) {
+ threads[i].start();
+ }
+ // Join the threads.
+ for (int i = 0; i < threadCount; ++i) {
+ try {
+ threads[i].join();
+ } catch (Exception ex) {
+ }
+ }
+ }
+
+ // Time limit to run benchmarks in seconds
+ public static final int TIME_LIMIT = 5;
+
+ static void initializeBenchmarks(Activity parent, BenchmarkRunner benchmarks) {
+ benchmarks.addBenchmark("Use 1 thread", () -> {
+ doSomeWork(1);
+ });
+ benchmarks.addBenchmark("Use 2 threads", () -> {
+ doSomeWork(2);
+ });
+ benchmarks.addBenchmark("Use 4 threads", () -> {
+ doSomeWork(4);
+ });
+ benchmarks.addBenchmark("Use 8 threads", () -> {
+ doSomeWork(8);
+ });
+ benchmarks.addBenchmark("Use 16 threads", () -> {
+ doSomeWork(16);
+ });
+ }
+}
diff --git a/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java b/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java
new file mode 100644
index 0000000..3e0e3b1
--- /dev/null
+++ b/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java
@@ -0,0 +1,30 @@
+/*
+ * 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.startop.test;
+
+import android.os.Bundle;
+
+public class InitCheckOverheadBenchmarkActivity extends SystemServerBenchmarkActivity {
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.system_server_benchmark_page);
+
+ mBenchmarkList = findViewById(R.id.benchmark_list);
+
+ InitCheckOverheadBenchmarks.initializeBenchmarks(this, this);
+ }
+}
diff --git a/startop/apps/test/src/InitCheckOverheadBenchmarks.java b/startop/apps/test/src/InitCheckOverheadBenchmarks.java
new file mode 100644
index 0000000..79adbbc
--- /dev/null
+++ b/startop/apps/test/src/InitCheckOverheadBenchmarks.java
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+/**
+ * A test of initialization check costs for AOT.
+ */
+
+package com.android.startop.test;
+
+import android.app.Activity;
+
+import java.util.Random;
+
+public class InitCheckOverheadBenchmarks {
+ public static int mSum;
+ public static int mSum2;
+ public static int mStep;
+ public static int mStep2;
+ public static int mStartingValue;
+
+ static {
+ Random random = new Random();
+ mStep = random.nextInt();
+ mStep2 = random.nextInt();
+ mStartingValue = random.nextInt();
+ };
+
+ static class OtherClass {
+ public static int mStep;
+ public static int mStep2;
+ public static int mStartingValue;
+ static {
+ Random random = new Random();
+ mStep = random.nextInt();
+ mStep2 = random.nextInt();
+ mStartingValue = random.nextInt();
+ };
+ };
+
+ public static void localStaticFor(int iterationCount) {
+ for (int i = 0; i < iterationCount; ++i) {
+ mSum += mStep;
+ }
+ }
+
+ public static void nonLocalStaticFor(int iterationCount) {
+ mSum = OtherClass.mStartingValue;
+ for (int i = 0; i < iterationCount; ++i) {
+ mSum += OtherClass.mStep;
+ }
+ }
+
+ public static void localStaticForTwo(int iterationCount) {
+ for (int i = 0; i < iterationCount; ++i) {
+ mSum += mStep;
+ mSum2 += mStep2;
+ }
+ }
+
+ public static void nonLocalStaticForTwo(int iterationCount) {
+ mSum = OtherClass.mStartingValue;
+ for (int i = 0; i < iterationCount; ++i) {
+ mSum += OtherClass.mStep;
+ mSum2 += OtherClass.mStep2;
+ }
+ }
+
+ public static void localStaticDoWhile(int iterationCount) {
+ int i = 0;
+ do {
+ mSum += mStep;
+ ++i;
+ } while (i < iterationCount);
+ }
+
+ public static void nonLocalStaticDoWhile(int iterationCount) {
+ mSum = OtherClass.mStartingValue;
+ int i = 0;
+ do {
+ mSum += OtherClass.mStep;
+ ++i;
+ } while (i < iterationCount);
+ }
+
+ public static void doGC() {
+ Runtime.getRuntime().gc();
+ }
+
+ // Time limit to run benchmarks in seconds
+ public static final int TIME_LIMIT = 5;
+
+ static void initializeBenchmarks(Activity parent, BenchmarkRunner benchmarks) {
+ benchmarks.addBenchmark("GC", () -> {
+ doGC();
+ });
+
+ benchmarks.addBenchmark("InitCheckFor (local)", () -> {
+ localStaticFor(10000000);
+ });
+
+ benchmarks.addBenchmark("InitCheckFor (non-local)", () -> {
+ nonLocalStaticFor(10000000);
+ });
+
+ benchmarks.addBenchmark("InitCheckForTwo (local)", () -> {
+ localStaticForTwo(10000000);
+ });
+
+ benchmarks.addBenchmark("InitCheckForTwo (non-local)", () -> {
+ nonLocalStaticForTwo(10000000);
+ });
+
+ benchmarks.addBenchmark("InitCheckDoWhile (local)", () -> {
+ localStaticDoWhile(10000000);
+ });
+
+ benchmarks.addBenchmark("InitCheckDoWhile (non-local)", () -> {
+ nonLocalStaticDoWhile(10000000);
+ });
+ }
+}
diff --git a/startop/apps/test/src/SystemServerBenchmarkActivity.java b/startop/apps/test/src/SystemServerBenchmarkActivity.java
index 75ea69b..6be8df3 100644
--- a/startop/apps/test/src/SystemServerBenchmarkActivity.java
+++ b/startop/apps/test/src/SystemServerBenchmarkActivity.java
@@ -17,28 +17,20 @@
package com.android.startop.test;
import android.app.Activity;
-import android.app.ActivityManager;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.AsyncTask;
import android.os.Bundle;
-import android.view.ViewGroup;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.TextView;
public class SystemServerBenchmarkActivity extends Activity implements BenchmarkRunner {
- private GridLayout benchmarkList;
+ protected GridLayout mBenchmarkList;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.system_server_benchmark_page);
- benchmarkList = findViewById(R.id.benchmark_list);
+ mBenchmarkList = findViewById(R.id.benchmark_list);
SystemServerBenchmarks.initializeBenchmarks(this, this);
}
@@ -49,7 +41,7 @@
* @param name A short name that shows up in the UI or benchmark results
*/
public void addBenchmark(CharSequence name, Runnable thunk) {
- Context context = benchmarkList.getContext();
+ Context context = mBenchmarkList.getContext();
Button button = new Button(context);
TextView mean = new TextView(context);
TextView stdev = new TextView(context);
@@ -68,8 +60,8 @@
});
});
- benchmarkList.addView(button);
- benchmarkList.addView(mean);
- benchmarkList.addView(stdev);
+ mBenchmarkList.addView(button);
+ mBenchmarkList.addView(mean);
+ mBenchmarkList.addView(stdev);
}
}
diff --git a/startop/apps/test/src/SystemServerBenchmarks.java b/startop/apps/test/src/SystemServerBenchmarks.java
index 5918503..25b43f4 100644
--- a/startop/apps/test/src/SystemServerBenchmarks.java
+++ b/startop/apps/test/src/SystemServerBenchmarks.java
@@ -60,22 +60,6 @@
benchmarks.addBenchmark("Empty", () -> {
});
- benchmarks.addBenchmark("CPU Intensive (1 thread)", () -> {
- CPUIntensive.doSomeWork(1);
- });
-
- benchmarks.addBenchmark("CPU Intensive (2 thread)", () -> {
- CPUIntensive.doSomeWork(2);
- });
-
- benchmarks.addBenchmark("CPU Intensive (4 thread)", () -> {
- CPUIntensive.doSomeWork(4);
- });
-
- benchmarks.addBenchmark("CPU Intensive (8 thread)", () -> {
- CPUIntensive.doSomeWork(8);
- });
-
PackageManager pm = parent.getPackageManager();
benchmarks.addBenchmark("getInstalledApplications", () -> {
pm.getInstalledApplications(PackageManager.MATCH_SYSTEM_ONLY);
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 3f348a4..60290e3 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -2049,6 +2049,10 @@
return "DISCONNECTING";
case STATE_SELECT_PHONE_ACCOUNT:
return "SELECT_PHONE_ACCOUNT";
+ case STATE_SIMULATED_RINGING:
+ return "SIMULATED_RINGING";
+ case STATE_AUDIO_PROCESSING:
+ return "AUDIO_PROCESSING";
default:
Log.w(Call.class, "Unknown state %d", state);
return "UNKNOWN";
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
old mode 100755
new mode 100644
index 047b220..58e15b9
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1448,6 +1448,15 @@
"stk_disable_launch_browser_bool";
/**
+ * Boolean indicating if the helper text for STK GET INKEY/INPUT commands with the digit only
+ * mode is displayed on the input screen.
+ * The helper text is dispayed regardless of the input mode, if {@code false}.
+ * @hide
+ */
+ public static final String KEY_HIDE_DIGITS_HELPER_TEXT_ON_STK_INPUT_SCREEN_BOOL =
+ "hide_digits_helper_text_on_stk_input_screen_bool";
+
+ /**
* Boolean indicating if show data RAT icon on status bar even when data is disabled
* @hide
*/
@@ -3525,6 +3534,7 @@
sDefaults.putBoolean(KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL, false);
sDefaults.putBoolean(KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL, false);
sDefaults.putBoolean(KEY_ALLOW_METERED_NETWORK_FOR_CERT_DOWNLOAD_BOOL, false);
+ sDefaults.putBoolean(KEY_HIDE_DIGITS_HELPER_TEXT_ON_STK_INPUT_SCREEN_BOOL, true);
sDefaults.putStringArray(KEY_CARRIER_WIFI_STRING_ARRAY, null);
sDefaults.putInt(KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT, -1);
sDefaults.putInt(KEY_EMERGENCY_NOTIFICATION_DELAY_INT, -1);
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index 3e02871..56b7236 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -24,8 +24,8 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.AccessNetworkConstants.TransportType;
-
import android.telephony.Annotation.NetworkType;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
@@ -90,7 +90,7 @@
* Dual Connectivity(EN-DC).
* @hide
*/
- public static final int NR_STATE_NONE = -1;
+ public static final int NR_STATE_NONE = 0;
/**
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) but
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 1d00b4f..f503348 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -102,7 +102,7 @@
* Indicates frequency range is unknown.
* @hide
*/
- public static final int FREQUENCY_RANGE_UNKNOWN = -1;
+ public static final int FREQUENCY_RANGE_UNKNOWN = 0;
/**
* Indicates the frequency range is below 1GHz.
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 2d35f8e..ee291fa 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -28,17 +28,13 @@
import android.app.ActivityThread;
import android.app.PendingIntent;
import android.content.Context;
-import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.CursorWindow;
import android.net.Uri;
-import android.os.Binder;
-import android.os.BaseBundle;
import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.provider.Telephony;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -290,12 +286,6 @@
*/
public static final int SMS_MESSAGE_PERIOD_NOT_SPECIFIED = -1;
- /**
- * Extra key passed into a PendingIntent when the SMS operation failed due to there being no
- * default set.
- */
- private static final String NO_DEFAULT_EXTRA = "noDefault";
-
// result of asking the user for a subscription to perform an operation.
private interface SubscriptionResolverResult {
void onSuccess(int subId);
@@ -336,9 +326,59 @@
* <code>RESULT_ERROR_RADIO_OFF</code><br>
* <code>RESULT_ERROR_NULL_PDU</code><br>
* <code>RESULT_ERROR_NO_SERVICE</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -378,9 +418,60 @@
* <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
* <code>RESULT_ERROR_RADIO_OFF</code><br>
* <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -451,13 +542,13 @@
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal: Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
+ notifySmsError(sentIntent, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -471,7 +562,7 @@
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal (no persist): Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
}
@@ -564,13 +655,13 @@
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal: Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
+ notifySmsError(sentIntent, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -586,7 +677,7 @@
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal(no persist): Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
}
@@ -668,7 +759,7 @@
} catch (RemoteException ex) {
try {
if (receivedIntent != null) {
- receivedIntent.send(Telephony.Sms.Intents.RESULT_SMS_GENERIC_ERROR);
+ receivedIntent.send(RESULT_REMOTE_EXCEPTION);
}
} catch (PendingIntent.CanceledException cx) {
// Don't worry about it, we do not need to notify the caller if this is the case.
@@ -724,12 +815,63 @@
* broadcast when the corresponding message part has been sent.
* The result code will be <code>Activity.RESULT_OK</code> for success,
* or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
+ * <code>RESULT_ERROR_RADIO_OFF</code><br>
+ * <code>RESULT_ERROR_NULL_PDU</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -811,13 +953,13 @@
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntents);
+ notifySmsError(sentIntents, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -832,7 +974,7 @@
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
} else {
@@ -911,12 +1053,63 @@
* broadcast when the corresponding message part has been sent.
* The result code will be <code>Activity.RESULT_OK</code> for success,
* or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
+ * <code>RESULT_ERROR_RADIO_OFF</code><br>
+ * <code>RESULT_ERROR_NULL_PDU</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -994,13 +1187,13 @@
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntents);
+ notifySmsError(sentIntents, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -1016,7 +1209,7 @@
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal (no persist): Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
} else {
@@ -1061,9 +1254,60 @@
* <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
* <code>RESULT_ERROR_RADIO_OFF</code><br>
* <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -1095,12 +1339,12 @@
sentIntent, deliveryIntent);
} catch (RemoteException e) {
Log.e(TAG, "sendDataMessage: Couldn't send SMS - Exception: " + e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
+ notifySmsError(sentIntent, RESULT_NO_DEFAULT_SMS_APP);
}
});
}
@@ -1305,53 +1549,20 @@
return binder;
}
- private static void notifySmsErrorNoDefaultSet(Context context, PendingIntent pendingIntent) {
+ private static void notifySmsError(PendingIntent pendingIntent, int error) {
if (pendingIntent != null) {
- Intent errorMessage = new Intent();
- errorMessage.putExtra(NO_DEFAULT_EXTRA, true);
try {
- pendingIntent.send(context, RESULT_ERROR_GENERIC_FAILURE, errorMessage);
+ pendingIntent.send(error);
} catch (PendingIntent.CanceledException e) {
// Don't worry about it, we do not need to notify the caller if this is the case.
}
}
}
- private static void notifySmsErrorNoDefaultSet(Context context,
- List<PendingIntent> pendingIntents) {
+ private static void notifySmsError(List<PendingIntent> pendingIntents, int error) {
if (pendingIntents != null) {
for (PendingIntent pendingIntent : pendingIntents) {
- Intent errorMessage = new Intent();
- errorMessage.putExtra(NO_DEFAULT_EXTRA, true);
- try {
- pendingIntent.send(context, RESULT_ERROR_GENERIC_FAILURE, errorMessage);
- } catch (PendingIntent.CanceledException e) {
- // Don't worry about it, we do not need to notify the caller if this is the
- // case.
- }
- }
- }
- }
-
- private static void notifySmsGenericError(PendingIntent pendingIntent) {
- if (pendingIntent != null) {
- try {
- pendingIntent.send(RESULT_ERROR_GENERIC_FAILURE);
- } catch (PendingIntent.CanceledException e) {
- // Don't worry about it, we do not need to notify the caller if this is the case.
- }
- }
- }
-
- private static void notifySmsGenericError(List<PendingIntent> pendingIntents) {
- if (pendingIntents != null) {
- for (PendingIntent pendingIntent : pendingIntents) {
- try {
- pendingIntent.send(RESULT_ERROR_GENERIC_FAILURE);
- } catch (PendingIntent.CanceledException e) {
- // Don't worry about it, we do not need to notify the caller if this is the
- // case.
- }
+ notifySmsError(pendingIntent, error);
}
}
}
@@ -1798,19 +2009,19 @@
// see SmsMessage.getStatusOnIcc
/** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_FREE = 0;
+ public static final int STATUS_ON_ICC_FREE = 0;
/** Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_READ = 1;
+ public static final int STATUS_ON_ICC_READ = 1;
/** Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_UNREAD = 3;
+ public static final int STATUS_ON_ICC_UNREAD = 3;
/** Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_SENT = 5;
+ public static final int STATUS_ON_ICC_SENT = 5;
/** Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_UNSENT = 7;
+ public static final int STATUS_ON_ICC_UNSENT = 7;
// SMS send failure result codes
@@ -1846,126 +2057,263 @@
/**
* No error.
- * @hide
*/
- @SystemApi
- static public final int RESULT_ERROR_NONE = 0;
+ public static final int RESULT_ERROR_NONE = 0;
+
/** Generic failure cause */
- static public final int RESULT_ERROR_GENERIC_FAILURE = 1;
+ public static final int RESULT_ERROR_GENERIC_FAILURE = 1;
+
/** Failed because radio was explicitly turned off */
- static public final int RESULT_ERROR_RADIO_OFF = 2;
+ public static final int RESULT_ERROR_RADIO_OFF = 2;
+
/** Failed because no pdu provided */
- static public final int RESULT_ERROR_NULL_PDU = 3;
+ public static final int RESULT_ERROR_NULL_PDU = 3;
+
/** Failed because service is currently unavailable */
- static public final int RESULT_ERROR_NO_SERVICE = 4;
+ public static final int RESULT_ERROR_NO_SERVICE = 4;
+
/** Failed because we reached the sending queue limit. */
- static public final int RESULT_ERROR_LIMIT_EXCEEDED = 5;
+ public static final int RESULT_ERROR_LIMIT_EXCEEDED = 5;
+
/**
* Failed because FDN is enabled.
- * @hide
*/
- @SystemApi
- static public final int RESULT_ERROR_FDN_CHECK_FAILURE = 6;
+ public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6;
+
/** Failed because user denied the sending of this short code. */
- static public final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7;
+ public static final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7;
+
/** Failed because the user has denied this app ever send premium short codes. */
- static public final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8;
+ public static final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8;
+
/**
* Failed because the radio was not available
- * @hide
*/
- @SystemApi
- static public final int RESULT_RADIO_NOT_AVAILABLE = 9;
+ public static final int RESULT_RADIO_NOT_AVAILABLE = 9;
+
/**
* Failed because of network rejection
- * @hide
*/
- @SystemApi
- static public final int RESULT_NETWORK_REJECT = 10;
+ public static final int RESULT_NETWORK_REJECT = 10;
+
/**
* Failed because of invalid arguments
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_ARGUMENTS = 11;
+ public static final int RESULT_INVALID_ARGUMENTS = 11;
+
/**
* Failed because of an invalid state
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_STATE = 12;
+ public static final int RESULT_INVALID_STATE = 12;
+
/**
* Failed because there is no memory
- * @hide
*/
- @SystemApi
- static public final int RESULT_NO_MEMORY = 13;
+ public static final int RESULT_NO_MEMORY = 13;
+
/**
* Failed because the sms format is not valid
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_SMS_FORMAT = 14;
+ public static final int RESULT_INVALID_SMS_FORMAT = 14;
+
/**
* Failed because of a system error
- * @hide
*/
- @SystemApi
- static public final int RESULT_SYSTEM_ERROR = 15;
+ public static final int RESULT_SYSTEM_ERROR = 15;
+
/**
* Failed because of a modem error
- * @hide
*/
- @SystemApi
- static public final int RESULT_MODEM_ERROR = 16;
+ public static final int RESULT_MODEM_ERROR = 16;
+
/**
* Failed because of a network error
- * @hide
*/
- @SystemApi
- static public final int RESULT_NETWORK_ERROR = 17;
+ public static final int RESULT_NETWORK_ERROR = 17;
+
/**
* Failed because of an encoding error
- * @hide
*/
- @SystemApi
- static public final int RESULT_ENCODING_ERROR = 18;
+ public static final int RESULT_ENCODING_ERROR = 18;
+
/**
* Failed because of an invalid smsc address
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_SMSC_ADDRESS = 19;
+ public static final int RESULT_INVALID_SMSC_ADDRESS = 19;
+
/**
* Failed because the operation is not allowed
- * @hide
*/
- @SystemApi
- static public final int RESULT_OPERATION_NOT_ALLOWED = 20;
+ public static final int RESULT_OPERATION_NOT_ALLOWED = 20;
+
/**
* Failed because of an internal error
- * @hide
*/
- @SystemApi
- static public final int RESULT_INTERNAL_ERROR = 21;
+ public static final int RESULT_INTERNAL_ERROR = 21;
+
/**
* Failed because there are no resources
- * @hide
*/
- @SystemApi
- static public final int RESULT_NO_RESOURCES = 22;
+ public static final int RESULT_NO_RESOURCES = 22;
+
/**
* Failed because the operation was cancelled
- * @hide
*/
- @SystemApi
- static public final int RESULT_CANCELLED = 23;
+ public static final int RESULT_CANCELLED = 23;
+
/**
* Failed because the request is not supported
- * @hide
*/
- @SystemApi
- static public final int RESULT_REQUEST_NOT_SUPPORTED = 24;
+ public static final int RESULT_REQUEST_NOT_SUPPORTED = 24;
+
+ /**
+ * Failed sending via bluetooth because the bluetooth service is not available
+ */
+ public static final int RESULT_NO_BLUETOOTH_SERVICE = 25;
+
+ /**
+ * Failed sending via bluetooth because the bluetooth device address is invalid
+ */
+ public static final int RESULT_INVALID_BLUETOOTH_ADDRESS = 26;
+
+ /**
+ * Failed sending via bluetooth because bluetooth disconnected
+ */
+ public static final int RESULT_BLUETOOTH_DISCONNECTED = 27;
+
+ /**
+ * Failed sending because the user denied or canceled the dialog displayed for a premium
+ * shortcode sms or rate-limited sms.
+ */
+ public static final int RESULT_UNEXPECTED_EVENT_STOP_SENDING = 28;
+
+ /**
+ * Failed sending during an emergency call
+ */
+ public static final int RESULT_SMS_BLOCKED_DURING_EMERGENCY = 29;
+
+ /**
+ * Failed to send an sms retry
+ */
+ public static final int RESULT_SMS_SEND_RETRY_FAILED = 30;
+
+ /**
+ * Set by BroadcastReceiver to indicate a remote exception while handling a message.
+ */
+ public static final int RESULT_REMOTE_EXCEPTION = 31;
+
+ /**
+ * Set by BroadcastReceiver to indicate there's no default sms app.
+ */
+ public static final int RESULT_NO_DEFAULT_SMS_APP = 32;
+
+ // Radio Error results
+
+ /**
+ * The radio did not start or is resetting.
+ */
+ public static final int RESULT_RIL_RADIO_NOT_AVAILABLE = 100;
+
+ /**
+ * The radio failed to send the sms and needs to retry.
+ */
+ public static final int RESULT_RIL_SMS_SEND_FAIL_RETRY = 101;
+
+ /**
+ * The sms request was rejected by the network.
+ */
+ public static final int RESULT_RIL_NETWORK_REJECT = 102;
+
+ /**
+ * The radio returned an unexpected request for the current state.
+ */
+ public static final int RESULT_RIL_INVALID_STATE = 103;
+
+ /**
+ * The radio received invalid arguments in the request.
+ */
+ public static final int RESULT_RIL_INVALID_ARGUMENTS = 104;
+
+ /**
+ * The radio didn't have sufficient memory to process the request.
+ */
+ public static final int RESULT_RIL_NO_MEMORY = 105;
+
+ /**
+ * The radio denied the operation due to overly-frequent requests.
+ */
+ public static final int RESULT_RIL_REQUEST_RATE_LIMITED = 106;
+
+ /**
+ * The radio returned an error indicating invalid sms format.
+ */
+ public static final int RESULT_RIL_INVALID_SMS_FORMAT = 107;
+
+ /**
+ * The radio encountered a platform or system error.
+ */
+ public static final int RESULT_RIL_SYSTEM_ERR = 108;
+
+ /**
+ * The SMS message was not encoded properly.
+ */
+ public static final int RESULT_RIL_ENCODING_ERR = 109;
+
+ /**
+ * The specified SMSC address was invalid.
+ */
+ public static final int RESULT_RIL_INVALID_SMSC_ADDRESS = 110;
+
+ /**
+ * The vendor RIL received an unexpected or incorrect response.
+ */
+ public static final int RESULT_RIL_MODEM_ERR = 111;
+
+ /**
+ * The radio received an error from the network.
+ */
+ public static final int RESULT_RIL_NETWORK_ERR = 112;
+
+ /**
+ * The modem encountered an unexpected error scenario while handling the request.
+ */
+ public static final int RESULT_RIL_INTERNAL_ERR = 113;
+
+ /**
+ * The request was not supported by the radio.
+ */
+ public static final int RESULT_RIL_REQUEST_NOT_SUPPORTED = 114;
+
+ /**
+ * The radio cannot process the request in the current modem state.
+ */
+ public static final int RESULT_RIL_INVALID_MODEM_STATE = 115;
+
+ /**
+ * The network is not ready to perform the request.
+ */
+ public static final int RESULT_RIL_NETWORK_NOT_READY = 116;
+
+ /**
+ * The radio reports the request is not allowed.
+ */
+ public static final int RESULT_RIL_OPERATION_NOT_ALLOWED = 117;
+
+ /**
+ * There are not sufficient resources to process the request.
+ */
+ public static final int RESULT_RIL_NO_RESOURCES = 118;
+
+ /**
+ * The request has been cancelled.
+ */
+ public static final int RESULT_RIL_CANCELLED = 119;
+
+ /**
+ * The radio failed to set the location where the CDMA subscription
+ * can be retrieved because the SIM or RUIM is absent.
+ */
+ public static final int RESULT_RIL_SIM_ABSENT = 120;
/**
* Send an MMS message
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 06a7370..2eb4809 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -424,18 +424,8 @@
* {@link #getActiveModemCount} returns 1 while this API returns 2.
*/
public @ModemCount int getSupportedModemCount() {
- // TODO: b/139642279 when turning on this feature, remove dependency of
- // PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE and always return result based on
- // PROPERTY_MAX_ACTIVE_MODEMS.
- String rebootRequired = SystemProperties.get(
- TelephonyProperties.PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE);
- if (rebootRequired.equals("false")) {
- // If no reboot is required, return max possible active modems.
- return SystemProperties.getInt(
- TelephonyProperties.PROPERTY_MAX_ACTIVE_MODEMS, getPhoneCount());
- } else {
- return getPhoneCount();
- }
+ return SystemProperties.getInt(TelephonyProperties.PROPERTY_MAX_ACTIVE_MODEMS,
+ getActiveModemCount());
}
/** {@hide} */
@@ -10237,11 +10227,13 @@
/**
* Action set from carrier signalling broadcast receivers to enable/disable radio
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * Permissions {@link android.Manifest.permission.MODIFY_PHONE_STATE} is required.
* @param subId the subscription ID that this action applies to.
* @param enabled control enable or disable radio.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void carrierActionSetRadioEnabled(int subId, boolean enabled) {
try {
ITelephony service = getITelephony();
@@ -10256,11 +10248,13 @@
/**
* Action set from carrier signalling broadcast receivers to start/stop reporting default
* network available events
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * Permissions {@link android.Manifest.permission.MODIFY_PHONE_STATE} is required.
* @param subId the subscription ID that this action applies to.
* @param report control start/stop reporting network status.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void carrierActionReportDefaultNetworkStatus(int subId, boolean report) {
try {
ITelephony service = getITelephony();
@@ -10274,10 +10268,12 @@
/**
* Action set from carrier signalling broadcast receivers to reset all carrier actions
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * Permissions {@link android.Manifest.permission.MODIFY_PHONE_STATE} is required.
* @param subId the subscription ID that this action applies to.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void carrierActionResetAll(int subId) {
try {
ITelephony service = getITelephony();
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 2161dcb..a5d6266 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -1191,7 +1191,7 @@
&& !other.canHandleType(TYPE_DUN)
&& Objects.equals(this.mApnName, other.mApnName)
&& !typeSameAny(this, other)
- && xorEquals(this.mProxyAddress, other.mProxyAddress)
+ && xorEqualsString(this.mProxyAddress, other.mProxyAddress)
&& xorEqualsInt(this.mProxyPort, other.mProxyPort)
&& xorEquals(this.mProtocol, other.mProtocol)
&& xorEquals(this.mRoamingProtocol, other.mRoamingProtocol)
@@ -1200,7 +1200,7 @@
&& Objects.equals(this.mMvnoType, other.mMvnoType)
&& Objects.equals(this.mMvnoMatchData, other.mMvnoMatchData)
&& xorEquals(this.mMmsc, other.mMmsc)
- && xorEquals(this.mMmsProxyAddress, other.mMmsProxyAddress)
+ && xorEqualsString(this.mMmsProxyAddress, other.mMmsProxyAddress)
&& xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort))
&& Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask)
&& Objects.equals(mApnSetId, other.mApnSetId)
@@ -1213,6 +1213,11 @@
return first == null || second == null || first.equals(second);
}
+ // Equal or one is null.
+ private boolean xorEqualsString(String first, String second) {
+ return TextUtils.isEmpty(first) || TextUtils.isEmpty(second) || first.equals(second);
+ }
+
// Equal or one is not specified.
private boolean xorEqualsInt(int first, int second) {
return first == UNSPECIFIED_INT || second == UNSPECIFIED_INT
diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java
index 5a90cb1..0025c7a 100644
--- a/telephony/java/android/telephony/euicc/EuiccManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccManager.java
@@ -830,7 +830,7 @@
* @param callbackIntent a PendingIntent to launch when the operation completes.
*
* @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
- * and use @link{eraseSubscriptionsWithOptions} instead
+ * and use {@link #eraseSubscriptionsWithOptions(int, PendingIntent)} instead
*
* @hide
*/
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 39e00cc..f79a5c6 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1778,21 +1778,6 @@
boolean isInEmergencySmsMode();
/**
- * Get a list of SMS apps on a user.
- */
- String[] getSmsApps(int userId);
-
- /**
- * Get the default SMS app on a given user.
- */
- String getDefaultSmsApp(int userId);
-
- /**
- * Set the default SMS app to a given package on a given user.
- */
- void setDefaultSmsApp(int userId, String packageName);
-
- /**
* Return the modem radio power state for slot index.
*
*/
diff --git a/tests/BootImageProfileTest/AndroidTest.xml b/tests/BootImageProfileTest/AndroidTest.xml
index c132007..b4f2663 100644
--- a/tests/BootImageProfileTest/AndroidTest.xml
+++ b/tests/BootImageProfileTest/AndroidTest.xml
@@ -22,8 +22,8 @@
<!-- we need this magic flag, otherwise it always reboots and breaks the selinux -->
<option name="force-skip-system-props" value="true" />
- <option name="run-command" value="setprop dalvik.vm.profilesystemserver true" />
- <option name="run-command" value="setprop dalvik.vm.profilebootclasspath true" />
+ <option name="run-command" value="device_config put runtime_native_boot profilesystemserver true" />
+ <option name="run-command" value="device_config put runtime_native_boot profilebootclasspath true" />
<!-- Profiling does not pick up the above changes we restart the shell -->
<option name="run-command" value="stop" />
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index fe1d9d2..81937e6 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -46,17 +46,23 @@
*/
@Test
public void testProperties() throws Exception {
- String res = mTestDevice.getProperty("dalvik.vm.profilebootclasspath");
+ String res = mTestDevice.getProperty(
+ "persist.device_config.runtime_native_boot.profilebootclasspath");
assertTrue("profile boot class path not enabled", res != null && res.equals("true"));
- res = mTestDevice.getProperty("dalvik.vm.profilesystemserver");
+ res = mTestDevice.getProperty(
+ "persist.device_config.runtime_native_boot.profilesystemserver");
assertTrue("profile system server not enabled", res != null && res.equals("true"));
}
- private void forceSaveProfile(String pkg) throws Exception {
+ private boolean forceSaveProfile(String pkg) throws Exception {
String pid = mTestDevice.executeShellCommand("pidof " + pkg).trim();
- assertTrue("Invalid pid " + pid, pid.length() > 0);
+ if (pid.length() == 0) {
+ // Not yet running.
+ return false;
+ }
String res = mTestDevice.executeShellCommand("kill -s SIGUSR1 " + pid).trim();
assertTrue("kill SIGUSR1: " + res, res.length() == 0);
+ return true;
}
@Test
@@ -69,10 +75,13 @@
// Wait up to 20 seconds for the profile to be saved.
for (int i = 0; i < 20; ++i) {
// Force save the profile since we truncated it.
- forceSaveProfile("system_server");
- String s = mTestDevice.executeShellCommand("wc -c <" + SYSTEM_SERVER_PROFILE).trim();
- if (!"0".equals(s)) {
- break;
+ if (forceSaveProfile("system_server")) {
+ // Might fail if system server is not yet running.
+ String s = mTestDevice.executeShellCommand(
+ "wc -c <" + SYSTEM_SERVER_PROFILE).trim();
+ if (!"0".equals(s)) {
+ break;
+ }
}
Thread.sleep(1000);
}
diff --git a/tests/Compatibility/Android.bp b/tests/Compatibility/Android.bp
index 4ca406e..7dc44fa 100644
--- a/tests/Compatibility/Android.bp
+++ b/tests/Compatibility/Android.bp
@@ -19,4 +19,7 @@
srcs: ["src/**/*.java"],
platform_apis: true,
certificate: "platform",
+ test_suites: [
+ "csuite"
+ ],
}
diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp
index 085c53c..2bc129a 100644
--- a/tests/RollbackTest/Android.bp
+++ b/tests/RollbackTest/Android.bp
@@ -25,6 +25,7 @@
name: "StagedRollbackTest",
srcs: ["StagedRollbackTest/src/**/*.java"],
libs: ["tradefed"],
+ static_libs: ["testng"],
test_suites: ["general-tests"],
test_config: "StagedRollbackTest.xml",
}
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
index db5e7f8..bfb4968 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
@@ -32,6 +32,8 @@
import android.content.pm.PackageInstaller;
import android.content.rollback.RollbackInfo;
import android.content.rollback.RollbackManager;
+import android.os.ParcelFileDescriptor;
+import android.provider.DeviceConfig;
import android.text.TextUtils;
import androidx.test.InstrumentationRegistry;
@@ -45,12 +47,16 @@
import com.android.cts.rollback.lib.RollbackUtils;
import com.android.internal.R;
+import libcore.io.IoUtils;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+import java.util.concurrent.TimeUnit;
+
/**
* Tests for rollback of staged installs.
* <p>
@@ -64,6 +70,8 @@
private static final String NETWORK_STACK_CONNECTOR_CLASS =
"android.net.INetworkStackConnector";
+ private static final String PROPERTY_WATCHDOG_TRIGGER_FAILURE_COUNT =
+ "watchdog_trigger_failure_count";
private static final String MODULE_META_DATA_PACKAGE = getModuleMetadataPackageName();
@@ -76,7 +84,8 @@
Manifest.permission.INSTALL_PACKAGES,
Manifest.permission.DELETE_PACKAGES,
Manifest.permission.TEST_MANAGE_ROLLBACKS,
- Manifest.permission.FORCE_STOP_PACKAGES);
+ Manifest.permission.FORCE_STOP_PACKAGES,
+ Manifest.permission.WRITE_DEVICE_CONFIG);
}
/**
@@ -119,6 +128,13 @@
assertThat(rollback).packagesContainsExactly(
Rollback.from(TestApp.A2).to(TestApp.A1));
assertThat(rollback.isStaged()).isTrue();
+
+ DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ROLLBACK,
+ PROPERTY_WATCHDOG_TRIGGER_FAILURE_COUNT,
+ Integer.toString(5), false);
+ RollbackUtils.sendCrashBroadcast(TestApp.A, 4);
+ // Sleep for a while to make sure we don't trigger rollback
+ Thread.sleep(TimeUnit.SECONDS.toMillis(30));
}
/**
@@ -128,8 +144,8 @@
*/
@Test
public void testBadApkOnly_Phase3() throws Exception {
- // Crash TestApp.A PackageWatchdog#TRIGGER_FAILURE_COUNT times to trigger rollback
- RollbackUtils.sendCrashBroadcast(TestApp.A, 5);
+ // One more crash to trigger rollback
+ RollbackUtils.sendCrashBroadcast(TestApp.A, 1);
// We expect the device to be rebooted automatically. Wait for that to happen.
Thread.sleep(30 * 1000);
@@ -158,18 +174,6 @@
assertThat(rollback.getCommittedSessionId()).isNotEqualTo(-1);
}
- @Test
- public void resetNetworkStack() throws Exception {
- RollbackManager rm = RollbackUtils.getRollbackManager();
- String networkStack = getNetworkStackPackageName();
-
- rm.expireRollbackForPackage(networkStack);
- Uninstall.packages(networkStack);
-
- assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(),
- networkStack)).isNull();
- }
-
/**
* Stage install ModuleMetadata package to simulate a Mainline module update.
*/
@@ -210,45 +214,45 @@
@Test
public void testNetworkFailedRollback_Phase1() throws Exception {
- resetNetworkStack();
+ RollbackManager rm = RollbackUtils.getRollbackManager();
+ String networkStack = getNetworkStackPackageName();
+
+ rm.expireRollbackForPackage(networkStack);
+ uninstallNetworkStackPackage();
+
+ assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(),
+ networkStack)).isNull();
}
@Test
public void testNetworkFailedRollback_Phase2() throws Exception {
- assertNetworkStackRollbackAvailable();
+ RollbackManager rm = RollbackUtils.getRollbackManager();
+ assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(),
+ getNetworkStackPackageName())).isNotNull();
+
+ // Sleep for < health check deadline
+ Thread.sleep(TimeUnit.SECONDS.toMillis(5));
+ // Verify rollback was not executed before health check deadline
+ assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(),
+ getNetworkStackPackageName())).isNull();
}
@Test
public void testNetworkFailedRollback_Phase3() throws Exception {
- assertNoNetworkStackRollbackCommitted();
+ // Sleep for > health check deadline
+ // The device is expected to reboot during sleeping. This device method will fail and
+ // the host will catch the assertion. If reboot doesn't happen, the host will fail the
+ // assertion.
+ Thread.sleep(TimeUnit.SECONDS.toMillis(120));
}
@Test
public void testNetworkFailedRollback_Phase4() throws Exception {
- assertNetworkStackRollbackCommitted();
- }
-
- @Test
- public void assertNetworkStackRollbackAvailable() throws Exception {
- RollbackManager rm = RollbackUtils.getRollbackManager();
- assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(),
- getNetworkStackPackageName())).isNotNull();
- }
-
- @Test
- public void assertNetworkStackRollbackCommitted() throws Exception {
RollbackManager rm = RollbackUtils.getRollbackManager();
assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(),
getNetworkStackPackageName())).isNotNull();
}
- @Test
- public void assertNoNetworkStackRollbackCommitted() throws Exception {
- RollbackManager rm = RollbackUtils.getRollbackManager();
- assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(),
- getNetworkStackPackageName())).isNull();
- }
-
private String getNetworkStackPackageName() {
Intent intent = new Intent(NETWORK_STACK_CONNECTOR_CLASS);
ComponentName comp = intent.resolveSystemService(
@@ -256,6 +260,12 @@
return comp.getPackageName();
}
+ private void uninstallNetworkStackPackage() {
+ // Since the host side use shell command to install the network stack package, uninstall
+ // must be done by shell command as well. Otherwise uninstall by a different user will fail.
+ runShellCommand("pm uninstall " + getNetworkStackPackageName());
+ }
+
@Test
public void testPreviouslyAbandonedRollbacks_Phase1() throws Exception {
Uninstall.packages(TestApp.A);
@@ -294,17 +304,28 @@
@Test
public void testNetworkPassedDoesNotRollback_Phase1() throws Exception {
- resetNetworkStack();
+ RollbackManager rm = RollbackUtils.getRollbackManager();
+ String networkStack = getNetworkStackPackageName();
+
+ rm.expireRollbackForPackage(networkStack);
+ uninstallNetworkStackPackage();
+
+ assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(),
+ networkStack)).isNull();
}
@Test
public void testNetworkPassedDoesNotRollback_Phase2() throws Exception {
- assertNetworkStackRollbackAvailable();
+ RollbackManager rm = RollbackUtils.getRollbackManager();
+ assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(),
+ getNetworkStackPackageName())).isNotNull();
}
@Test
public void testNetworkPassedDoesNotRollback_Phase3() throws Exception {
- assertNoNetworkStackRollbackCommitted();
+ RollbackManager rm = RollbackUtils.getRollbackManager();
+ assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(),
+ getNetworkStackPackageName())).isNull();
}
@Nullable
@@ -328,7 +349,8 @@
}
private void runShellCommand(String cmd) {
- InstrumentationRegistry.getInstrumentation().getUiAutomation()
+ ParcelFileDescriptor pfd = InstrumentationRegistry.getInstrumentation().getUiAutomation()
.executeShellCommand(cmd);
+ IoUtils.closeQuietly(pfd);
}
}
diff --git a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java
index 57f211d..c10169b 100644
--- a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java
+++ b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java
@@ -17,6 +17,7 @@
package com.android.tests.rollback.host;
import static org.junit.Assert.assertTrue;
+import static org.testng.Assert.assertThrows;
import com.android.ddmlib.Log.LogLevel;
import com.android.tradefed.log.LogUtil.CLog;
@@ -94,7 +95,6 @@
// Reboot device to activate staged package
getDevice().reboot();
- getDevice().waitForDeviceAvailable();
runPhase("testNativeWatchdogTriggersRollback_Phase2");
@@ -125,7 +125,7 @@
runPhase("testNetworkFailedRollback_Phase1");
// Reduce health check deadline
getDevice().executeShellCommand("device_config put rollback "
- + "watchdog_request_timeout_millis 300000");
+ + "watchdog_request_timeout_millis 120000");
// Simulate re-installation of new NetworkStack with rollbacks enabled
getDevice().executeShellCommand("pm install -r --staged --enable-rollback "
+ "/system/priv-app/NetworkStack/NetworkStack.apk");
@@ -134,26 +134,10 @@
Thread.sleep(5000);
// Reboot device to activate staged package
getDevice().reboot();
- getDevice().waitForDeviceAvailable();
// Verify rollback was enabled
runPhase("testNetworkFailedRollback_Phase2");
-
- // Sleep for < health check deadline
- Thread.sleep(5000);
- // Verify rollback was not executed before health check deadline
- runPhase("testNetworkFailedRollback_Phase3");
- try {
- // This is expected to fail due to the device being rebooted out
- // from underneath the test. If this fails for reasons other than
- // the device reboot, those failures should result in failure of
- // the testNetworkFailedRollback_Phase4 phase.
- CLog.logAndDisplay(LogLevel.INFO, "Sleep and expect to fail while sleeping");
- // Sleep for > health check deadline
- Thread.sleep(260000);
- } catch (AssertionError e) {
- // AssertionError is expected.
- }
+ assertThrows(AssertionError.class, () -> runPhase("testNetworkFailedRollback_Phase3"));
getDevice().waitForDeviceAvailable();
// Verify rollback was executed after health check deadline
@@ -180,7 +164,6 @@
Thread.sleep(5000);
// Reboot device to activate staged package
getDevice().reboot();
- getDevice().waitForDeviceAvailable();
// Verify rollback was enabled
runPhase("testNetworkPassedDoesNotRollback_Phase2");
diff --git a/tests/net/Android.bp b/tests/net/Android.bp
index beb5e0d..10f27e2 100644
--- a/tests/net/Android.bp
+++ b/tests/net/Android.bp
@@ -37,14 +37,18 @@
"libvndksupport",
"libziparchive",
"libz",
- "netd_aidl_interface-V2-cpp",
+ "netd_aidl_interface-cpp",
],
}
android_test {
name: "FrameworksNetTests",
defaults: ["FrameworksNetTests-jni-defaults"],
- srcs: ["java/**/*.java", "java/**/*.kt"],
+ srcs: [
+ ":tethering-tests-src",
+ "java/**/*.java",
+ "java/**/*.kt",
+ ],
platform_apis: true,
test_suites: ["device-tests"],
certificate: "platform",
diff --git a/tests/net/common/java/android/net/NetworkCapabilitiesTest.java b/tests/net/common/java/android/net/NetworkCapabilitiesTest.java
index 2ca0d1a8..1569112 100644
--- a/tests/net/common/java/android/net/NetworkCapabilitiesTest.java
+++ b/tests/net/common/java/android/net/NetworkCapabilitiesTest.java
@@ -271,7 +271,7 @@
.addCapability(NET_CAPABILITY_NOT_METERED);
assertParcelingIsLossless(netCap);
netCap.setSSID(TEST_SSID);
- assertParcelSane(netCap, 11);
+ assertParcelSane(netCap, 12);
}
@Test
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index 46e27c1..1f2bb0a 100644
--- a/tests/net/java/android/net/netlink/InetDiagSocketTest.java
+++ b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
@@ -30,6 +30,7 @@
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import android.app.Instrumentation;
import android.content.Context;
@@ -283,6 +284,107 @@
assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_BYTES, msg);
}
+ // Hexadecimal representation of InetDiagReqV2 request with extension, INET_DIAG_INFO.
+ private static final String INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_HEX =
+ // struct nlmsghdr
+ "48000000" + // length = 72
+ "1400" + // type = SOCK_DIAG_BY_FAMILY
+ "0100" + // flags = NLM_F_REQUEST
+ "00000000" + // seqno
+ "00000000" + // pid (0 == kernel)
+ // struct inet_diag_req_v2
+ "02" + // family = AF_INET
+ "06" + // protcol = IPPROTO_TCP
+ "02" + // idiag_ext = INET_DIAG_INFO
+ "00" + // pad
+ "ffffffff" + // idiag_states
+ // inet_diag_sockid
+ "3039" + // idiag_sport = 12345
+ "d431" + // idiag_dport = 54321
+ "01020304000000000000000000000000" + // idiag_src = 1.2.3.4
+ "08080404000000000000000000000000" + // idiag_dst = 8.8.4.4
+ "00000000" + // idiag_if
+ "ffffffffffffffff"; // idiag_cookie = INET_DIAG_NOCOOKIE
+
+ private static final byte[] INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_BYTES =
+ HexEncoding.decode(INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_HEX.toCharArray(), false);
+ private static final int TCP_ALL_STATES = 0xffffffff;
+ @Test
+ public void testInetDiagReqV2TcpInetWithExt() throws Exception {
+ InetSocketAddress local = new InetSocketAddress(
+ InetAddress.getByName("1.2.3.4"), 12345);
+ InetSocketAddress remote = new InetSocketAddress(InetAddress.getByName("8.8.4.4"),
+ 54321);
+ byte[] msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, local, remote, AF_INET,
+ NLM_F_REQUEST, 0 /* pad */, 2 /* idiagExt */, TCP_ALL_STATES);
+
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_BYTES, msg);
+
+ local = new InetSocketAddress(
+ InetAddress.getByName("fe80::86c9:b2ff:fe6a:ed4b"), 42462);
+ remote = new InetSocketAddress(InetAddress.getByName("8.8.8.8"),
+ 47473);
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, local, remote, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_BYTES, msg);
+ }
+
+ // Hexadecimal representation of InetDiagReqV2 request with no socket specified.
+ private static final String INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFIED_HEX =
+ // struct nlmsghdr
+ "48000000" + // length = 72
+ "1400" + // type = SOCK_DIAG_BY_FAMILY
+ "0100" + // flags = NLM_F_REQUEST
+ "00000000" + // seqno
+ "00000000" + // pid (0 == kernel)
+ // struct inet_diag_req_v2
+ "0a" + // family = AF_INET6
+ "06" + // protcol = IPPROTO_TCP
+ "00" + // idiag_ext
+ "00" + // pad
+ "ffffffff" + // idiag_states
+ // inet_diag_sockid
+ "0000" + // idiag_sport
+ "0000" + // idiag_dport
+ "00000000000000000000000000000000" + // idiag_src
+ "00000000000000000000000000000000" + // idiag_dst
+ "00000000" + // idiag_if
+ "0000000000000000"; // idiag_cookie
+
+ private static final byte[] INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFED_BYTES =
+ HexEncoding.decode(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFIED_HEX.toCharArray(), false);
+
+ @Test
+ public void testInetDiagReqV2TcpInet6NoIdSpecified() throws Exception {
+ InetSocketAddress local = new InetSocketAddress(
+ InetAddress.getByName("fe80::fe6a:ed4b"), 12345);
+ InetSocketAddress remote = new InetSocketAddress(InetAddress.getByName("8.8.4.4"),
+ 54321);
+ // Verify no socket specified if either local or remote socket address is null.
+ byte[] msgExt = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, null, null, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+ byte[] msg;
+ try {
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, null, remote, AF_INET6,
+ NLM_F_REQUEST);
+ fail("Both remote and local should be null, expected UnknownHostException");
+ } catch (NullPointerException e) {
+ }
+
+ try {
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, local, null, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+ fail("Both remote and local should be null, expected UnknownHostException");
+ } catch (NullPointerException e) {
+ }
+
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, null, null, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFED_BYTES, msg);
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFED_BYTES, msgExt);
+ }
+
// Hexadecimal representation of InetDiagReqV2 request.
private static final String INET_DIAG_MSG_HEX =
// struct nlmsghdr
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index cf3fba8..61f37fd 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -33,6 +33,7 @@
import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_FALLBACK;
import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_HTTP;
import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_HTTPS;
+import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_PRIVDNS;
import static android.net.INetworkMonitor.NETWORK_VALIDATION_RESULT_PARTIAL;
import static android.net.INetworkMonitor.NETWORK_VALIDATION_RESULT_VALID;
import static android.net.NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL;
@@ -492,6 +493,8 @@
private INetworkMonitor mNetworkMonitor;
private INetworkMonitorCallbacks mNmCallbacks;
private int mNmValidationResult = VALIDATION_RESULT_BASE;
+ private int mProbesCompleted;
+ private int mProbesSucceeded;
private String mNmValidationRedirectUrl = null;
private boolean mNmProvNotificationRequested = false;
@@ -559,6 +562,7 @@
mNmProvNotificationRequested = false;
}
+ mNmCallbacks.notifyProbeStatusChanged(mProbesCompleted, mProbesSucceeded);
mNmCallbacks.notifyNetworkTested(
mNmValidationResult, mNmValidationRedirectUrl);
@@ -581,7 +585,7 @@
* @param validated Indicate if network should pretend to be validated.
*/
public void connect(boolean validated) {
- connect(validated, true);
+ connect(validated, true, false /* isStrictMode */);
}
/**
@@ -589,13 +593,13 @@
* @param validated Indicate if network should pretend to be validated.
* @param hasInternet Indicate if network should pretend to have NET_CAPABILITY_INTERNET.
*/
- public void connect(boolean validated, boolean hasInternet) {
+ public void connect(boolean validated, boolean hasInternet, boolean isStrictMode) {
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_INTERNET));
ConnectivityManager.NetworkCallback callback = null;
final ConditionVariable validatedCv = new ConditionVariable();
if (validated) {
- setNetworkValid();
+ setNetworkValid(isStrictMode);
NetworkRequest request = new NetworkRequest.Builder()
.addTransportType(getNetworkCapabilities().getTransportTypes()[0])
.clearCapabilities()
@@ -620,15 +624,15 @@
if (validated) {
// Wait for network to validate.
waitFor(validatedCv);
- setNetworkInvalid();
+ setNetworkInvalid(isStrictMode);
}
if (callback != null) mCm.unregisterNetworkCallback(callback);
}
- public void connectWithCaptivePortal(String redirectUrl) {
- setNetworkPortal(redirectUrl);
- connect(false);
+ public void connectWithCaptivePortal(String redirectUrl, boolean isStrictMode) {
+ setNetworkPortal(redirectUrl, isStrictMode);
+ connect(false, true /* hasInternet */, isStrictMode);
}
public void connectWithPartialConnectivity() {
@@ -636,34 +640,75 @@
connect(false);
}
- public void connectWithPartialValidConnectivity() {
- setNetworkPartialValid();
- connect(false);
+ public void connectWithPartialValidConnectivity(boolean isStrictMode) {
+ setNetworkPartialValid(isStrictMode);
+ connect(false, true /* hasInternet */, isStrictMode);
}
- void setNetworkValid() {
+ void setNetworkValid(boolean isStrictMode) {
mNmValidationResult = VALIDATION_RESULT_VALID;
mNmValidationRedirectUrl = null;
+ int probesSucceeded = VALIDATION_RESULT_BASE & ~NETWORK_VALIDATION_PROBE_HTTP;
+ if (isStrictMode) {
+ probesSucceeded |= NETWORK_VALIDATION_PROBE_PRIVDNS;
+ }
+ // The probesCompleted equals to probesSucceeded for the case of valid network, so put
+ // the same value into two different parameter of the method.
+ setProbesStatus(probesSucceeded, probesSucceeded);
}
- void setNetworkInvalid() {
+ void setNetworkInvalid(boolean isStrictMode) {
mNmValidationResult = VALIDATION_RESULT_INVALID;
mNmValidationRedirectUrl = null;
+ int probesCompleted = VALIDATION_RESULT_BASE;
+ int probesSucceeded = VALIDATION_RESULT_INVALID;
+ // If the isStrictMode is true, it means the network is invalid when NetworkMonitor
+ // tried to validate the private DNS but failed.
+ if (isStrictMode) {
+ probesCompleted &= ~NETWORK_VALIDATION_PROBE_HTTP;
+ probesSucceeded = probesCompleted;
+ probesCompleted |= NETWORK_VALIDATION_PROBE_PRIVDNS;
+ }
+ setProbesStatus(probesCompleted, probesSucceeded);
}
- void setNetworkPortal(String redirectUrl) {
- setNetworkInvalid();
+ void setNetworkPortal(String redirectUrl, boolean isStrictMode) {
+ setNetworkInvalid(isStrictMode);
mNmValidationRedirectUrl = redirectUrl;
+ // Suppose the portal is found when NetworkMonitor probes NETWORK_VALIDATION_PROBE_HTTP
+ // in the beginning, so the NETWORK_VALIDATION_PROBE_HTTPS hasn't probed yet.
+ int probesCompleted = VALIDATION_RESULT_BASE & ~NETWORK_VALIDATION_PROBE_HTTPS;
+ int probesSucceeded = VALIDATION_RESULT_INVALID;
+ if (isStrictMode) {
+ probesCompleted |= NETWORK_VALIDATION_PROBE_PRIVDNS;
+ }
+ setProbesStatus(probesCompleted, probesSucceeded);
}
void setNetworkPartial() {
mNmValidationResult = VALIDATION_RESULT_PARTIAL;
mNmValidationRedirectUrl = null;
+ int probesCompleted = VALIDATION_RESULT_BASE;
+ int probesSucceeded = VALIDATION_RESULT_BASE & ~NETWORK_VALIDATION_PROBE_HTTPS;
+ setProbesStatus(probesCompleted, probesSucceeded);
}
- void setNetworkPartialValid() {
- mNmValidationResult = VALIDATION_RESULT_PARTIAL | VALIDATION_RESULT_VALID;
- mNmValidationRedirectUrl = null;
+ void setNetworkPartialValid(boolean isStrictMode) {
+ setNetworkPartial();
+ mNmValidationResult |= VALIDATION_RESULT_VALID;
+ int probesCompleted = VALIDATION_RESULT_BASE;
+ int probesSucceeded = VALIDATION_RESULT_BASE & ~NETWORK_VALIDATION_PROBE_HTTPS;
+ // Suppose the partial network cannot pass the private DNS validation as well, so only
+ // add NETWORK_VALIDATION_PROBE_DNS in probesCompleted but not probesSucceeded.
+ if (isStrictMode) {
+ probesCompleted |= NETWORK_VALIDATION_PROBE_PRIVDNS;
+ }
+ setProbesStatus(probesCompleted, probesSucceeded);
+ }
+
+ void setProbesStatus(int probesCompleted, int probesSucceeded) {
+ mProbesCompleted = probesCompleted;
+ mProbesSucceeded = probesSucceeded;
}
public String waitForRedirectUrl() {
@@ -2226,7 +2271,7 @@
// With HTTPS probe disabled, NetworkMonitor should pass the network validation with http
// probe.
- mWiFiNetworkAgent.setNetworkPartialValid();
+ mWiFiNetworkAgent.setNetworkPartialValid(false /* isStrictMode */);
// If the user chooses yes to use this partial connectivity wifi, switch the default
// network to wifi and check if wifi becomes valid or not.
mCm.setAcceptPartialConnectivity(mWiFiNetworkAgent.getNetwork(), true /* accept */,
@@ -2299,7 +2344,7 @@
callback.expectCallback(CallbackEntry.LOSING, mCellNetworkAgent);
assertEquals(mWiFiNetworkAgent.getNetwork(), mCm.getActiveNetwork());
callback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY, mWiFiNetworkAgent);
- mWiFiNetworkAgent.setNetworkValid();
+ mWiFiNetworkAgent.setNetworkValid(false /* isStrictMode */);
// Need a trigger point to let NetworkMonitor tell ConnectivityService that network is
// validated.
@@ -2317,7 +2362,7 @@
// NetworkMonitor will immediately (once the HTTPS probe fails...) report the network as
// valid, because ConnectivityService calls setAcceptPartialConnectivity before it calls
// notifyNetworkConnected.
- mWiFiNetworkAgent.connectWithPartialValidConnectivity();
+ mWiFiNetworkAgent.connectWithPartialValidConnectivity(false /* isStrictMode */);
callback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
verify(mWiFiNetworkAgent.mNetworkMonitor, times(1)).setAcceptPartialConnectivity();
callback.expectCallback(CallbackEntry.LOSING, mCellNetworkAgent);
@@ -2343,7 +2388,7 @@
// Expect onAvailable callback of listen for NET_CAPABILITY_CAPTIVE_PORTAL.
mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
String redirectUrl = "http://android.com/path";
- mWiFiNetworkAgent.connectWithCaptivePortal(redirectUrl);
+ mWiFiNetworkAgent.connectWithCaptivePortal(redirectUrl, false /* isStrictMode */);
captivePortalCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
assertEquals(mWiFiNetworkAgent.waitForRedirectUrl(), redirectUrl);
@@ -2361,7 +2406,7 @@
mWiFiNetworkAgent);
// Report partial connectivity is accepted.
- mWiFiNetworkAgent.setNetworkPartialValid();
+ mWiFiNetworkAgent.setNetworkPartialValid(false /* isStrictMode */);
mCm.setAcceptPartialConnectivity(mWiFiNetworkAgent.getNetwork(), true /* accept */,
false /* always */);
waitForIdle();
@@ -2392,7 +2437,7 @@
// Expect onAvailable callback of listen for NET_CAPABILITY_CAPTIVE_PORTAL.
mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
String firstRedirectUrl = "http://example.com/firstPath";
- mWiFiNetworkAgent.connectWithCaptivePortal(firstRedirectUrl);
+ mWiFiNetworkAgent.connectWithCaptivePortal(firstRedirectUrl, false /* isStrictMode */);
captivePortalCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
assertEquals(mWiFiNetworkAgent.waitForRedirectUrl(), firstRedirectUrl);
@@ -2405,13 +2450,13 @@
// Expect onAvailable callback of listen for NET_CAPABILITY_CAPTIVE_PORTAL.
mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
String secondRedirectUrl = "http://example.com/secondPath";
- mWiFiNetworkAgent.connectWithCaptivePortal(secondRedirectUrl);
+ mWiFiNetworkAgent.connectWithCaptivePortal(secondRedirectUrl, false /* isStrictMode */);
captivePortalCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
assertEquals(mWiFiNetworkAgent.waitForRedirectUrl(), secondRedirectUrl);
// Make captive portal disappear then revalidate.
// Expect onLost callback because network no longer provides NET_CAPABILITY_CAPTIVE_PORTAL.
- mWiFiNetworkAgent.setNetworkValid();
+ mWiFiNetworkAgent.setNetworkValid(false /* isStrictMode */);
mCm.reportNetworkConnectivity(mWiFiNetworkAgent.getNetwork(), true);
captivePortalCallback.expectCallback(CallbackEntry.LOST, mWiFiNetworkAgent);
@@ -2423,7 +2468,7 @@
// Break network connectivity.
// Expect NET_CAPABILITY_VALIDATED onLost callback.
- mWiFiNetworkAgent.setNetworkInvalid();
+ mWiFiNetworkAgent.setNetworkInvalid(false /* isStrictMode */);
mCm.reportNetworkConnectivity(mWiFiNetworkAgent.getNetwork(), false);
validatedCallback.expectCallback(CallbackEntry.LOST, mWiFiNetworkAgent);
}
@@ -2454,7 +2499,7 @@
mServiceContext.expectNoStartActivityIntent(fastTimeoutMs);
// Turn into a captive portal.
- mWiFiNetworkAgent.setNetworkPortal("http://example.com");
+ mWiFiNetworkAgent.setNetworkPortal("http://example.com", false /* isStrictMode */);
mCm.reportNetworkConnectivity(wifiNetwork, false);
captivePortalCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
validatedCallback.expectCallback(CallbackEntry.LOST, mWiFiNetworkAgent);
@@ -2475,7 +2520,7 @@
assertEquals(testValue, signInIntent.getStringExtra(testKey));
// Report that the captive portal is dismissed, and check that callbacks are fired
- mWiFiNetworkAgent.setNetworkValid();
+ mWiFiNetworkAgent.setNetworkValid(false /* isStrictMode */);
mWiFiNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
validatedCallback.expectAvailableCallbacksValidated(mWiFiNetworkAgent);
captivePortalCallback.expectCallback(CallbackEntry.LOST, mWiFiNetworkAgent);
@@ -2504,7 +2549,7 @@
mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
String firstRedirectUrl = "http://example.com/firstPath";
- mWiFiNetworkAgent.connectWithCaptivePortal(firstRedirectUrl);
+ mWiFiNetworkAgent.connectWithCaptivePortal(firstRedirectUrl, false /* isStrictMode */);
mWiFiNetworkAgent.expectDisconnected();
mWiFiNetworkAgent.expectPreventReconnectReceived();
@@ -3219,7 +3264,7 @@
Network wifiNetwork = mWiFiNetworkAgent.getNetwork();
// Fail validation on wifi.
- mWiFiNetworkAgent.setNetworkInvalid();
+ mWiFiNetworkAgent.setNetworkInvalid(false /* isStrictMode */);
mCm.reportNetworkConnectivity(wifiNetwork, false);
defaultCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiNetworkAgent);
validatedWifiCallback.expectCallback(CallbackEntry.LOST, mWiFiNetworkAgent);
@@ -3263,7 +3308,7 @@
wifiNetwork = mWiFiNetworkAgent.getNetwork();
// Fail validation on wifi and expect the dialog to appear.
- mWiFiNetworkAgent.setNetworkInvalid();
+ mWiFiNetworkAgent.setNetworkInvalid(false /* isStrictMode */);
mCm.reportNetworkConnectivity(wifiNetwork, false);
defaultCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiNetworkAgent);
validatedWifiCallback.expectCallback(CallbackEntry.LOST, mWiFiNetworkAgent);
@@ -4299,7 +4344,7 @@
mCm.registerNetworkCallback(request, callback);
// Bring up wifi aware network.
- wifiAware.connect(false, false);
+ wifiAware.connect(false, false, false /* isStrictMode */);
callback.expectAvailableCallbacksUnvalidated(wifiAware);
assertNull(mCm.getActiveNetworkInfo());
@@ -4537,6 +4582,44 @@
}
@Test
+ public void testPrivateDnsNotification() throws Exception {
+ NetworkRequest request = new NetworkRequest.Builder()
+ .clearCapabilities().addCapability(NET_CAPABILITY_INTERNET)
+ .build();
+ TestNetworkCallback callback = new TestNetworkCallback();
+ mCm.registerNetworkCallback(request, callback);
+ // Bring up wifi.
+ mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
+ mWiFiNetworkAgent.connect(false);
+ callback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
+ // Private DNS resolution failed, checking if the notification will be shown or not.
+ mWiFiNetworkAgent.setNetworkInvalid(true /* isStrictMode */);
+ mWiFiNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
+ waitForIdle();
+ // If network validation failed, NetworkMonitor will re-evaluate the network.
+ // ConnectivityService should filter the redundant notification. This part is trying to
+ // simulate that situation and check if ConnectivityService could filter that case.
+ mWiFiNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
+ waitForIdle();
+ verify(mNotificationManager, timeout(TIMEOUT_MS).times(1)).notifyAsUser(anyString(),
+ eq(NotificationType.PRIVATE_DNS_BROKEN.eventId), any(), eq(UserHandle.ALL));
+ // If private DNS resolution successful, the PRIVATE_DNS_BROKEN notification shouldn't be
+ // shown.
+ mWiFiNetworkAgent.setNetworkValid(true /* isStrictMode */);
+ mWiFiNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
+ waitForIdle();
+ verify(mNotificationManager, timeout(TIMEOUT_MS).times(1)).cancelAsUser(anyString(),
+ eq(NotificationType.PRIVATE_DNS_BROKEN.eventId), eq(UserHandle.ALL));
+ // If private DNS resolution failed again, the PRIVATE_DNS_BROKEN notification should be
+ // shown again.
+ mWiFiNetworkAgent.setNetworkInvalid(true /* isStrictMode */);
+ mWiFiNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
+ waitForIdle();
+ verify(mNotificationManager, timeout(TIMEOUT_MS).times(2)).notifyAsUser(anyString(),
+ eq(NotificationType.PRIVATE_DNS_BROKEN.eventId), any(), eq(UserHandle.ALL));
+ }
+
+ @Test
public void testPrivateDnsSettingsChange() throws Exception {
// Clear any interactions that occur as a result of CS starting up.
reset(mMockDnsResolver);
@@ -4793,7 +4876,7 @@
// by NetworkMonitor
assertFalse(NetworkMonitorUtils.isValidationRequired(
vpnNetworkAgent.getNetworkCapabilities()));
- vpnNetworkAgent.setNetworkValid();
+ vpnNetworkAgent.setNetworkValid(false /* isStrictMode */);
vpnNetworkAgent.connect(false);
mMockVpn.connect();
@@ -4882,7 +4965,8 @@
ranges.add(new UidRange(uid, uid));
mMockVpn.setNetworkAgent(vpnNetworkAgent);
mMockVpn.setUids(ranges);
- vpnNetworkAgent.connect(true /* validated */, false /* hasInternet */);
+ vpnNetworkAgent.connect(true /* validated */, false /* hasInternet */,
+ false /* isStrictMode */);
mMockVpn.connect();
defaultCallback.assertNoCallback();
@@ -4913,7 +4997,8 @@
ranges.add(new UidRange(uid, uid));
mMockVpn.setNetworkAgent(vpnNetworkAgent);
mMockVpn.setUids(ranges);
- vpnNetworkAgent.connect(true /* validated */, true /* hasInternet */);
+ vpnNetworkAgent.connect(true /* validated */, true /* hasInternet */,
+ false /* isStrictMode */);
mMockVpn.connect();
defaultCallback.expectAvailableThenValidatedCallbacks(vpnNetworkAgent);
@@ -4945,7 +5030,8 @@
ranges.add(new UidRange(uid, uid));
mMockVpn.setNetworkAgent(vpnNetworkAgent);
mMockVpn.setUids(ranges);
- vpnNetworkAgent.connect(false /* validated */, true /* hasInternet */);
+ vpnNetworkAgent.connect(false /* validated */, true /* hasInternet */,
+ false /* isStrictMode */);
mMockVpn.connect();
// Even though the VPN is unvalidated, it becomes the default network for our app.
@@ -4968,7 +5054,7 @@
vpnNetworkAgent.getNetworkCapabilities()));
// Pretend that the VPN network validates.
- vpnNetworkAgent.setNetworkValid();
+ vpnNetworkAgent.setNetworkValid(false /* isStrictMode */);
vpnNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
// Expect to see the validated capability, but no other changes, because the VPN is already
// the default network for the app.
@@ -5000,7 +5086,8 @@
mMockVpn.setNetworkAgent(vpnNetworkAgent);
mMockVpn.connect();
mMockVpn.setUids(ranges);
- vpnNetworkAgent.connect(true /* validated */, false /* hasInternet */);
+ vpnNetworkAgent.connect(true /* validated */, false /* hasInternet */,
+ false /* isStrictMode */);
vpnNetworkCallback.expectAvailableThenValidatedCallbacks(vpnNetworkAgent);
nc = mCm.getNetworkCapabilities(vpnNetworkAgent.getNetwork());
@@ -5099,7 +5186,8 @@
mMockVpn.setNetworkAgent(vpnNetworkAgent);
mMockVpn.connect();
mMockVpn.setUids(ranges);
- vpnNetworkAgent.connect(true /* validated */, false /* hasInternet */);
+ vpnNetworkAgent.connect(true /* validated */, false /* hasInternet */,
+ false /* isStrictMode */);
vpnNetworkCallback.expectAvailableThenValidatedCallbacks(vpnNetworkAgent);
nc = mCm.getNetworkCapabilities(vpnNetworkAgent.getNetwork());
diff --git a/tests/testables/src/android/testing/TestableSettingsProvider.java b/tests/testables/src/android/testing/TestableSettingsProvider.java
index b158476..fd92c65 100644
--- a/tests/testables/src/android/testing/TestableSettingsProvider.java
+++ b/tests/testables/src/android/testing/TestableSettingsProvider.java
@@ -14,6 +14,8 @@
package android.testing;
+import static org.junit.Assert.assertEquals;
+
import android.content.ContentProviderClient;
import android.content.Context;
import android.os.Bundle;
@@ -25,8 +27,6 @@
import java.util.HashMap;
-import static org.junit.Assert.*;
-
/**
* Allows calls to android.provider.Settings to be tested easier.
*
@@ -71,7 +71,7 @@
public Bundle call(String method, String arg, Bundle extras) {
// Methods are "GET_system", "GET_global", "PUT_secure", etc.
- final int userId = extras.getInt(Settings.CALL_METHOD_USER_KEY, 0);
+ final int userId = extras.getInt(Settings.CALL_METHOD_USER_KEY, UserHandle.myUserId());
final String[] commands = method.split("_", 2);
final String op = commands[0];
final String table = commands[1];
diff --git a/tools/aapt2/format/Container.cpp b/tools/aapt2/format/Container.cpp
index f189048..9cef7b3 100644
--- a/tools/aapt2/format/Container.cpp
+++ b/tools/aapt2/format/Container.cpp
@@ -30,6 +30,7 @@
constexpr const static uint32_t kContainerFormatMagic = 0x54504141u;
constexpr const static uint32_t kContainerFormatVersion = 1u;
+constexpr const static size_t kPaddingAlignment = 4u;
ContainerWriter::ContainerWriter(ZeroCopyOutputStream* out, size_t entry_count)
: out_(out), total_entry_count_(entry_count), current_entry_count_(0u) {
@@ -49,11 +50,17 @@
}
}
-inline static void WritePadding(int padding, CodedOutputStream* out) {
- if (padding < 4) {
- const uint32_t zero = 0u;
- out->WriteRaw(&zero, padding);
- }
+inline static size_t CalculatePaddingForAlignment(size_t size) {
+ size_t overage = size % kPaddingAlignment;
+ return overage == 0 ? 0 : kPaddingAlignment - overage;
+}
+
+inline static void WritePadding(size_t padding, CodedOutputStream* out) {
+ CHECK(padding < kPaddingAlignment);
+ const uint32_t zero = 0u;
+ static_assert(sizeof(zero) >= kPaddingAlignment, "Not enough source bytes for padding");
+
+ out->WriteRaw(&zero, padding);
}
bool ContainerWriter::AddResTableEntry(const pb::ResourceTable& table) {
@@ -70,7 +77,7 @@
// Write the aligned size.
const ::google::protobuf::uint64 size = table.ByteSize();
- const int padding = 4 - (size % 4);
+ const int padding = CalculatePaddingForAlignment(size);
coded_out.WriteLittleEndian64(size);
// Write the table.
@@ -103,9 +110,9 @@
// Write the aligned size.
const ::google::protobuf::uint32 header_size = file.ByteSize();
- const int header_padding = 4 - (header_size % 4);
+ const int header_padding = CalculatePaddingForAlignment(header_size);
const ::google::protobuf::uint64 data_size = in->TotalSize();
- const int data_padding = 4 - (data_size % 4);
+ const int data_padding = CalculatePaddingForAlignment(data_size);
coded_out.WriteLittleEndian64(kResFileEntryHeaderSize + header_size + header_padding + data_size +
data_padding);
diff --git a/tools/aapt2/formats.md b/tools/aapt2/formats.md
index bb31a00..25a0e79 100644
--- a/tools/aapt2/formats.md
+++ b/tools/aapt2/formats.md
@@ -23,7 +23,7 @@
| Size (in bytes) | Field | Description |
|:----------------|:---------------|:----------------------------------------------------------------------------------------------------------|
| `4` | `entry_type` | The type of the entry. This can be one of two types: `RES_TABLE (0x00000000)` or `RES_FILE (0x00000001)`. |
-| `8` | `entry_length` | The length of the data that follows. |
+| `8` | `entry_length` | The length of the data that follows. Do not use if `entry_type` is `RES_FILE`; this value may be wrong. |
| `entry_length` | `data` | The payload. The contents of this varies based on the `entry_type`. |
If the `entry_type` is equal to `RES_TABLE (0x00000000)`, the `data` field contains a serialized
@@ -32,13 +32,14 @@
If the `entry_type` is equal to `RES_FILE (0x00000001)`, the `data` field contains the following:
-| Size (in bytes) | Field | Description |
-|:----------------|:---------------|:----------------------------------------------------------------------------------------------------------|
-| `4` | `header_size` | The size of the `header` field. |
-| `8` | `data_size` | The size of the `data` field. |
-| `header_size` | `header` | The serialized Protobuf message [aapt.pb.internal.CompiledFile](ResourcesInternal.proto). |
-| `x` | `padding` | Up to 4 bytes of zeros, if padding is necessary to align the `data` field on a 32-bit boundary. |
-| `data_size` | `data` | The payload, which is determined by the `type` field in the `aapt.pb.internal.CompiledFile`. This can be a PNG file, binary XML, or [aapt.pb.XmlNode](Resources.proto). |
+| Size (in bytes) | Field | Description |
+|:----------------|:-----------------|:----------------------------------------------------------------------------------------------------------|
+| `4` | `header_size` | The size of the `header` field. |
+| `8` | `data_size` | The size of the `data` field. |
+| `header_size` | `header` | The serialized Protobuf message [aapt.pb.internal.CompiledFile](ResourcesInternal.proto). |
+| `x` | `header_padding` | Up to 3 bytes of zeros, if padding is necessary to align the `data` field on a 32-bit boundary. |
+| `data_size` | `data` | The payload, which is determined by the `type` field in the `aapt.pb.internal.CompiledFile`. This can be a PNG file, binary XML, or [aapt.pb.XmlNode](Resources.proto). |
+| `y` | `data_padding` | Up to 3 bytes of zeros, if `data_size` is not a multiple of 4. |
## AAPT2 Static Library Format (extension `.sapk`)
diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp
index d80c2e7..fd184f5 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -708,10 +708,12 @@
}
}
+
// Figure out whether we need to sync the system and which apks to install
string deviceTargetPath = buildOut + "/target/product/" + buildDevice;
string systemPath = deviceTargetPath + "/system/";
string dataPath = deviceTargetPath + "/data/";
+ string testPath = deviceTargetPath + "/testcases/";
bool syncSystem = false;
bool alwaysSyncSystem = false;
vector<string> systemFiles;
@@ -734,7 +736,8 @@
continue;
}
// Apk in the data partition
- if (starts_with(file, dataPath) && ends_with(file, ".apk")) {
+ if (ends_with(file, ".apk")
+ && (starts_with(file, dataPath) || starts_with(file, testPath))) {
// Always install it if we didn't build it because otherwise
// it will never have changed.
installApks.push_back(InstallApk(file, !target->build));
@@ -966,8 +969,9 @@
for (size_t j=0; j<target->module.installed.size(); j++) {
string filename = target->module.installed[j];
- // Apk in the data partition
- if (!starts_with(filename, dataPath) || !ends_with(filename, ".apk")) {
+ // Skip of not apk in the data partition or test
+ if (!(ends_with(filename, ".apk")
+ && (starts_with(filename, dataPath) || starts_with(filename, testPath)))) {
continue;
}
diff --git a/tools/codegen/src/com/android/codegen/Generators.kt b/tools/codegen/src/com/android/codegen/Generators.kt
index 431f378..bd32f9c 100644
--- a/tools/codegen/src/com/android/codegen/Generators.kt
+++ b/tools/codegen/src/com/android/codegen/Generators.kt
@@ -212,13 +212,15 @@
"Object"
}
+ val maybeFinal = if_(classAst.isFinal, "final ")
+
+"/**"
+" * A builder for {@link $ClassName}"
if (FeatureFlag.BUILDER.hidden) +" * @hide"
+" */"
+"@SuppressWarnings(\"WeakerAccess\")"
+GENERATED_MEMBER_HEADER
- !"public static class $BuilderClass$genericArgs"
+ !"public static ${maybeFinal}class $BuilderClass$genericArgs"
if (BuilderSupertype != "Object") {
appendSameLine(" extends $BuilderSupertype")
}
@@ -359,7 +361,7 @@
private fun ClassPrinter.generateBuilderBuild() {
+"/** Builds the instance. This builder should not be touched after calling this! */"
- "public $ClassType build()" {
+ "public @$NonNull $ClassType build()" {
+"checkNotUsed();"
+"mBuilderFieldsSet |= ${bitAtExpr(fields.size)}; // Mark builder used"
+""
diff --git a/tools/codegen/src/com/android/codegen/SharedConstants.kt b/tools/codegen/src/com/android/codegen/SharedConstants.kt
index 3eb9e7b..270d34a 100644
--- a/tools/codegen/src/com/android/codegen/SharedConstants.kt
+++ b/tools/codegen/src/com/android/codegen/SharedConstants.kt
@@ -1,7 +1,7 @@
package com.android.codegen
const val CODEGEN_NAME = "codegen"
-const val CODEGEN_VERSION = "1.0.9"
+const val CODEGEN_VERSION = "1.0.11"
const val CANONICAL_BUILDER_CLASS = "Builder"
const val BASE_BUILDER_CLASS = "BaseBuilder"
diff --git a/tools/stats_log_api_gen/Android.bp b/tools/stats_log_api_gen/Android.bp
index 4ce4406..c08f9b0 100644
--- a/tools/stats_log_api_gen/Android.bp
+++ b/tools/stats_log_api_gen/Android.bp
@@ -95,7 +95,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "libstatslog",
host_supported: true,
generated_sources: ["statslog.cpp"],
diff --git a/wifi/java/android/net/wifi/ISoftApCallback.aidl b/wifi/java/android/net/wifi/ISoftApCallback.aidl
index b8d2971..8a252dd 100644
--- a/wifi/java/android/net/wifi/ISoftApCallback.aidl
+++ b/wifi/java/android/net/wifi/ISoftApCallback.aidl
@@ -16,6 +16,8 @@
package android.net.wifi;
+import android.net.wifi.WifiClient;
+
/**
* Interface for Soft AP callback.
*
@@ -36,9 +38,9 @@
void onStateChanged(int state, int failureReason);
/**
- * Service to manager callback providing number of connected clients.
+ * Service to manager callback providing connected client's information.
*
- * @param numClients number of connected clients
+ * @param clients the currently connected clients
*/
- void onNumClientsChanged(int numClients);
+ void onConnectedClientsChanged(in List<WifiClient> clients);
}
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 1337739..19be132 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -94,6 +94,8 @@
boolean disableNetwork(int netId, String packageName);
+ void allowAutojoin(int netId, boolean choice);
+
boolean startScan(String packageName);
List<ScanResult> getScanResults(String callingPackage);
diff --git a/wifi/java/android/net/wifi/IWifiScanner.aidl b/wifi/java/android/net/wifi/IWifiScanner.aidl
index 3984934..114c732 100644
--- a/wifi/java/android/net/wifi/IWifiScanner.aidl
+++ b/wifi/java/android/net/wifi/IWifiScanner.aidl
@@ -26,5 +26,5 @@
{
Messenger getMessenger();
- Bundle getAvailableChannels(int band);
+ Bundle getAvailableChannels(int band, String packageName);
}
diff --git a/core/java/android/app/timedetector/TimeSignal.aidl b/wifi/java/android/net/wifi/WifiClient.aidl
similarity index 80%
copy from core/java/android/app/timedetector/TimeSignal.aidl
copy to wifi/java/android/net/wifi/WifiClient.aidl
index d2ec357..accdadd 100644
--- a/core/java/android/app/timedetector/TimeSignal.aidl
+++ b/wifi/java/android/net/wifi/WifiClient.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.app.timedetector;
+package android.net.wifi;
-parcelable TimeSignal;
\ No newline at end of file
+@JavaOnlyStableParcelable parcelable WifiClient;
\ No newline at end of file
diff --git a/wifi/java/android/net/wifi/WifiClient.java b/wifi/java/android/net/wifi/WifiClient.java
new file mode 100644
index 0000000..3e09580
--- /dev/null
+++ b/wifi/java/android/net/wifi/WifiClient.java
@@ -0,0 +1,97 @@
+/*
+ * 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.wifi;
+
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
+import android.net.MacAddress;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.Objects;
+
+/** @hide */
+@SystemApi
+public final class WifiClient implements Parcelable {
+
+ private final MacAddress mMacAddress;
+
+ /**
+ * The mac address of this client.
+ */
+ @NonNull
+ public MacAddress getMacAddress() {
+ return mMacAddress;
+ }
+
+ private WifiClient(Parcel in) {
+ mMacAddress = in.readParcelable(null);
+ }
+
+ /** @hide */
+ public WifiClient(@NonNull MacAddress macAddress) {
+ Preconditions.checkNotNull(macAddress, "mMacAddress must not be null.");
+
+ this.mMacAddress = macAddress;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeParcelable(mMacAddress, flags);
+ }
+
+ @NonNull
+ public static final Creator<WifiClient> CREATOR = new Creator<WifiClient>() {
+ public WifiClient createFromParcel(Parcel in) {
+ return new WifiClient(in);
+ }
+
+ public WifiClient[] newArray(int size) {
+ return new WifiClient[size];
+ }
+ };
+
+ @NonNull
+ @Override
+ public String toString() {
+ return "WifiClient{"
+ + "mMacAddress=" + mMacAddress
+ + '}';
+ }
+
+ @Override
+ public boolean equals(@NonNull Object o) {
+ if (this == o) return true;
+ if (!(o instanceof WifiClient)) return false;
+ WifiClient client = (WifiClient) o;
+ return mMacAddress.equals(client.mMacAddress);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mMacAddress);
+ }
+}
+
+
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 2afb14a..3dc5a62 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -735,6 +735,14 @@
*/
public int userApproved = USER_UNSPECIFIED;
+ /**
+ * @hide
+ * Auto-join is allowed by user for this network.
+ * Default true.
+ */
+ @SystemApi
+ public boolean allowAutojoin = true;
+
/** The Below RSSI thresholds are used to configure AutoJoin
* - GOOD/LOW/BAD thresholds are used so as to calculate link score
* - UNWANTED_SOFT are used by the blacklisting logic so as to handle
@@ -1038,10 +1046,10 @@
/**
* @hide
- * The wall clock time of when |mRandomizedMacAddress| last changed.
- * Used to determine when we should re-randomize in aggressive mode.
+ * The wall clock time of when |mRandomizedMacAddress| should be re-randomized in aggressive
+ * randomization mode.
*/
- public long randomizedMacLastModifiedTimeMs = 0;
+ public long randomizedMacExpirationTimeMs = 0;
/**
* @hide
@@ -1902,8 +1910,9 @@
}
sbuf.append(" macRandomizationSetting: ").append(macRandomizationSetting).append("\n");
sbuf.append(" mRandomizedMacAddress: ").append(mRandomizedMacAddress).append("\n");
- sbuf.append(" randomizedMacLastModifiedTimeMs: ").append(randomizedMacLastModifiedTimeMs)
- .append("\n");
+ sbuf.append(" randomizedMacExpirationTimeMs: ")
+ .append(randomizedMacExpirationTimeMs == 0 ? "<none>"
+ : TimeUtils.logTimeOfDay(randomizedMacExpirationTimeMs)).append("\n");
sbuf.append(" KeyMgmt:");
for (int k = 0; k < this.allowedKeyManagement.size(); k++) {
if (this.allowedKeyManagement.get(k)) {
@@ -2022,6 +2031,7 @@
if (updateIdentifier != null) sbuf.append(" updateIdentifier=" + updateIdentifier);
sbuf.append(" lcuid=" + lastConnectUid);
sbuf.append(" userApproved=" + userApprovedAsString(userApproved));
+ sbuf.append(" allowAutojoin=" + allowAutojoin);
sbuf.append(" noInternetAccessExpected=" + noInternetAccessExpected);
sbuf.append(" ");
@@ -2421,6 +2431,7 @@
numScorerOverrideAndSwitchedNetwork = source.numScorerOverrideAndSwitchedNetwork;
numAssociation = source.numAssociation;
userApproved = source.userApproved;
+ allowAutojoin = source.allowAutojoin;
numNoInternetAccessReports = source.numNoInternetAccessReports;
noInternetAccessExpected = source.noInternetAccessExpected;
creationTime = source.creationTime;
@@ -2429,7 +2440,7 @@
recentFailure.setAssociationStatus(source.recentFailure.getAssociationStatus());
mRandomizedMacAddress = source.mRandomizedMacAddress;
macRandomizationSetting = source.macRandomizationSetting;
- randomizedMacLastModifiedTimeMs = source.randomizedMacLastModifiedTimeMs;
+ randomizedMacExpirationTimeMs = source.randomizedMacExpirationTimeMs;
requirePMF = source.requirePMF;
updateIdentifier = source.updateIdentifier;
}
@@ -2496,6 +2507,7 @@
dest.writeInt(numScorerOverrideAndSwitchedNetwork);
dest.writeInt(numAssociation);
dest.writeInt(userApproved);
+ dest.writeBoolean(allowAutojoin);
dest.writeInt(numNoInternetAccessReports);
dest.writeInt(noInternetAccessExpected ? 1 : 0);
dest.writeInt(shared ? 1 : 0);
@@ -2504,7 +2516,7 @@
dest.writeParcelable(mRandomizedMacAddress, flags);
dest.writeInt(macRandomizationSetting);
dest.writeInt(osu ? 1 : 0);
- dest.writeLong(randomizedMacLastModifiedTimeMs);
+ dest.writeLong(randomizedMacExpirationTimeMs);
}
/** Implement the Parcelable interface {@hide} */
@@ -2571,6 +2583,7 @@
config.numScorerOverrideAndSwitchedNetwork = in.readInt();
config.numAssociation = in.readInt();
config.userApproved = in.readInt();
+ config.allowAutojoin = in.readBoolean();
config.numNoInternetAccessReports = in.readInt();
config.noInternetAccessExpected = in.readInt() != 0;
config.shared = in.readInt() != 0;
@@ -2579,7 +2592,7 @@
config.mRandomizedMacAddress = in.readParcelable(null);
config.macRandomizationSetting = in.readInt();
config.osu = in.readInt() != 0;
- config.randomizedMacLastModifiedTimeMs = in.readLong();
+ config.randomizedMacExpirationTimeMs = in.readLong();
return config;
}
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index 0b55794..62ba95d 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -16,6 +16,7 @@
package android.net.wifi;
+import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -27,6 +28,8 @@
import android.os.Parcelable;
import android.text.TextUtils;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -34,7 +37,7 @@
import java.util.Locale;
/**
- * Describes the state of any Wifi connection that is active or
+ * Describes the state of any Wi-Fi connection that is active or
* is in the process of being set up.
*/
public class WifiInfo implements Parcelable {
@@ -96,6 +99,47 @@
private int mRssi;
/**
+ * Wi-Fi unknown technology
+ */
+ public static final int WIFI_TECHNOLOGY_UNKNOWN = 0;
+
+ /**
+ * Wi-Fi 802.11a/b/g
+ */
+ public static final int WIFI_TECHNOLOGY_LEGACY = 1;
+
+ /**
+ * Wi-Fi 802.11n
+ */
+ public static final int WIFI_TECHNOLOGY_11N = 4;
+
+ /**
+ * Wi-Fi 802.11ac
+ */
+ public static final int WIFI_TECHNOLOGY_11AC = 5;
+
+ /**
+ * Wi-Fi 802.11ax
+ */
+ public static final int WIFI_TECHNOLOGY_11AX = 6;
+
+ /** @hide */
+ @IntDef(prefix = { "WIFI_TECHNOLOGY_" }, value = {
+ WIFI_TECHNOLOGY_UNKNOWN,
+ WIFI_TECHNOLOGY_LEGACY,
+ WIFI_TECHNOLOGY_11N,
+ WIFI_TECHNOLOGY_11AC,
+ WIFI_TECHNOLOGY_11AX
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface WifiTechnology{}
+
+ /**
+ * Wi-Fi technology for the connection
+ */
+ private @WifiTechnology int mWifiTechnology;
+
+ /**
* The unit in which links speeds are expressed.
*/
public static final String LINK_SPEED_UNITS = "Mbps";
@@ -286,6 +330,7 @@
txSuccessRate = source.txSuccessRate;
rxSuccessRate = source.rxSuccessRate;
score = source.score;
+ mWifiTechnology = source.mWifiTechnology;
}
}
@@ -374,6 +419,22 @@
}
/**
+ * Sets the Wi-Fi technology
+ * @hide
+ */
+ public void setWifiTechnology(@WifiTechnology int wifiTechnology) {
+ mWifiTechnology = wifiTechnology;
+ }
+
+ /**
+ * Get connection Wi-Fi technology
+ * @return the connection Wi-Fi technology
+ */
+ public @WifiTechnology int getWifiTechnology() {
+ return mWifiTechnology;
+ }
+
+ /**
* Returns the current link speed in {@link #LINK_SPEED_UNITS}.
* @return the link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown.
* @see #LINK_SPEED_UNITS
@@ -679,6 +740,7 @@
.append(", MAC: ").append(mMacAddress == null ? none : mMacAddress)
.append(", Supplicant state: ")
.append(mSupplicantState == null ? none : mSupplicantState)
+ .append(", Wi-Fi technology: ").append(mWifiTechnology)
.append(", RSSI: ").append(mRssi)
.append(", Link speed: ").append(mLinkSpeed).append(LINK_SPEED_UNITS)
.append(", Tx Link speed: ").append(mTxLinkSpeed).append(LINK_SPEED_UNITS)
@@ -734,6 +796,7 @@
dest.writeString(mNetworkSuggestionOrSpecifierPackageName);
dest.writeString(mFqdn);
dest.writeString(mProviderFriendlyName);
+ dest.writeInt(mWifiTechnology);
}
/** Implement the Parcelable interface {@hide} */
@@ -775,6 +838,7 @@
info.mNetworkSuggestionOrSpecifierPackageName = in.readString();
info.mFqdn = in.readString();
info.mProviderFriendlyName = in.readString();
+ info.mWifiTechnology = in.readInt();
return info;
}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index dd9ee3b..8f71b0b 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -38,6 +38,7 @@
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
+import android.net.NetworkStack;
import android.net.wifi.hotspot2.IProvisioningCallback;
import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
@@ -529,19 +530,25 @@
@SystemApi
public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
/**
- * The interface used for the softap.
+ * The lookup key for a String extra that stores the interface name used for the Soft AP.
+ * This extra is included in the broadcast {@link #WIFI_AP_STATE_CHANGED_ACTION}.
+ * Retrieve its value with {@link android.content.Intent#getStringExtra(String)}.
*
* @hide
*/
- public static final String EXTRA_WIFI_AP_INTERFACE_NAME = "wifi_ap_interface_name";
+ @SystemApi
+ public static final String EXTRA_WIFI_AP_INTERFACE_NAME =
+ "android.net.wifi.extra.WIFI_AP_INTERFACE_NAME";
/**
- * The intended ip mode for this softap.
- * @see #IFACE_IP_MODE_TETHERED
- * @see #IFACE_IP_MODE_LOCAL_ONLY
+ * The lookup key for an int extra that stores the intended IP mode for this Soft AP.
+ * One of {@link #IFACE_IP_MODE_TETHERED} or {@link #IFACE_IP_MODE_LOCAL_ONLY}.
+ * This extra is included in the broadcast {@link #WIFI_AP_STATE_CHANGED_ACTION}.
+ * Retrieve its value with {@link android.content.Intent#getIntExtra(String, int)}.
*
* @hide
*/
- public static final String EXTRA_WIFI_AP_MODE = "wifi_ap_mode";
+ @SystemApi
+ public static final String EXTRA_WIFI_AP_MODE = "android.net.wifi.extra.WIFI_AP_MODE";
/** @hide */
@IntDef(flag = false, prefix = { "WIFI_AP_STATE_" }, value = {
@@ -647,6 +654,7 @@
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_UNSPECIFIED = -1;
/**
@@ -656,6 +664,7 @@
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_CONFIGURATION_ERROR = 0;
/**
@@ -665,6 +674,7 @@
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_TETHERED = 1;
/**
@@ -674,6 +684,7 @@
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_LOCAL_ONLY = 2;
/**
@@ -2143,69 +2154,69 @@
}
/** @hide */
- public static final int WIFI_FEATURE_INFRA = 0x0001; // Basic infrastructure mode
+ public static final long WIFI_FEATURE_INFRA = 0x0001L; // Basic infrastructure mode
/** @hide */
- public static final int WIFI_FEATURE_INFRA_5G = 0x0002; // Support for 5 GHz Band
+ public static final long WIFI_FEATURE_INFRA_5G = 0x0002L; // Support for 5 GHz Band
/** @hide */
- public static final int WIFI_FEATURE_PASSPOINT = 0x0004; // Support for GAS/ANQP
+ public static final long WIFI_FEATURE_PASSPOINT = 0x0004L; // Support for GAS/ANQP
/** @hide */
- public static final int WIFI_FEATURE_P2P = 0x0008; // Wifi-Direct
+ public static final long WIFI_FEATURE_P2P = 0x0008L; // Wifi-Direct
/** @hide */
- public static final int WIFI_FEATURE_MOBILE_HOTSPOT = 0x0010; // Soft AP
+ public static final long WIFI_FEATURE_MOBILE_HOTSPOT = 0x0010L; // Soft AP
/** @hide */
- public static final int WIFI_FEATURE_SCANNER = 0x0020; // WifiScanner APIs
+ public static final long WIFI_FEATURE_SCANNER = 0x0020L; // WifiScanner APIs
/** @hide */
- public static final int WIFI_FEATURE_AWARE = 0x0040; // Wi-Fi AWare networking
+ public static final long WIFI_FEATURE_AWARE = 0x0040L; // Wi-Fi AWare networking
/** @hide */
- public static final int WIFI_FEATURE_D2D_RTT = 0x0080; // Device-to-device RTT
+ public static final long WIFI_FEATURE_D2D_RTT = 0x0080L; // Device-to-device RTT
/** @hide */
- public static final int WIFI_FEATURE_D2AP_RTT = 0x0100; // Device-to-AP RTT
+ public static final long WIFI_FEATURE_D2AP_RTT = 0x0100L; // Device-to-AP RTT
/** @hide */
- public static final int WIFI_FEATURE_BATCH_SCAN = 0x0200; // Batched Scan (deprecated)
+ public static final long WIFI_FEATURE_BATCH_SCAN = 0x0200L; // Batched Scan (deprecated)
/** @hide */
- public static final int WIFI_FEATURE_PNO = 0x0400; // Preferred network offload
+ public static final long WIFI_FEATURE_PNO = 0x0400L; // Preferred network offload
/** @hide */
- public static final int WIFI_FEATURE_ADDITIONAL_STA = 0x0800; // Support for two STAs
+ public static final long WIFI_FEATURE_ADDITIONAL_STA = 0x0800L; // Support for two STAs
/** @hide */
- public static final int WIFI_FEATURE_TDLS = 0x1000; // Tunnel directed link setup
+ public static final long WIFI_FEATURE_TDLS = 0x1000L; // Tunnel directed link setup
/** @hide */
- public static final int WIFI_FEATURE_TDLS_OFFCHANNEL = 0x2000; // Support for TDLS off channel
+ public static final long WIFI_FEATURE_TDLS_OFFCHANNEL = 0x2000L; // TDLS off channel
/** @hide */
- public static final int WIFI_FEATURE_EPR = 0x4000; // Enhanced power reporting
+ public static final long WIFI_FEATURE_EPR = 0x4000L; // Enhanced power reporting
/** @hide */
- public static final int WIFI_FEATURE_AP_STA = 0x8000; // AP STA Concurrency
+ public static final long WIFI_FEATURE_AP_STA = 0x8000L; // AP STA Concurrency
/** @hide */
- public static final int WIFI_FEATURE_LINK_LAYER_STATS = 0x10000; // Link layer stats collection
+ public static final long WIFI_FEATURE_LINK_LAYER_STATS = 0x10000L; // Link layer stats
/** @hide */
- public static final int WIFI_FEATURE_LOGGER = 0x20000; // WiFi Logger
+ public static final long WIFI_FEATURE_LOGGER = 0x20000L; // WiFi Logger
/** @hide */
- public static final int WIFI_FEATURE_HAL_EPNO = 0x40000; // Enhanced PNO
+ public static final long WIFI_FEATURE_HAL_EPNO = 0x40000L; // Enhanced PNO
/** @hide */
- public static final int WIFI_FEATURE_RSSI_MONITOR = 0x80000; // RSSI Monitor
+ public static final long WIFI_FEATURE_RSSI_MONITOR = 0x80000L; // RSSI Monitor
/** @hide */
- public static final int WIFI_FEATURE_MKEEP_ALIVE = 0x100000; // mkeep_alive
+ public static final long WIFI_FEATURE_MKEEP_ALIVE = 0x100000L; // mkeep_alive
/** @hide */
- public static final int WIFI_FEATURE_CONFIG_NDO = 0x200000; // ND offload
+ public static final long WIFI_FEATURE_CONFIG_NDO = 0x200000L; // ND offload
/** @hide */
- public static final int WIFI_FEATURE_TRANSMIT_POWER = 0x400000; // Capture transmit power
+ public static final long WIFI_FEATURE_TRANSMIT_POWER = 0x400000L; // Capture transmit power
/** @hide */
- public static final int WIFI_FEATURE_CONTROL_ROAMING = 0x800000; // Control firmware roaming
+ public static final long WIFI_FEATURE_CONTROL_ROAMING = 0x800000L; // Control firmware roaming
/** @hide */
- public static final int WIFI_FEATURE_IE_WHITELIST = 0x1000000; // Probe IE white listing
+ public static final long WIFI_FEATURE_IE_WHITELIST = 0x1000000L; // Probe IE white listing
/** @hide */
- public static final int WIFI_FEATURE_SCAN_RAND = 0x2000000; // Random MAC & Probe seq
+ public static final long WIFI_FEATURE_SCAN_RAND = 0x2000000L; // Random MAC & Probe seq
/** @hide */
- public static final int WIFI_FEATURE_TX_POWER_LIMIT = 0x4000000; // Set Tx power limit
+ public static final long WIFI_FEATURE_TX_POWER_LIMIT = 0x4000000L; // Set Tx power limit
/** @hide */
- public static final int WIFI_FEATURE_WPA3_SAE = 0x8000000; // WPA3-Personal SAE
+ public static final long WIFI_FEATURE_WPA3_SAE = 0x8000000L; // WPA3-Personal SAE
/** @hide */
- public static final int WIFI_FEATURE_WPA3_SUITE_B = 0x10000000; // WPA3-Enterprise Suite-B
+ public static final long WIFI_FEATURE_WPA3_SUITE_B = 0x10000000L; // WPA3-Enterprise Suite-B
/** @hide */
- public static final int WIFI_FEATURE_OWE = 0x20000000; // Enhanced Open
+ public static final long WIFI_FEATURE_OWE = 0x20000000L; // Enhanced Open
/** @hide */
- public static final int WIFI_FEATURE_LOW_LATENCY = 0x40000000; // Low Latency modes
+ public static final long WIFI_FEATURE_LOW_LATENCY = 0x40000000L; // Low Latency modes
/** @hide */
- public static final int WIFI_FEATURE_DPP = 0x80000000; // DPP (Easy-Connect)
+ public static final long WIFI_FEATURE_DPP = 0x80000000L; // DPP (Easy-Connect)
/** @hide */
public static final long WIFI_FEATURE_P2P_RAND_MAC = 0x100000000L; // Random P2P MAC
@@ -2661,16 +2672,21 @@
/**
* Call allowing ConnectivityService to update WifiService with interface mode changes.
*
- * The possible modes include: {@link #IFACE_IP_MODE_TETHERED},
- * {@link #IFACE_IP_MODE_LOCAL_ONLY},
- * {@link #IFACE_IP_MODE_CONFIGURATION_ERROR}
- *
- * @param ifaceName String name of the updated interface
- * @param mode int representing the new mode
+ * @param ifaceName String name of the updated interface, or null to represent all interfaces
+ * @param mode int representing the new mode, one of:
+ * {@link #IFACE_IP_MODE_TETHERED},
+ * {@link #IFACE_IP_MODE_LOCAL_ONLY},
+ * {@link #IFACE_IP_MODE_CONFIGURATION_ERROR},
+ * {@link #IFACE_IP_MODE_UNSPECIFIED}
*
* @hide
*/
- public void updateInterfaceIpState(String ifaceName, int mode) {
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.NETWORK_STACK,
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
+ })
+ public void updateInterfaceIpState(@Nullable String ifaceName, @IfaceIpMode int mode) {
try {
IWifiManager iWifiManager = getIWifiManager();
if (iWifiManager == null) {
@@ -2684,15 +2700,21 @@
}
/**
- * Start SoftAp mode with the specified configuration.
- * Note that starting in access point mode disables station
- * mode operation
- * @param wifiConfig SSID, security and channel details as
- * part of WifiConfiguration
- * @return {@code true} if the operation succeeds, {@code false} otherwise
+ * Start Soft AP (hotspot) mode with the specified configuration.
+ * Note that starting Soft AP mode may disable station mode operation if the device does not
+ * support concurrency.
+ * @param wifiConfig SSID, security and channel details as part of WifiConfiguration, or null to
+ * use the persisted Soft AP configuration that was previously set using
+ * {@link #setWifiApConfiguration(WifiConfiguration)}.
+ * @return {@code true} if the operation succeeded, {@code false} otherwise
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.NETWORK_STACK,
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
+ })
public boolean startSoftAp(@Nullable WifiConfiguration wifiConfig) {
try {
IWifiManager iWifiManager = getIWifiManager();
@@ -2710,6 +2732,11 @@
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.NETWORK_STACK,
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
+ })
public boolean stopSoftAp() {
try {
IWifiManager iWifiManager = getIWifiManager();
@@ -3227,21 +3254,22 @@
/**
* Called when soft AP state changes.
*
- * @param state new new AP state. One of {@link #WIFI_AP_STATE_DISABLED},
- * {@link #WIFI_AP_STATE_DISABLING}, {@link #WIFI_AP_STATE_ENABLED},
- * {@link #WIFI_AP_STATE_ENABLING}, {@link #WIFI_AP_STATE_FAILED}
+ * @param state new new AP state. One of {@link #WIFI_AP_STATE_DISABLED},
+ * {@link #WIFI_AP_STATE_DISABLING}, {@link #WIFI_AP_STATE_ENABLED},
+ * {@link #WIFI_AP_STATE_ENABLING}, {@link #WIFI_AP_STATE_FAILED}
* @param failureReason reason when in failed state. One of
- * {@link #SAP_START_FAILURE_GENERAL}, {@link #SAP_START_FAILURE_NO_CHANNEL}
+ * {@link #SAP_START_FAILURE_GENERAL},
+ * {@link #SAP_START_FAILURE_NO_CHANNEL}
*/
- public abstract void onStateChanged(@WifiApState int state,
+ void onStateChanged(@WifiApState int state,
@SapStartFailure int failureReason);
/**
- * Called when number of connected clients to soft AP changes.
+ * Called when the connected clients to soft AP changes.
*
- * @param numClients number of connected clients
+ * @param clients the currently connected clients
*/
- public abstract void onNumClientsChanged(int numClients);
+ void onConnectedClientsChanged(@NonNull List<WifiClient> clients);
}
/**
@@ -3264,18 +3292,21 @@
Log.v(TAG, "SoftApCallbackProxy: onStateChanged: state=" + state
+ ", failureReason=" + failureReason);
}
+
mHandler.post(() -> {
mCallback.onStateChanged(state, failureReason);
});
}
@Override
- public void onNumClientsChanged(int numClients) {
+ public void onConnectedClientsChanged(List<WifiClient> clients) {
if (mVerboseLoggingEnabled) {
- Log.v(TAG, "SoftApCallbackProxy: onNumClientsChanged: numClients=" + numClients);
+ Log.v(TAG, "SoftApCallbackProxy: onConnectedClientsChanged: clients="
+ + clients.size() + " clients");
}
+
mHandler.post(() -> {
- mCallback.onNumClientsChanged(numClients);
+ mCallback.onConnectedClientsChanged(clients);
});
}
}
@@ -3842,6 +3873,29 @@
}
/**
+ * Sets the user choice for allowing auto-join to a network.
+ * The updated choice will be made available through the updated config supplied by the
+ * CONFIGURED_NETWORKS_CHANGED broadcast.
+ *
+ * @param netId the id of the network to allow/disallow autojoin for.
+ * @param choice true to allow autojoin, false to disallow autojoin
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
+ public void allowAutojoin(int netId, boolean choice) {
+ try {
+ IWifiManager iWifiManager = getIWifiManager();
+ if (iWifiManager == null) {
+ throw new RemoteException("Wifi service is not running");
+ }
+ iWifiManager.allowAutojoin(netId, choice);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Disable ephemeral Network
*
* @param SSID, in the format of WifiConfiguration's SSID.
diff --git a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
index 6c2d7ff..ba9dd37 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
@@ -157,7 +157,8 @@
*/
public @NonNull Builder setBssidPattern(
@NonNull MacAddress baseAddress, @NonNull MacAddress mask) {
- checkNotNull(baseAddress, mask);
+ checkNotNull(baseAddress);
+ checkNotNull(mask);
mBssidPatternMatcher = Pair.create(baseAddress, mask);
return this;
}
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index 68948cb..21189a4 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -17,7 +17,9 @@
package android.net.wifi;
import android.Manifest;
+import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
@@ -39,6 +41,8 @@
import com.android.internal.util.Preconditions;
import com.android.internal.util.Protocol;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -51,26 +55,38 @@
@SystemService(Context.WIFI_SCANNING_SERVICE)
public class WifiScanner {
- /** no band specified; use channel list instead */
- public static final int WIFI_BAND_UNSPECIFIED = 0; /* not specified */
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"WIFI_BAND_"}, value = {
+ WIFI_BAND_UNSPECIFIED,
+ WIFI_BAND_24_GHZ,
+ WIFI_BAND_5_GHZ,
+ WIFI_BAND_BOTH,
+ WIFI_BAND_5_GHZ_DFS_ONLY,
+ WIFI_BAND_24_GHZ_WITH_5GHZ_DFS,
+ WIFI_BAND_5_GHZ_WITH_DFS,
+ WIFI_BAND_BOTH_WITH_DFS})
+ public @interface WifiBand {}
+ /** no band specified; use channel list instead */
+ public static final int WIFI_BAND_UNSPECIFIED = 0;
/** 2.4 GHz band */
- public static final int WIFI_BAND_24_GHZ = 1; /* 2.4 GHz band */
+ public static final int WIFI_BAND_24_GHZ = 1;
/** 5 GHz band excluding DFS channels */
- public static final int WIFI_BAND_5_GHZ = 2; /* 5 GHz band without DFS channels */
+ public static final int WIFI_BAND_5_GHZ = 2;
+ /** Both 2.4 GHz band and 5 GHz band; no DFS channels */
+ public static final int WIFI_BAND_BOTH = 3;
/** DFS channels from 5 GHz band only */
- public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4; /* 5 GHz band DFS channels */
+ public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4;
/**
* 2.4Ghz band + DFS channels from 5 GHz band only
* @hide
*/
public static final int WIFI_BAND_24_GHZ_WITH_5GHZ_DFS = 5;
/** 5 GHz band including DFS channels */
- public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6; /* 5 GHz band with DFS channels */
- /** Both 2.4 GHz band and 5 GHz band; no DFS channels */
- public static final int WIFI_BAND_BOTH = 3; /* both bands without DFS channels */
+ public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6;
/** Both 2.4 GHz band and 5 GHz band; with DFS channels */
- public static final int WIFI_BAND_BOTH_WITH_DFS = 7; /* both bands with DFS channels */
+ public static final int WIFI_BAND_BOTH_WITH_DFS = 7;
/**
* Max band value
* @hide
@@ -78,9 +94,9 @@
public static final int WIFI_BAND_MAX = 8;
/** Minimum supported scanning period */
- public static final int MIN_SCAN_PERIOD_MS = 1000; /* minimum supported period */
+ public static final int MIN_SCAN_PERIOD_MS = 1000;
/** Maximum supported scanning period */
- public static final int MAX_SCAN_PERIOD_MS = 1024000; /* maximum supported period */
+ public static final int MAX_SCAN_PERIOD_MS = 1024000;
/** No Error */
public static final int REASON_SUCCEEDED = 0;
@@ -109,13 +125,20 @@
}
/**
- * gives you all the possible channels; channel is specified as an
- * integer with frequency in MHz i.e. channel 1 is 2412
+ * Returns a list of all the possible channels for the given band(s).
+ *
+ * @param band one of the WifiScanner#WIFI_BAND_* constants, e.g. {@link #WIFI_BAND_24_GHZ}
+ * @return a list of all the frequencies, in MHz, for the given band(s) e.g. channel 1 is
+ * 2412, or null if an error occurred.
+ *
* @hide
*/
- public List<Integer> getAvailableChannels(int band) {
+ @SystemApi
+ @Nullable
+ @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
+ public List<Integer> getAvailableChannels(@WifiBand int band) {
try {
- Bundle bundle = mService.getAvailableChannels(band);
+ Bundle bundle = mService.getAvailableChannels(band, mContext.getOpPackageName());
return bundle.getIntegerArrayList(GET_AVAILABLE_CHANNELS_EXTRA);
} catch (RemoteException e) {
return null;
diff --git a/wifi/java/android/net/wifi/hotspot2/ConfigParser.java b/wifi/java/android/net/wifi/hotspot2/ConfigParser.java
index e8e8731..bb01365 100644
--- a/wifi/java/android/net/wifi/hotspot2/ConfigParser.java
+++ b/wifi/java/android/net/wifi/hotspot2/ConfigParser.java
@@ -182,6 +182,12 @@
throw new IOException("Passpoint profile missing credential");
}
+ // Don't allow the installer to make changes to the update identifier. This is an
+ // indicator of an R2 (or newer) network.
+ if (config.getUpdateIdentifier() != Integer.MIN_VALUE) {
+ config.setUpdateIdentifier(Integer.MIN_VALUE);
+ }
+
// Parse CA (Certificate Authority) certificate.
byte[] caCertData = mimeParts.get(TYPE_CA_CERT);
if (caCertData != null) {
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
index 557b7c9..e9aa076 100644
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
@@ -65,6 +65,7 @@
* Configurations under HomeSp subtree.
*/
private HomeSp mHomeSp = null;
+
/**
* Set the Home SP (Service Provider) information.
*
@@ -248,7 +249,10 @@
mSubscriptionExpirationTimeInMillis = subscriptionExpirationTimeInMillis;
}
/**
- * @hide
+ * Utility method to get the time this subscription will expire. It is in the format of number
+ * of milliseconds since January 1, 1970, 00:00:00 GMT.
+ *
+ * @return The time this subscription will expire, or Long.MIN_VALUE to indicate unset value
*/
public long getSubscriptionExpirationTimeInMillis() {
return mSubscriptionExpirationTimeInMillis;
@@ -521,6 +525,8 @@
.append("\n");
builder.append("UsageLimitDataLimit: ").append(mUsageLimitDataLimit).append("\n");
builder.append("UsageLimitTimeLimit: ").append(mUsageLimitTimeLimitInMinutes).append("\n");
+ builder.append("Provisioned by a subscription server: ")
+ .append(isOsuProvisioned() ? "Yes" : "No").append("\n");
if (mHomeSp != null) {
builder.append("HomeSP Begin ---\n");
builder.append(mHomeSp);
@@ -728,4 +734,14 @@
}
return true;
}
+
+ /**
+ * Indicates if the Passpoint Configuration was provisioned by a subscription (OSU) server,
+ * which means that it's an R2 (or R3) profile.
+ *
+ * @return true if the Passpoint Configuration was provisioned by a subscription server.
+ */
+ public boolean isOsuProvisioned() {
+ return getUpdateIdentifier() != Integer.MIN_VALUE;
+ }
}
diff --git a/wifi/java/com/android/server/wifi/BaseWifiService.java b/wifi/java/com/android/server/wifi/BaseWifiService.java
index 94fb5ae..5e6c107 100644
--- a/wifi/java/com/android/server/wifi/BaseWifiService.java
+++ b/wifi/java/com/android/server/wifi/BaseWifiService.java
@@ -168,6 +168,11 @@
}
@Override
+ public void allowAutojoin(int netId, boolean choice) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public boolean startScan(String packageName) {
throw new UnsupportedOperationException();
}
diff --git a/wifi/tests/Android.mk b/wifi/tests/Android.mk
index 401b652..3453d6e 100644
--- a/wifi/tests/Android.mk
+++ b/wifi/tests/Android.mk
@@ -49,6 +49,7 @@
core-test-rules \
guava \
mockito-target-minus-junit4 \
+ net-tests-utils \
frameworks-base-testutils \
truth-prebuilt \
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64
index 56919c2..760c839 100644
--- a/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64
@@ -12,75 +12,75 @@
OWtaVTVoYldVK0NpQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJSbFRtRnRaVDVJYjIx
bFUxQTgKTDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1
dlpHVk9ZVzFsUGtaeWFXVnVaR3g1VG1GdApaVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNB
-OFZtRnNkV1UrUTJWdWRIVnllU0JJYjNWelpUd3ZWbUZzZFdVK0NpQWdJQ0FnCklDQWdQQzlPYjJS
-bFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBrWlJSRTQ4
-TDA1dlpHVk8KWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBtMXBOaTVqYnk1MWF6d3ZWbUZz
-ZFdVK0NpQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZwpJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0Fn
-SUNBZ1BFNXZaR1ZPWVcxbFBsSnZZVzFwYm1kRGIyNXpiM0owYVhWdFQwazhMMDV2ClpHVk9ZVzFs
-UGdvZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUGpFeE1qSXpNeXcwTkRVMU5qWThMMVpoYkhWbFBnb2dJ
-Q0FnSUNBZ0lEd3YKVG05a1pUNEtJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0E4VG05a1pUNEtJ
-Q0FnSUNBZ0lDQThUbTlrWlU1aGJXVStRM0psWkdWdQpkR2xoYkR3dlRtOWtaVTVoYldVK0NpQWdJ
-Q0FnSUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVTVoYldVK1VtVmhiRzA4CkwwNXZa
-R1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBuTm9ZV3RsYmk1emRHbHljbVZrTG1OdmJU
-d3ZWbUZzZFdVK0NpQWcKSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lD
-QWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBsVnpaWEp1WVcxbApVR0Z6YzNkdmNtUThMMDV2WkdWT1lX
-MWxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0ClpU
-NVZjMlZ5Ym1GdFpUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUR4V1lXeDFaVDVxWVcx
-bGN6d3ZWbUZzZFdVK0NpQWcKSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05
-a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxCaApjM04zYjNKa1BDOU9iMlJsVG1G
-dFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbGx0T1hWYVJFRjNUbmM5UFR3dlZtRnNkV1Ur
-CkNpQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0Fn
-SUNBZ0lDQWdQRTV2WkdWT1lXMWwKUGtWQlVFMWxkR2h2WkR3dlRtOWtaVTVoYldVK0NpQWdJQ0Fn
-SUNBZ0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0FnSUR4TwpiMlJsVG1GdFpUNUZRVkJV
-ZVhCbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnSUNBOFZtRnNkV1UrTWpFOEwxWmhi
-SFZsClBnb2dJQ0FnSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmxQ
-Z29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeE8KYjJSbFRtRnRaVDVKYm01bGNrMWxkR2h2WkR3dlRtOWta
-VTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQazFUTFVOSQpRVkF0VmpJOEwxWmhi
-SFZsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0Np
-QWdJQ0FnCklDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BF
-NXZaR1ZPWVcxbFBrUnBaMmwwWVd4RFpYSjAKYVdacFkyRjBaVHd2VG05a1pVNWhiV1UrQ2lBZ0lD
-QWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbApQa05sY25ScFpt
-bGpZWFJsVkhsd1pUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUR4V1lXeDFaVDU0TlRB
-NWRqTThMMVpoCmJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1
-dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNURaWEowVTBoQk1qVTJSbWx1WjJW
-eWNISnBiblE4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdVKwpNV1l4WmpG
+OFZtRnNkV1UrUlhoaGJYQnNaU0JPWlhSM2IzSnJQQzlXWVd4MVpUNEtJQ0FnCklDQWdJQ0E4TDA1
+dlpHVStDaUFnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlU1aGJXVStSbEZF
+VGp3dlRtOWsKWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4Vm1Gc2RXVSthRzkwYzNCdmRDNWxlR0Z0
+Y0d4bExtNWxkRHd2Vm1Gc2RXVStDaUFnSUNBZwpJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHhP
+YjJSbFBnb2dJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQbEp2WVcxcGJtZERiMjV6CmIzSjBhWFZ0
+VDBrOEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBqRXhNakl6TXl3ME5EVTFO
+alk4TDFaaGJIVmwKUGdvZ0lDQWdJQ0FnSUR3dlRtOWtaVDRLSUNBZ0lDQWdQQzlPYjJSbFBnb2dJ
+Q0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0E4VG05awpaVTVoYldVK1EzSmxaR1Z1ZEdsaGJEd3ZU
+bTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrClpVNWhi
+V1UrVW1WaGJHMDhMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbVY0WVcxd2JH
+VXVZMjl0UEM5V1lXeDEKWlQ0S0lDQWdJQ0FnSUNBOEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnUEU1dlpH
+VStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrVlhObApjbTVoYldWUVlYTnpkMjl5WkR3dlRt
+OWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQRTV2ClpH
+Vk9ZVzFsUGxWelpYSnVZVzFsUEM5T2IyUmxUbUZ0WlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQRlpoYkhW
+bFBuVnpaWEk4TDFaaGJIVmwKUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNB
+Z1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9iMlJsVG1GdApaVDVRWVhOemQyOXlaRHd2VG05
+a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gxWlQ1alIwWjZZek5rZG1OdFVUMDhMMVpo
+CmJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFn
+SUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNUZRVkJOWlhSb2IyUThMMDV2WkdWT1lXMWxQZ29n
+SUNBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZwpJQ0E4VG05a1pVNWhiV1Ur
+UlVGUVZIbHdaVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBqSXhQ
+QzlXCllXeDFaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThU
+bTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWcKSUNBOFRtOWtaVTVoYldVK1NXNXVaWEpOWlhSb2IyUThM
+MDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gxWlQ1TgpVeTFEU0VGUUxWWXlQ
+QzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2Iy
+UmxQZ29nCklDQWdJQ0FnSUR3dlRtOWtaVDRLSUNBZ0lDQWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lD
+QWdJRHhPYjJSbFRtRnRaVDVFYVdkcGRHRnMKUTJWeWRHbG1hV05oZEdVOEwwNXZaR1ZPWVcxbFBn
+b2dJQ0FnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbApUbUZ0WlQ1RFpY
+SjBhV1pwWTJGMFpWUjVjR1U4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdV
+K2VEVXdPWFl6ClBDOVdZV3gxWlQ0S0lDQWdJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNB
+Z0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ0lDQTgKVG05a1pVNWhiV1UrUTJWeWRGTklRVEkxTmta
+cGJtZGxjbkJ5YVc1MFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaApiSFZsUGpG
bU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZt
-TVdZeFpqRm1NV1l4ClpqRm1NV1l4Wmp3dlZtRnNkV1UrQ2lBZ0lDQWdJQ0FnSUNBOEwwNXZaR1Ur
-Q2lBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWcKSUR4T2IyUmxQZ29nSUNBZ0lDQWdJQ0Fn
-UEU1dlpHVk9ZVzFsUGxOSlRUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4VG05awpaVDRL
-SUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBrbE5VMGs4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJ
-Q0FnSUNBZ0lDQThWbUZzCmRXVSthVzF6YVR3dlZtRnNkV1UrQ2lBZ0lDQWdJQ0FnSUNBOEwwNXZa
-R1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWcKSUNBZ0lDQWdQRTV2WkdWT1lXMWxQ
-a1ZCVUZSNWNHVThMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBOFZtRnNkV1UrTWpROApM
-MVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lD
-QWdJQ0FnUEM5T2IyUmxQZ29nCklDQWdQQzlPYjJSbFBnb2dJRHd2VG05a1pUNEtQQzlOWjIxMFZI
-SmxaVDRLCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94LXg1MDktY2Et
-Y2VydApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKCkxTMHRMUzFDUlVkSlRpQkRS
-VkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVJMUkVORFFXaERaMEYzU1VKQlowbEtRVWxNYkVaa2Qz
-cE0KVm5WeVRVRXdSME5UY1VkVFNXSXpSRkZGUWtOM1ZVRk5Ra2w0UlVSQlQwSm5UbFlLUWtGTlZF
-SXdWa0pWUTBKRVVWUkZkMGhvWTA1TgpWRmwzVFZSRmVVMVVSVEZOUkVVeFYyaGpUazFxV1hkTlZF
-RTFUVlJGTVUxRVJURlhha0ZUVFZKQmR3cEVaMWxFVmxGUlJFVjNaRVpSClZrRm5VVEJGZUUxSlNV
-Skpha0ZPUW1kcmNXaHJhVWM1ZHpCQ1FWRkZSa0ZCVDBOQlVUaEJUVWxKUWtOblMwTkJVVVZCQ25w
-dVFWQlYKZWpJMlRYTmhaVFIzY3pRelkzcFNOREV2U2pKUmRISlRTVnBWUzIxV1ZYTldkVzFFWWxs
-SWNsQk9kbFJZUzFOTldFRmpaWGRQVWtSUgpXVmdLVW5GMlNIWndiamhEYzJOQ01TdHZSMWhhZGto
-M2VHbzBlbFl3VjB0dlN6SjZaVmhyWVhVemRtTjViRE5JU1V0MWNFcG1jVEpVClJVRkRaV1pXYW1v
-d2RBcEtWeXRZTXpWUVIxZHdPUzlJTlhwSlZVNVdUbFpxVXpkVmJYTTRORWwyUzJoU1FqZzFNVEpR
-UWpsVmVVaGgKWjFoWlZsZzFSMWR3UVdOV2NIbG1jbXhTQ2taSk9WRmthR2dyVUdKck1IVjVhM1Jr
-WW1ZdlEyUm1aMGhQYjJWaWNsUjBkMUpzYWswdwpiMFIwV0NzeVEzWTJhakIzUWtzM2FFUTRjRkIy
-WmpFcmRYa0tSM3BqZW1sblFWVXZORXQzTjJWYWNYbGtaamxDS3pWU2RYQlNLMGxhCmFYQllOREY0
-UldsSmNrdFNkM0ZwTlRFM1YxZDZXR05xWVVjeVkwNWlaalExTVFwNGNFZzFVRzVXTTJreGRIRXdO
-R3BOUjFGVmVrWjMKU1VSQlVVRkNielJIUVUxSU5IZElVVmxFVmxJd1QwSkNXVVZHU1hkWU5IWnpP
-RUpwUW1OVFkyOWtDalZ1YjFwSVVrMDRSVFFyYVUxRgpTVWRCTVZWa1NYZFJOMDFFYlVGR1NYZFlO
-SFp6T0VKcFFtTlRZMjlrTlc1dldraFNUVGhGTkN0cGIxSmhhMFpFUVZNS1RWSkJkMFJuCldVUldV
-VkZFUlhka1JsRldRV2RSTUVWNFoyZHJRV2QxVlZZelJFMTBWelp6ZDBSQldVUldVakJVUWtGVmQw
-RjNSVUl2ZWtGTVFtZE8KVmdwSVVUaEZRa0ZOUTBGUldYZEVVVmxLUzI5YVNXaDJZMDVCVVVWTVFs
-RkJSR2RuUlVKQlJtWlJjVTlVUVRkU2RqZExLMngxVVRkdwpibUZ6TkVKWmQwaEZDamxIUlZBdmRX
-OW9kalpMVDNrd1ZFZFJSbUp5VWxScVJtOU1WazVDT1VKYU1YbHRUVVJhTUM5VVNYZEpWV00zCmQy
-azNZVGgwTlcxRmNWbElNVFV6ZDFjS1lWZHZiMmxUYW5sTVRHaDFTVFJ6VG5KT1EwOTBhWE5rUW5F
-eWNqSk5SbGgwTm1nd2JVRlIKV1U5UWRqaFNPRXMzTDJablUzaEhSbkY2YUhsT2JXMVdUQW94Y1VK
-S2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVFMXVWR3c0ZUVW
-WFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhwaFNFb3hkVlk0
-Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpGS1VDdHNlRllL
-YlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNSa1RrNTJRMWw2
-YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmtsRFFWUkZMUzB0
-TFMwSwotLXtib3VuZGFyeX0tLQo=
+TVdZeFpqRm1NV1l4ClpqRm1NV1l4WmpGbU1XWThMMVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdQQzlP
+YjJSbFBnb2dJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWcKSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0Fn
+SUNBZ0lEeE9iMlJsVG1GdFpUNVRTVTA4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZwpQRTV2
+WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbFRtRnRaVDVKVFZOSlBDOU9iMlJsVG1GdFpUNEtJ
+Q0FnSUNBZ0lDQWdJQ0FnClBGWmhiSFZsUGpFeU16UTFOaW84TDFaaGJIVmxQZ29nSUNBZ0lDQWdJ
+Q0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVSsKQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9i
+MlJsVG1GdFpUNUZRVkJVZVhCbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaApi
+SFZsUGpJelBDOVdZV3gxWlQ0S0lDQWdJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNBOEww
+NXZaR1UrQ2lBZ0lDQWdJRHd2ClRtOWtaVDRLSUNBZ0lEd3ZUbTlrWlQ0S0lDQThMMDV2WkdVK0Nq
+d3ZUV2R0ZEZSeVpXVSsKCi0te2JvdW5kYXJ5fQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL3gt
+eDUwOS1jYS1jZXJ0CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJhc2U2NAoKTFMwdExTMUNS
+VWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVUkxSRU5EUVdoRFowRjNTVUpCWjBsS1FV
+bE1iRVprZDNwTQpWblZ5VFVFd1IwTlRjVWRUU1dJelJGRkZRa04zVlVGTlFrbDRSVVJCVDBKblRs
+WUtRa0ZOVkVJd1ZrSlZRMEpFVVZSRmQwaG9ZMDVOClZGbDNUVlJGZVUxVVJURk5SRVV4VjJoalRr
+MXFXWGROVkVFMVRWUkZNVTFFUlRGWGFrRlRUVkpCZHdwRVoxbEVWbEZSUkVWM1pFWlIKVmtGblVU
+QkZlRTFKU1VKSmFrRk9RbWRyY1docmFVYzVkekJDUVZGRlJrRkJUME5CVVRoQlRVbEpRa05uUzBO
+QlVVVkJDbnB1UVZCVgplakkyVFhOaFpUUjNjelF6WTNwU05ERXZTakpSZEhKVFNWcFZTMjFXVlhO
+V2RXMUVZbGxJY2xCT2RsUllTMU5OV0VGalpYZFBVa1JSCldWZ0tVbkYyU0had2JqaERjMk5DTVN0
+dlIxaGFka2gzZUdvMGVsWXdWMHR2U3pKNlpWaHJZWFV6ZG1ONWJETklTVXQxY0VwbWNUSlUKUlVG
+RFpXWldhbW93ZEFwS1Z5dFlNelZRUjFkd09TOUlOWHBKVlU1V1RsWnFVemRWYlhNNE5FbDJTMmhT
+UWpnMU1USlFRamxWZVVoaApaMWhaVmxnMVIxZHdRV05XY0hsbWNteFNDa1pKT1ZGa2FHZ3JVR0py
+TUhWNWEzUmtZbVl2UTJSbVowaFBiMlZpY2xSMGQxSnNhazB3CmIwUjBXQ3N5UTNZMmFqQjNRa3Mz
+YUVRNGNGQjJaakVyZFhrS1IzcGplbWxuUVZVdk5FdDNOMlZhY1hsa1pqbENLelZTZFhCU0swbGEK
+YVhCWU5ERjRSV2xKY2t0U2QzRnBOVEUzVjFkNldHTnFZVWN5WTA1aVpqUTFNUXA0Y0VnMVVHNVdN
+Mmt4ZEhFd05HcE5SMUZWZWtaMwpTVVJCVVVGQ2J6UkhRVTFJTkhkSVVWbEVWbEl3VDBKQ1dVVkdT
+WGRZTkhaek9FSnBRbU5UWTI5a0NqVnViMXBJVWswNFJUUXJhVTFGClNVZEJNVlZrU1hkUk4wMUVi
+VUZHU1hkWU5IWnpPRUpwUW1OVFkyOWtOVzV2V2toU1RUaEZOQ3RwYjFKaGEwWkVRVk1LVFZKQmQw
+Um4KV1VSV1VWRkVSWGRrUmxGV1FXZFJNRVY0WjJkclFXZDFWVll6UkUxMFZ6WnpkMFJCV1VSV1Vq
+QlVRa0ZWZDBGM1JVSXZla0ZNUW1kTwpWZ3BJVVRoRlFrRk5RMEZSV1hkRVVWbEtTMjlhU1doMlkw
+NUJVVVZNUWxGQlJHZG5SVUpCUm1aUmNVOVVRVGRTZGpkTEsyeDFVVGR3CmJtRnpORUpaZDBoRkNq
+bEhSVkF2ZFc5b2RqWkxUM2t3VkVkUlJtSnlVbFJxUm05TVZrNUNPVUphTVhsdFRVUmFNQzlVU1hk
+SlZXTTMKZDJrM1lUaDBOVzFGY1ZsSU1UVXpkMWNLWVZkdmIybFRhbmxNVEdoMVNUUnpUbkpPUTA5
+MGFYTmtRbkV5Y2pKTlJsaDBObWd3YlVGUgpXVTlRZGpoU09FczNMMlpuVTNoSFJuRjZhSGxPYlcx
+V1RBb3hjVUpLYkdSNE16UlRjSGR6VkVGTVVWWlFZalJvUjNkS2VscG1jakZRClkzQkZVWGcyZUUx
+dVZHdzRlRVZYV2tVelRYTTVPWFZoVlhoaVVYRkpkMUoxQ2t4blFVOXJUa050V1RKdE9EbFdhSHBo
+U0VveGRWWTQKTlVGa1RTOTBSQ3RaYzIxc2JtNXFkRGxNVWtObGFtSkNhWEJxU1VkcVQxaHlaekZL
+VUN0c2VGWUtiWFZOTkhaSUsxQXZiV3h0ZUhOUQpVSG93WkRZMVlpdEZSMjFLV25CdlRHdFBMM1Jr
+VGs1MlExbDZha3B3VkVWWGNFVnpUelpPVFdoTFdXODlDaTB0TFMwdFJVNUVJRU5GClVsUkpSa2xE
+UVZSRkxTMHRMUzBLCi0te2JvdW5kYXJ5fS0tCg==
\ No newline at end of file
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf
index a44b542..5b4e4cb 100644
--- a/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf
@@ -13,38 +13,38 @@
ICAgICA8L1R5cGU+CiAgICA8L1JUUHJvcGVydGllcz4KICAgIDxOb2RlPgogICAgICA8Tm9kZU5h
bWU+aTAwMTwvTm9kZU5hbWU+CiAgICAgIDxOb2RlPgogICAgICAgIDxOb2RlTmFtZT5Ib21lU1A8
L05vZGVOYW1lPgogICAgICAgIDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPkZyaWVuZGx5TmFt
-ZTwvTm9kZU5hbWU+CiAgICAgICAgICA8VmFsdWU+Q2VudHVyeSBIb3VzZTwvVmFsdWU+CiAgICAg
-ICAgPC9Ob2RlPgogICAgICAgIDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPkZRRE48L05vZGVO
-YW1lPgogICAgICAgICAgPFZhbHVlPm1pNi5jby51azwvVmFsdWU+CiAgICAgICAgPC9Ob2RlPgog
-ICAgICAgIDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPlJvYW1pbmdDb25zb3J0aXVtT0k8L05v
-ZGVOYW1lPgogICAgICAgICAgPFZhbHVlPjExMjIzMyw0NDU1NjY8L1ZhbHVlPgogICAgICAgIDwv
-Tm9kZT4KICAgICAgPC9Ob2RlPgogICAgICA8Tm9kZT4KICAgICAgICA8Tm9kZU5hbWU+Q3JlZGVu
-dGlhbDwvTm9kZU5hbWU+CiAgICAgICAgPE5vZGU+CiAgICAgICAgICA8Tm9kZU5hbWU+UmVhbG08
-L05vZGVOYW1lPgogICAgICAgICAgPFZhbHVlPnNoYWtlbi5zdGlycmVkLmNvbTwvVmFsdWU+CiAg
-ICAgICAgPC9Ob2RlPgogICAgICAgIDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPlVzZXJuYW1l
-UGFzc3dvcmQ8L05vZGVOYW1lPgogICAgICAgICAgPE5vZGU+CiAgICAgICAgICAgIDxOb2RlTmFt
-ZT5Vc2VybmFtZTwvTm9kZU5hbWU+CiAgICAgICAgICAgIDxWYWx1ZT5qYW1lczwvVmFsdWU+CiAg
-ICAgICAgICA8L05vZGU+CiAgICAgICAgICA8Tm9kZT4KICAgICAgICAgICAgPE5vZGVOYW1lPlBh
-c3N3b3JkPC9Ob2RlTmFtZT4KICAgICAgICAgICAgPFZhbHVlPlltOXVaREF3Tnc9PTwvVmFsdWU+
-CiAgICAgICAgICA8L05vZGU+CiAgICAgICAgICA8Tm9kZT4KICAgICAgICAgICAgPE5vZGVOYW1l
-PkVBUE1ldGhvZDwvTm9kZU5hbWU+CiAgICAgICAgICAgIDxOb2RlPgogICAgICAgICAgICAgIDxO
-b2RlTmFtZT5FQVBUeXBlPC9Ob2RlTmFtZT4KICAgICAgICAgICAgICA8VmFsdWU+MjE8L1ZhbHVl
-PgogICAgICAgICAgICA8L05vZGU+CiAgICAgICAgICAgIDxOb2RlPgogICAgICAgICAgICAgIDxO
-b2RlTmFtZT5Jbm5lck1ldGhvZDwvTm9kZU5hbWU+CiAgICAgICAgICAgICAgPFZhbHVlPk1TLUNI
-QVAtVjI8L1ZhbHVlPgogICAgICAgICAgICA8L05vZGU+CiAgICAgICAgICA8L05vZGU+CiAgICAg
-ICAgPC9Ob2RlPgogICAgICAgIDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPkRpZ2l0YWxDZXJ0
-aWZpY2F0ZTwvTm9kZU5hbWU+CiAgICAgICAgICA8Tm9kZT4KICAgICAgICAgICAgPE5vZGVOYW1l
-PkNlcnRpZmljYXRlVHlwZTwvTm9kZU5hbWU+CiAgICAgICAgICAgIDxWYWx1ZT54NTA5djM8L1Zh
+ZTwvTm9kZU5hbWU+CiAgICAgICAgICA8VmFsdWU+RXhhbXBsZSBOZXR3b3JrPC9WYWx1ZT4KICAg
+ICAgICA8L05vZGU+CiAgICAgICAgPE5vZGU+CiAgICAgICAgICA8Tm9kZU5hbWU+RlFETjwvTm9k
+ZU5hbWU+CiAgICAgICAgICA8VmFsdWU+aG90c3BvdC5leGFtcGxlLm5ldDwvVmFsdWU+CiAgICAg
+ICAgPC9Ob2RlPgogICAgICAgIDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPlJvYW1pbmdDb25z
+b3J0aXVtT0k8L05vZGVOYW1lPgogICAgICAgICAgPFZhbHVlPjExMjIzMyw0NDU1NjY8L1ZhbHVl
+PgogICAgICAgIDwvTm9kZT4KICAgICAgPC9Ob2RlPgogICAgICA8Tm9kZT4KICAgICAgICA8Tm9k
+ZU5hbWU+Q3JlZGVudGlhbDwvTm9kZU5hbWU+CiAgICAgICAgPE5vZGU+CiAgICAgICAgICA8Tm9k
+ZU5hbWU+UmVhbG08L05vZGVOYW1lPgogICAgICAgICAgPFZhbHVlPmV4YW1wbGUuY29tPC9WYWx1
+ZT4KICAgICAgICA8L05vZGU+CiAgICAgICAgPE5vZGU+CiAgICAgICAgICA8Tm9kZU5hbWU+VXNl
+cm5hbWVQYXNzd29yZDwvTm9kZU5hbWU+CiAgICAgICAgICA8Tm9kZT4KICAgICAgICAgICAgPE5v
+ZGVOYW1lPlVzZXJuYW1lPC9Ob2RlTmFtZT4KICAgICAgICAgICAgPFZhbHVlPnVzZXI8L1ZhbHVl
+PgogICAgICAgICAgPC9Ob2RlPgogICAgICAgICAgPE5vZGU+CiAgICAgICAgICAgIDxOb2RlTmFt
+ZT5QYXNzd29yZDwvTm9kZU5hbWU+CiAgICAgICAgICAgIDxWYWx1ZT5jR0Z6YzNkdmNtUT08L1Zh
bHVlPgogICAgICAgICAgPC9Ob2RlPgogICAgICAgICAgPE5vZGU+CiAgICAgICAgICAgIDxOb2Rl
-TmFtZT5DZXJ0U0hBMjU2RmluZ2VycHJpbnQ8L05vZGVOYW1lPgogICAgICAgICAgICA8VmFsdWU+
-MWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYx
-ZjFmMWYxZjwvVmFsdWU+CiAgICAgICAgICA8L05vZGU+CiAgICAgICAgPC9Ob2RlPgogICAgICAg
-IDxOb2RlPgogICAgICAgICAgPE5vZGVOYW1lPlNJTTwvTm9kZU5hbWU+CiAgICAgICAgICA8Tm9k
-ZT4KICAgICAgICAgICAgPE5vZGVOYW1lPklNU0k8L05vZGVOYW1lPgogICAgICAgICAgICA8VmFs
-dWU+aW1zaTwvVmFsdWU+CiAgICAgICAgICA8L05vZGU+CiAgICAgICAgICA8Tm9kZT4KICAgICAg
-ICAgICAgPE5vZGVOYW1lPkVBUFR5cGU8L05vZGVOYW1lPgogICAgICAgICAgICA8VmFsdWU+MjQ8
-L1ZhbHVlPgogICAgICAgICAgPC9Ob2RlPgogICAgICAgIDwvTm9kZT4KICAgICAgPC9Ob2RlPgog
-ICAgPC9Ob2RlPgogIDwvTm9kZT4KPC9NZ210VHJlZT4K
+TmFtZT5FQVBNZXRob2Q8L05vZGVOYW1lPgogICAgICAgICAgICA8Tm9kZT4KICAgICAgICAgICAg
+ICA8Tm9kZU5hbWU+RUFQVHlwZTwvTm9kZU5hbWU+CiAgICAgICAgICAgICAgPFZhbHVlPjIxPC9W
+YWx1ZT4KICAgICAgICAgICAgPC9Ob2RlPgogICAgICAgICAgICA8Tm9kZT4KICAgICAgICAgICAg
+ICA8Tm9kZU5hbWU+SW5uZXJNZXRob2Q8L05vZGVOYW1lPgogICAgICAgICAgICAgIDxWYWx1ZT5N
+Uy1DSEFQLVYyPC9WYWx1ZT4KICAgICAgICAgICAgPC9Ob2RlPgogICAgICAgICAgPC9Ob2RlPgog
+ICAgICAgIDwvTm9kZT4KICAgICAgICA8Tm9kZT4KICAgICAgICAgIDxOb2RlTmFtZT5EaWdpdGFs
+Q2VydGlmaWNhdGU8L05vZGVOYW1lPgogICAgICAgICAgPE5vZGU+CiAgICAgICAgICAgIDxOb2Rl
+TmFtZT5DZXJ0aWZpY2F0ZVR5cGU8L05vZGVOYW1lPgogICAgICAgICAgICA8VmFsdWU+eDUwOXYz
+PC9WYWx1ZT4KICAgICAgICAgIDwvTm9kZT4KICAgICAgICAgIDxOb2RlPgogICAgICAgICAgICA8
+Tm9kZU5hbWU+Q2VydFNIQTI1NkZpbmdlcnByaW50PC9Ob2RlTmFtZT4KICAgICAgICAgICAgPFZh
+bHVlPjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYxZjFmMWYx
+ZjFmMWYxZjFmMWY8L1ZhbHVlPgogICAgICAgICAgPC9Ob2RlPgogICAgICAgIDwvTm9kZT4KICAg
+ICAgICA8Tm9kZT4KICAgICAgICAgIDxOb2RlTmFtZT5TSU08L05vZGVOYW1lPgogICAgICAgICAg
+PE5vZGU+CiAgICAgICAgICAgIDxOb2RlTmFtZT5JTVNJPC9Ob2RlTmFtZT4KICAgICAgICAgICAg
+PFZhbHVlPjEyMzQ1Nio8L1ZhbHVlPgogICAgICAgICAgPC9Ob2RlPgogICAgICAgICAgPE5vZGU+
+CiAgICAgICAgICAgIDxOb2RlTmFtZT5FQVBUeXBlPC9Ob2RlTmFtZT4KICAgICAgICAgICAgPFZh
+bHVlPjIzPC9WYWx1ZT4KICAgICAgICAgIDwvTm9kZT4KICAgICAgICA8L05vZGU+CiAgICAgIDwv
+Tm9kZT4KICAgIDwvTm9kZT4KICA8L05vZGU+CjwvTWdtdFRyZWU+
--{boundary}
Content-Type: application/x-x509-ca-cert
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithInvalidContentType.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithInvalidContentType.base64
index 906bfb3..2775a9f 100644
--- a/wifi/tests/assets/hsr1/HSR1ProfileWithInvalidContentType.base64
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithInvalidContentType.base64
@@ -1,85 +1,86 @@
-Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PXtib3VuZGFyeX0KQ29udGVu
-dC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBh
-cHBsaWNhdGlvbi9wYXNzcG9pbnQtcHJvZmlsZQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBi
-YXNlNjQKClBFMW5iWFJVY21WbElIaHRiRzV6UFNKemVXNWpiV3c2Wkcxa1pHWXhMaklpUGdvZ0lE
-eFdaWEpFVkVRK01TNHlQQzlXWlhKRVZFUSsKQ2lBZ1BFNXZaR1UrQ2lBZ0lDQThUbTlrWlU1aGJX
-VStVR1Z5VUhKdmRtbGtaWEpUZFdKelkzSnBjSFJwYjI0OEwwNXZaR1ZPWVcxbApQZ29nSUNBZ1BG
-SlVVSEp2Y0dWeWRHbGxjejRLSUNBZ0lDQWdQRlI1Y0dVK0NpQWdJQ0FnSUNBZ1BFUkVSazVoYldV
-K2RYSnVPbmRtCllUcHRienBvYjNSemNHOTBNbVJ2ZERBdGNHVnljSEp2ZG1sa1pYSnpkV0p6WTNK
-cGNIUnBiMjQ2TVM0d1BDOUVSRVpPWVcxbFBnb2cKSUNBZ0lDQThMMVI1Y0dVK0NpQWdJQ0E4TDFK
-VVVISnZjR1Z5ZEdsbGN6NEtJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQThUbTlrWlU1aApiV1UrYVRB
-d01Ud3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0
-WlQ1SWIyMWxVMUE4CkwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0Fn
-SUNBZ1BFNXZaR1ZPWVcxbFBrWnlhV1Z1Wkd4NVRtRnQKWlR3dlRtOWtaVTVoYldVK0NpQWdJQ0Fn
-SUNBZ0lDQThWbUZzZFdVK1EyVnVkSFZ5ZVNCSWIzVnpaVHd2Vm1Gc2RXVStDaUFnSUNBZwpJQ0Fn
-UEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQ
-a1pSUkU0OEwwNXZaR1ZPCllXMWxQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbTFwTmk1amJ5NTFh
-end2Vm1Gc2RXVStDaUFnSUNBZ0lDQWdQQzlPYjJSbFBnb2cKSUNBZ0lDQWdJRHhPYjJSbFBnb2dJ
-Q0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQbEp2WVcxcGJtZERiMjV6YjNKMGFYVnRUMGs4TDA1dgpa
-R1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBqRXhNakl6TXl3ME5EVTFOalk4TDFaaGJI
-VmxQZ29nSUNBZ0lDQWdJRHd2ClRtOWtaVDRLSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBOFRt
-OWtaVDRLSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrUTNKbFpHVnUKZEdsaGJEd3ZUbTlrWlU1aGJX
-VStDaUFnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlU1aGJXVStVbVZoYkcw
-OApMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbk5vWVd0bGJpNXpkR2x5Y21W
-a0xtTnZiVHd2Vm1Gc2RXVStDaUFnCklDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJS
-bFBnb2dJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQbFZ6WlhKdVlXMWwKVUdGemMzZHZjbVE4TDA1
-dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9iMlJs
-VG1GdApaVDVWYzJWeWJtRnRaVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gx
-WlQ1cVlXMWxjend2Vm1Gc2RXVStDaUFnCklDQWdJQ0FnSUNBOEwwNXZaR1UrQ2lBZ0lDQWdJQ0Fn
-SUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBsQmgKYzNOM2IzSmtQQzlP
-YjJSbFRtRnRaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUGxsdE9YVmFSRUYzVG5jOVBUd3ZW
-bUZzZFdVKwpDaUFnSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pUNEtJ
-Q0FnSUNBZ0lDQWdJQ0FnUEU1dlpHVk9ZVzFsClBrVkJVRTFsZEdodlpEd3ZUbTlrWlU1aGJXVStD
-aUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeE8KYjJSbFRtRnRa
-VDVGUVZCVWVYQmxQQzlPYjJSbFRtRnRaVDRLSUNBZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdVK01q
-RThMMVpoYkhWbApQZ29nSUNBZ0lDQWdJQ0FnSUNBOEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lE
-eE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ0lDQWdJRHhPCmIyUmxUbUZ0WlQ1SmJtNWxjazFsZEdodlpE
-d3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUGsxVExVTkkKUVZBdFZq
-SThMMVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4TDA1
-dlpHVStDaUFnSUNBZwpJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNB
-Z0lDQWdQRTV2WkdWT1lXMWxQa1JwWjJsMFlXeERaWEowCmFXWnBZMkYwWlR3dlRtOWtaVTVoYldV
-K0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWwKUGtO
-bGNuUnBabWxqWVhSbFZIbHdaVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gx
-WlQ1NE5UQTVkak04TDFaaApiSFZsUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0Fn
-SUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9iMlJsClRtRnRaVDVEWlhKMFUwaEJNalUy
-Um1sdVoyVnlVSEpwYm5ROEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4Vm1Gc2RXVSsK
-TVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1N
-V1l4WmpGbU1XWXhaakZtTVdZeApaakZtTVdZeFpqd3ZWbUZzZFdVK0NpQWdJQ0FnSUNBZ0lDQThM
-MDV2WkdVK0NpQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnCklEeE9iMlJsUGdvZ0lDQWdJ
-Q0FnSUNBZ1BFNXZaR1ZPWVcxbFBsTkpUVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBOFRt
-OWsKWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQa2xOVTBrOEwwNXZaR1ZPWVcxbFBn
-b2dJQ0FnSUNBZ0lDQWdJQ0E4Vm1GcwpkV1UrYVcxemFUd3ZWbUZzZFdVK0NpQWdJQ0FnSUNBZ0lD
-QThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnCklDQWdJQ0FnUEU1dlpH
-Vk9ZVzFsUGtWQlVGUjVjR1U4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdV
-K01qUTgKTDFaaGJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHd2VG05
-a1pUNEtJQ0FnSUNBZ1BDOU9iMlJsUGdvZwpJQ0FnUEM5T2IyUmxQZ29nSUR3dlRtOWtaVDRLUEM5
-TloyMTBWSEpsWlQ0SwoKLS17Ym91bmRhcnl9CkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24veC14
-NTA5LWNhLWNlcnQKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CgpMUzB0TFMxQ1JV
-ZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VSTFJFTkRRV2hEWjBGM1NVSkJaMGxLUVVs
-TWJFWmtkM3BNClZuVnlUVUV3UjBOVGNVZFRTV0l6UkZGRlFrTjNWVUZOUWtsNFJVUkJUMEpuVGxZ
-S1FrRk5WRUl3VmtKVlEwSkVVVlJGZDBob1kwNU4KVkZsM1RWUkZlVTFVUlRGTlJFVXhWMmhqVGsx
-cVdYZE5WRUUxVFZSRk1VMUVSVEZYYWtGVFRWSkJkd3BFWjFsRVZsRlJSRVYzWkVaUgpWa0ZuVVRC
-RmVFMUpTVUpKYWtGT1FtZHJjV2hyYVVjNWR6QkNRVkZGUmtGQlQwTkJVVGhCVFVsSlFrTm5TME5C
-VVVWQkNucHVRVkJWCmVqSTJUWE5oWlRSM2N6UXpZM3BTTkRFdlNqSlJkSEpUU1ZwVlMyMVdWWE5X
-ZFcxRVlsbEljbEJPZGxSWVMxTk5XRUZqWlhkUFVrUlIKV1ZnS1VuRjJTSFp3YmpoRGMyTkNNU3R2
-UjFoYWRraDNlR28wZWxZd1YwdHZTeko2WlZocllYVXpkbU41YkROSVNVdDFjRXBtY1RKVQpSVUZE
-WldaV2Ftb3dkQXBLVnl0WU16VlFSMWR3T1M5SU5YcEpWVTVXVGxacVV6ZFZiWE00TkVsMlMyaFNR
-amcxTVRKUVFqbFZlVWhoCloxaFpWbGcxUjFkd1FXTldjSGxtY214U0NrWkpPVkZrYUdnclVHSnJN
-SFY1YTNSa1ltWXZRMlJtWjBoUGIyVmljbFIwZDFKc2FrMHcKYjBSMFdDc3lRM1kyYWpCM1FrczNh
-RVE0Y0ZCMlpqRXJkWGtLUjNwamVtbG5RVlV2TkV0M04yVmFjWGxrWmpsQ0t6VlNkWEJTSzBsYQph
-WEJZTkRGNFJXbEpja3RTZDNGcE5URTNWMWQ2V0dOcVlVY3lZMDVpWmpRMU1RcDRjRWcxVUc1V00y
-a3hkSEV3TkdwTlIxRlZla1ozClNVUkJVVUZDYnpSSFFVMUlOSGRJVVZsRVZsSXdUMEpDV1VWR1NY
-ZFlOSFp6T0VKcFFtTlRZMjlrQ2pWdWIxcElVazA0UlRRcmFVMUYKU1VkQk1WVmtTWGRSTjAxRWJV
-RkdTWGRZTkhaek9FSnBRbU5UWTI5a05XNXZXa2hTVFRoRk5DdHBiMUpoYTBaRVFWTUtUVkpCZDBS
-bgpXVVJXVVZGRVJYZGtSbEZXUVdkUk1FVjRaMmRyUVdkMVZWWXpSRTEwVnpaemQwUkJXVVJXVWpC
-VVFrRlZkMEYzUlVJdmVrRk1RbWRPClZncElVVGhGUWtGTlEwRlJXWGRFVVZsS1MyOWFTV2gyWTA1
-QlVVVk1RbEZCUkdkblJVSkJSbVpSY1U5VVFUZFNkamRMSzJ4MVVUZHcKYm1Gek5FSlpkMGhGQ2ps
-SFJWQXZkVzlvZGpaTFQza3dWRWRSUm1KeVVsUnFSbTlNVms1Q09VSmFNWGx0VFVSYU1DOVVTWGRK
-VldNMwpkMmszWVRoME5XMUZjVmxJTVRVemQxY0tZVmR2YjJsVGFubE1UR2gxU1RSelRuSk9RMDkw
-YVhOa1FuRXljakpOUmxoME5tZ3diVUZSCldVOVFkamhTT0VzM0wyWm5VM2hIUm5GNmFIbE9iVzFX
-VEFveGNVSktiR1I0TXpSVGNIZHpWRUZNVVZaUVlqUm9SM2RLZWxwbWNqRlEKWTNCRlVYZzJlRTF1
-Vkd3NGVFVlhXa1V6VFhNNU9YVmhWWGhpVVhGSmQxSjFDa3huUVU5clRrTnRXVEp0T0RsV2FIcGhT
-RW94ZFZZNApOVUZrVFM5MFJDdFpjMjFzYm01cWREbE1Va05sYW1KQ2FYQnFTVWRxVDFoeVp6RktV
-Q3RzZUZZS2JYVk5OSFpJSzFBdmJXeHRlSE5RClVIb3daRFkxWWl0RlIyMUtXbkJ2VEd0UEwzUmtU
-azUyUTFsNmFrcHdWRVZYY0VWelR6Wk9UV2hMV1c4OUNpMHRMUzB0UlU1RUlFTkYKVWxSSlJrbERR
-VlJGTFMwdExTMEsKLS17Ym91bmRhcnl9LS0K
+TUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5
+PXtib3VuZGFyeX07IGNoYXJzZXQ9VVRGLTgKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFz
+ZTY0CgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9wYXNzcG9pbnQtcHJv
+ZmlsZTsgY2hhcnNldD1VVEYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKClBF
+MW5iWFJVY21WbElIaHRiRzV6UFNKemVXNWpiV3c2Wkcxa1pHWXhMaklpUGdvZ0lEeFdaWEpFVkVR
+K01TNHlQQzlXWlhKRVZFUSsKQ2lBZ1BFNXZaR1UrQ2lBZ0lDQThUbTlrWlU1aGJXVStVR1Z5VUhK
+dmRtbGtaWEpUZFdKelkzSnBjSFJwYjI0OEwwNXZaR1ZPWVcxbApQZ29nSUNBZ1BGSlVVSEp2Y0dW
+eWRHbGxjejRLSUNBZ0lDQWdQRlI1Y0dVK0NpQWdJQ0FnSUNBZ1BFUkVSazVoYldVK2RYSnVPbmRt
+CllUcHRienBvYjNSemNHOTBNbVJ2ZERBdGNHVnljSEp2ZG1sa1pYSnpkV0p6WTNKcGNIUnBiMjQ2
+TVM0d1BDOUVSRVpPWVcxbFBnb2cKSUNBZ0lDQThMMVI1Y0dVK0NpQWdJQ0E4TDFKVVVISnZjR1Z5
+ZEdsbGN6NEtJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQThUbTlrWlU1aApiV1UrYVRBd01Ud3ZUbTlr
+WlU1aGJXVStDaUFnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0WlQ1SWIyMWxV
+MUE4CkwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZa
+R1ZPWVcxbFBrWnlhV1Z1Wkd4NVRtRnQKWlR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQThW
+bUZzZFdVK1JYaGhiWEJzWlNCT1pYUjNiM0pyUEM5V1lXeDFaVDRLSUNBZwpJQ0FnSUNBOEwwNXZa
+R1UrQ2lBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrUmxGRVRq
+d3ZUbTlrClpVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBOFZtRnNkV1UrYUc5MGMzQnZkQzVsZUdGdGNH
+eGxMbTVsZER3dlZtRnNkV1UrQ2lBZ0lDQWcKSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUR4T2Iy
+UmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxKdllXMXBibWREYjI1egpiM0owYVhWdFQw
+azhMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQakV4TWpJek15dzBORFUxTmpZ
+OEwxWmhiSFZsClBnb2dJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNB
+Z0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBOFRtOWsKWlU1aGJXVStRM0psWkdWdWRHbGhiRHd2VG05
+a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05awpaVTVoYldV
+K1VtVmhiRzA4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUG1WNFlXMXdiR1V1
+WTI5dFBDOVdZV3gxClpUNEtJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ1BFNXZaR1Ur
+Q2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVTVoYldVK1ZYTmwKY201aGJXVlFZWE56ZDI5eVpEd3ZUbTlr
+WlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEU1dgpaR1ZP
+WVcxbFBsVnpaWEp1WVcxbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQ
+blZ6WlhJOEwxWmhiSFZsClBnb2dJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdQ
+RTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbFRtRnQKWlQ1UVlYTnpkMjl5WkR3dlRtOWta
+VTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhXWVd4MVpUNWpSMFo2WXpOa2RtTnRVVDA4TDFaaApi
+SFZsUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1UrQ2lBZ0lD
+QWdJQ0FnSUNBZ0lEeE9iMlJsClRtRnRaVDVGUVZCTlpYUm9iMlE4TDA1dlpHVk9ZVzFsUGdvZ0lD
+QWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWcKSUNBOFRtOWtaVTVoYldVK1JV
+RlFWSGx3WlR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQakl4UEM5
+VwpZV3gxWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4VG05
+a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnCklDQThUbTlrWlU1aGJXVStTVzV1WlhKTlpYUm9iMlE4TDA1
+dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQWdJRHhXWVd4MVpUNU4KVXkxRFNFRlFMVll5UEM5
+V1lXeDFaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJs
+UGdvZwpJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0Fn
+SUR4T2IyUmxUbUZ0WlQ1RWFXZHBkR0ZzClEyVnlkR2xtYVdOaGRHVThMMDV2WkdWT1lXMWxQZ29n
+SUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNURaWEow
+YVdacFkyRjBaVlI1Y0dVOEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4Vm1Gc2RXVStl
+RFV3T1hZegpQQzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnSUNBZ0lDQWdJ
+RHhPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4ClRtOWtaVTVoYldVK1EyVnlkRk5JUVRJMU5rWnBi
+bWRsY25CeWFXNTBQQzlPYjJSbFRtRnRaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BGWmgKYkhWbFBqRm1N
+V1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1X
+WXhaakZtTVdZeApaakZtTVdZeFpqRm1NV1k4TDFaaGJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2Iy
+UmxQZ29nSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnCklDQWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lD
+QWdJRHhPYjJSbFRtRnRaVDVUU1UwOEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWcKUEU1dlpH
+VStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0WlQ1SlRWTkpQQzlPYjJSbFRtRnRaVDRLSUNB
+Z0lDQWdJQ0FnSUNBZwpQRlpoYkhWbFBqRXlNelExTmlvOEwxWmhiSFZsUGdvZ0lDQWdJQ0FnSUNB
+Z1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1UrCkNpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJS
+bFRtRnRaVDVGUVZCVWVYQmxQQzlPYjJSbFRtRnRaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BGWmgKYkhW
+bFBqSXpQQzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnSUNBZ0lDQThMMDV2
+WkdVK0NpQWdJQ0FnSUR3dgpUbTlrWlQ0S0lDQWdJRHd2VG05a1pUNEtJQ0E4TDA1dlpHVStDand2
+VFdkdGRGUnlaV1UrCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94LXg1
+MDktY2EtY2VydApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKCkxTMHRMUzFDUlVk
+SlRpQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVJMUkVORFFXaERaMEYzU1VKQlowbEtRVWxN
+YkVaa2QzcE0KVm5WeVRVRXdSME5UY1VkVFNXSXpSRkZGUWtOM1ZVRk5Ra2w0UlVSQlQwSm5UbFlL
+UWtGTlZFSXdWa0pWUTBKRVVWUkZkMGhvWTA1TgpWRmwzVFZSRmVVMVVSVEZOUkVVeFYyaGpUazFx
+V1hkTlZFRTFUVlJGTVUxRVJURlhha0ZUVFZKQmR3cEVaMWxFVmxGUlJFVjNaRVpSClZrRm5VVEJG
+ZUUxSlNVSkpha0ZPUW1kcmNXaHJhVWM1ZHpCQ1FWRkZSa0ZCVDBOQlVUaEJUVWxKUWtOblMwTkJV
+VVZCQ25wdVFWQlYKZWpJMlRYTmhaVFIzY3pRelkzcFNOREV2U2pKUmRISlRTVnBWUzIxV1ZYTldk
+VzFFWWxsSWNsQk9kbFJZUzFOTldFRmpaWGRQVWtSUgpXVmdLVW5GMlNIWndiamhEYzJOQ01TdHZS
+MWhhZGtoM2VHbzBlbFl3VjB0dlN6SjZaVmhyWVhVemRtTjViRE5JU1V0MWNFcG1jVEpVClJVRkRa
+V1pXYW1vd2RBcEtWeXRZTXpWUVIxZHdPUzlJTlhwSlZVNVdUbFpxVXpkVmJYTTRORWwyUzJoU1Fq
+ZzFNVEpRUWpsVmVVaGgKWjFoWlZsZzFSMWR3UVdOV2NIbG1jbXhTQ2taSk9WRmthR2dyVUdKck1I
+VjVhM1JrWW1ZdlEyUm1aMGhQYjJWaWNsUjBkMUpzYWswdwpiMFIwV0NzeVEzWTJhakIzUWtzM2FF
+UTRjRkIyWmpFcmRYa0tSM3BqZW1sblFWVXZORXQzTjJWYWNYbGtaamxDS3pWU2RYQlNLMGxhCmFY
+QllOREY0UldsSmNrdFNkM0ZwTlRFM1YxZDZXR05xWVVjeVkwNWlaalExTVFwNGNFZzFVRzVXTTJr
+eGRIRXdOR3BOUjFGVmVrWjMKU1VSQlVVRkNielJIUVUxSU5IZElVVmxFVmxJd1QwSkNXVVZHU1hk
+WU5IWnpPRUpwUW1OVFkyOWtDalZ1YjFwSVVrMDRSVFFyYVUxRgpTVWRCTVZWa1NYZFJOMDFFYlVG
+R1NYZFlOSFp6T0VKcFFtTlRZMjlrTlc1dldraFNUVGhGTkN0cGIxSmhhMFpFUVZNS1RWSkJkMFJu
+CldVUldVVkZFUlhka1JsRldRV2RSTUVWNFoyZHJRV2QxVlZZelJFMTBWelp6ZDBSQldVUldVakJV
+UWtGVmQwRjNSVUl2ZWtGTVFtZE8KVmdwSVVUaEZRa0ZOUTBGUldYZEVVVmxLUzI5YVNXaDJZMDVC
+VVVWTVFsRkJSR2RuUlVKQlJtWlJjVTlVUVRkU2RqZExLMngxVVRkdwpibUZ6TkVKWmQwaEZDamxI
+UlZBdmRXOW9kalpMVDNrd1ZFZFJSbUp5VWxScVJtOU1WazVDT1VKYU1YbHRUVVJhTUM5VVNYZEpW
+V00zCmQyazNZVGgwTlcxRmNWbElNVFV6ZDFjS1lWZHZiMmxUYW5sTVRHaDFTVFJ6VG5KT1EwOTBh
+WE5rUW5FeWNqSk5SbGgwTm1nd2JVRlIKV1U5UWRqaFNPRXMzTDJablUzaEhSbkY2YUhsT2JXMVdU
+QW94Y1VKS2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVFMXVW
+R3c0ZUVWWFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhwaFNF
+b3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpGS1VD
+dHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNSa1Rr
+NTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmtsRFFW
+UkZMUzB0TFMwSwotLXtib3VuZGFyeX0tLQo=
\ No newline at end of file
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64
index 3fa97d1..7023453 100644
--- a/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64
@@ -1,85 +1,86 @@
-Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PXtib3VuZGFyeX0KQ29udGVu
-dC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBh
-cHBsaWNhdGlvbi94LXBhc3Nwb2ludC1wcm9maWxlCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6
-IGJhc2U2NAoKUEUxbmJYUlVjbVZsSUhodGJHNXpQU0p6ZVc1amJXdzZaRzFrWkdZeExqSWlQZ29n
-SUR4V1pYSkVWRVErTVM0eVBDOVdaWEpFVkVRKwpDaUFnUEU1dlpHVStDaUFnSUNBOFRtOWtaVTVo
-YldVK1VHVnlVSEp2ZG1sa1pYSlRkV0p6WTNKcGNIUnBiMjQ4TDA1dlpHVk9ZVzFsClBnb2dJQ0Fn
-UEZKVVVISnZjR1Z5ZEdsbGN6NEtJQ0FnSUNBZ1BGUjVjR1UrQ2lBZ0lDQWdJQ0FnUEVSRVJrNWhi
-V1UrZFhKdU9uZG0KWVRwdGJ6cG9iM1J6Y0c5ME1tUnZkREF0Y0dWeWNISnZkbWxrWlhKemRXSnpZ
-M0pwY0hScGIyNDZNUzR3UEM5RVJFWk9ZVzFsUGdvZwpJQ0FnSUNBOEwxUjVjR1UrQ2lBZ0lDQThM
-MUpVVUhKdmNHVnlkR2xsY3o0S0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBOFRtOWtaVTVoCmJXVSth
-VEF3TVR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJSbFRt
-RnRaVDVJYjIxbFUxQTgKTDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lD
-QWdJQ0FnUEU1dlpHVk9ZVzFsUGtaeWFXVnVaR3g1VG1GdApaVHd2VG05a1pVNWhiV1UrQ2lBZ0lD
-QWdJQ0FnSUNBOFZtRnNkV1UrUTJWdWRIVnllU0JJYjNWelpUd3ZWbUZzZFdVK0NpQWdJQ0FnCklD
-QWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcx
-bFBrWlJSRTQ4TDA1dlpHVk8KWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBtMXBOaTVqYnk1
-MWF6d3ZWbUZzZFdVK0NpQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZwpJQ0FnSUNBZ0lEeE9iMlJsUGdv
-Z0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBsSnZZVzFwYm1kRGIyNXpiM0owYVhWdFQwazhMMDV2
-ClpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUGpFeE1qSXpNeXcwTkRVMU5qWThMMVpo
-YkhWbFBnb2dJQ0FnSUNBZ0lEd3YKVG05a1pUNEtJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0E4
-VG05a1pUNEtJQ0FnSUNBZ0lDQThUbTlrWlU1aGJXVStRM0psWkdWdQpkR2xoYkR3dlRtOWtaVTVo
-YldVK0NpQWdJQ0FnSUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVTVoYldVK1VtVmhi
-RzA4CkwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBuTm9ZV3RsYmk1emRHbHlj
-bVZrTG1OdmJUd3ZWbUZzZFdVK0NpQWcKSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9i
-MlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBsVnpaWEp1WVcxbApVR0Z6YzNkdmNtUThM
-MDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2Iy
-UmxUbUZ0ClpUNVZjMlZ5Ym1GdFpUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUR4V1lX
-eDFaVDVxWVcxbGN6d3ZWbUZzZFdVK0NpQWcKSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lD
-QWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxCaApjM04zYjNKa1BD
-OU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbGx0T1hWYVJFRjNUbmM5UFR3
-dlZtRnNkV1UrCkNpQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0
-S0lDQWdJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWwKUGtWQlVFMWxkR2h2WkR3dlRtOWtaVTVoYldV
-K0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0FnSUR4TwpiMlJsVG1G
-dFpUNUZRVkJVZVhCbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnSUNBOFZtRnNkV1Ur
-TWpFOEwxWmhiSFZsClBnb2dJQ0FnSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lDQWdJQ0Fn
-SUR4T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeE8KYjJSbFRtRnRaVDVKYm01bGNrMWxkR2h2
-WkR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQazFUTFVOSQpRVkF0
-VmpJOEwxWmhiSFZsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThM
-MDV2WkdVK0NpQWdJQ0FnCklDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJ
-Q0FnSUNBZ1BFNXZaR1ZPWVcxbFBrUnBaMmwwWVd4RFpYSjAKYVdacFkyRjBaVHd2VG05a1pVNWhi
-V1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbApQ
-a05sY25ScFptbGpZWFJsVkhsd1pUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUR4V1lX
-eDFaVDU0TlRBNWRqTThMMVpoCmJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lD
-QWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNURaWEowVTBoQk1q
-VTJSbWx1WjJWeVVISnBiblE4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdV
-KwpNV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpG
-bU1XWXhaakZtTVdZeFpqRm1NV1l4ClpqRm1NV1l4Wmp3dlZtRnNkV1UrQ2lBZ0lDQWdJQ0FnSUNB
-OEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWcKSUR4T2IyUmxQZ29nSUNB
-Z0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxOSlRUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4
-VG05awpaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBrbE5VMGs4TDA1dlpHVk9ZVzFs
-UGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzCmRXVSthVzF6YVR3dlZtRnNkV1UrQ2lBZ0lDQWdJQ0Fn
-SUNBOEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWcKSUNBZ0lDQWdQRTV2
-WkdWT1lXMWxQa1ZCVUZSNWNHVThMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBOFZtRnNk
-V1UrTWpROApMMVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEd3ZU
-bTlrWlQ0S0lDQWdJQ0FnUEM5T2IyUmxQZ29nCklDQWdQQzlPYjJSbFBnb2dJRHd2VG05a1pUNEtQ
-QzlOWjIxMFZISmxaVDRLCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94
-LXg1MDktY2EtY2VydApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKCkxTMHRMUzFD
-UlVkSlRpQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVJMUkVORFFXaERaMEYzU1VKQlowbEtR
-VWxNYkVaa2QzcE0KVm5WeVRVRXdSME5UY1VkVFNXSXpSRkZGUWtOM1ZVRk5Ra2w0UlVSQlQwSm5U
-bFlLUWtGTlZFSXdWa0pWUTBKRVVWUkZkMGhvWTA1TgpWRmwzVFZSRmVVMVVSVEZOUkVVeFYyaGpU
-azFxV1hkTlZFRTFUVlJGTVUxRVJURlhha0ZUVFZKQmR3cEVaMWxFVmxGUlJFVjNaRVpSClZrRm5V
-VEJGZUUxSlNVSkpha0ZPUW1kcmNXaHJhVWM1ZHpCQ1FWRkZSa0ZCVDBOQlVUaEJUVWxKUWtOblMw
-TkJVVVZCQ25wdVFWQlYKZWpJMlRYTmhaVFIzY3pRelkzcFNOREV2U2pKUmRISlRTVnBWUzIxV1ZY
-TldkVzFFWWxsSWNsQk9kbFJZUzFOTldFRmpaWGRQVWtSUgpXVmdLVW5GMlNIWndiamhEYzJOQ01T
-dHZSMWhhZGtoM2VHbzBlbFl3VjB0dlN6SjZaVmhyWVhVemRtTjViRE5JU1V0MWNFcG1jVEpVClJV
-RkRaV1pXYW1vd2RBcEtWeXRZTXpWUVIxZHdPUzlJTlhwSlZVNVdUbFpxVXpkVmJYTTRORWwyUzJo
-U1FqZzFNVEpRUWpsVmVVaGgKWjFoWlZsZzFSMWR3UVdOV2NIbG1jbXhTQ2taSk9WRmthR2dyVUdK
-ck1IVjVhM1JrWW1ZdlEyUm1aMGhQYjJWaWNsUjBkMUpzYWswdwpiMFIwV0NzeVEzWTJhakIzUWtz
-M2FFUTRjRkIyWmpFcmRYa0tSM3BqZW1sblFWVXZORXQzTjJWYWNYbGtaamxDS3pWU2RYQlNLMGxh
-CmFYQllOREY0UldsSmNrdFNkM0ZwTlRFM1YxZDZXR05xWVVjeVkwNWlaalExTVFwNGNFZzFVRzVX
-TTJreGRIRXdOR3BOUjFGVmVrWjMKU1VSQlVVRkNielJIUVUxSU5IZElVVmxFVmxJd1QwSkNXVVZH
-U1hkWU5IWnpPRUpwUW1OVFkyOWtDalZ1YjFwSVVrMDRSVFFyYVUxRgpTVWRCTVZWa1NYZFJOMDFF
-YlVGR1NYZFlOSFp6T0VKcFFtTlRZMjlrTlc1dldraFNUVGhGTkN0cGIxSmhhMFpFUVZNS1RWSkJk
-MFJuCldVUldVVkZFUlhka1JsRldRV2RSTUVWNFoyZHJRV2QxVlZZelJFMTBWelp6ZDBSQldVUldV
-akJVUWtGVmQwRjNSVUl2ZWtGTVFtZE8KVmdwSVVUaEZRa0ZOUTBGUldYZEVVVmxLUzI5YVNXaDJZ
-MDVCVVVWTVFsRkJSR2RuUlVKQlJtWlJjVTlVUVRkU2RqZExLMngxVVRkdwpibUZ6TkVKWmQwaEZD
-amxIUlZBdmRXOW9kalpMVDNrd1ZFZFJSbUp5VWxScVJtOU1WazVDT1VKYU1YbHRUVVJhTUM5VVNY
-ZEpWV00zCmQyazNZVGgwTlcxRmNWbElNVFV6ZDFjS1lWZHZiMmxUYW5sTVRHaDFTVFJ6VG5KT1Ew
-OTBhWE5rUW5FeWNqSk5SbGgwTm1nd2JVRlIKV1U5UWRqaFNPRXMzTDJablUzaEhSbkY2YUhsT2JX
-MVdUQW94Y1VKS2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVF
-MXVWR3c0ZUVWWFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhw
-aFNFb3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpG
-S1VDdHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNS
-a1RrNTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmts
-RFFWUkZMUzB0TFMwSwo=
+TUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5
+PXtib3VuZGFyeX07IGNoYXJzZXQ9VVRGLTgKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFz
+ZTY0CgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94LXBhc3Nwb2ludC1w
+cm9maWxlOyBjaGFyc2V0PVVURi04CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJhc2U2NAoK
+UEUxbmJYUlVjbVZsSUhodGJHNXpQU0p6ZVc1amJXdzZaRzFrWkdZeExqSWlQZ29nSUR4V1pYSkVW
+RVErTVM0eVBDOVdaWEpFVkVRKwpDaUFnUEU1dlpHVStDaUFnSUNBOFRtOWtaVTVoYldVK1VHVnlV
+SEp2ZG1sa1pYSlRkV0p6WTNKcGNIUnBiMjQ4TDA1dlpHVk9ZVzFsClBnb2dJQ0FnUEZKVVVISnZj
+R1Z5ZEdsbGN6NEtJQ0FnSUNBZ1BGUjVjR1UrQ2lBZ0lDQWdJQ0FnUEVSRVJrNWhiV1UrZFhKdU9u
+ZG0KWVRwdGJ6cG9iM1J6Y0c5ME1tUnZkREF0Y0dWeWNISnZkbWxrWlhKemRXSnpZM0pwY0hScGIy
+NDZNUzR3UEM5RVJFWk9ZVzFsUGdvZwpJQ0FnSUNBOEwxUjVjR1UrQ2lBZ0lDQThMMUpVVUhKdmNH
+VnlkR2xsY3o0S0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBOFRtOWtaVTVoCmJXVSthVEF3TVR3dlRt
+OWtaVTVoYldVK0NpQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJSbFRtRnRaVDVJYjIx
+bFUxQTgKTDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1
+dlpHVk9ZVzFsUGtaeWFXVnVaR3g1VG1GdApaVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNB
+OFZtRnNkV1UrUlhoaGJYQnNaU0JPWlhSM2IzSnJQQzlXWVd4MVpUNEtJQ0FnCklDQWdJQ0E4TDA1
+dlpHVStDaUFnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlU1aGJXVStSbEZF
+VGp3dlRtOWsKWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4Vm1Gc2RXVSthRzkwYzNCdmRDNWxlR0Z0
+Y0d4bExtNWxkRHd2Vm1Gc2RXVStDaUFnSUNBZwpJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHhP
+YjJSbFBnb2dJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQbEp2WVcxcGJtZERiMjV6CmIzSjBhWFZ0
+VDBrOEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBqRXhNakl6TXl3ME5EVTFO
+alk4TDFaaGJIVmwKUGdvZ0lDQWdJQ0FnSUR3dlRtOWtaVDRLSUNBZ0lDQWdQQzlPYjJSbFBnb2dJ
+Q0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0E4VG05awpaVTVoYldVK1EzSmxaR1Z1ZEdsaGJEd3ZU
+bTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrClpVNWhi
+V1UrVW1WaGJHMDhMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbVY0WVcxd2JH
+VXVZMjl0UEM5V1lXeDEKWlQ0S0lDQWdJQ0FnSUNBOEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnUEU1dlpH
+VStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrVlhObApjbTVoYldWUVlYTnpkMjl5WkR3dlRt
+OWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQRTV2ClpH
+Vk9ZVzFsUGxWelpYSnVZVzFsUEM5T2IyUmxUbUZ0WlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQRlpoYkhW
+bFBuVnpaWEk4TDFaaGJIVmwKUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNB
+Z1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9iMlJsVG1GdApaVDVRWVhOemQyOXlaRHd2VG05
+a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gxWlQ1alIwWjZZek5rZG1OdFVUMDhMMVpo
+CmJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFn
+SUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNUZRVkJOWlhSb2IyUThMMDV2WkdWT1lXMWxQZ29n
+SUNBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZwpJQ0E4VG05a1pVNWhiV1Ur
+UlVGUVZIbHdaVHd2VG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBqSXhQ
+QzlXCllXeDFaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThU
+bTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWcKSUNBOFRtOWtaVTVoYldVK1NXNXVaWEpOWlhSb2IyUThM
+MDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gxWlQ1TgpVeTFEU0VGUUxWWXlQ
+QzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2Iy
+UmxQZ29nCklDQWdJQ0FnSUR3dlRtOWtaVDRLSUNBZ0lDQWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lD
+QWdJRHhPYjJSbFRtRnRaVDVFYVdkcGRHRnMKUTJWeWRHbG1hV05oZEdVOEwwNXZaR1ZPWVcxbFBn
+b2dJQ0FnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbApUbUZ0WlQ1RFpY
+SjBhV1pwWTJGMFpWUjVjR1U4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdV
+K2VEVXdPWFl6ClBDOVdZV3gxWlQ0S0lDQWdJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNB
+Z0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ0lDQTgKVG05a1pVNWhiV1UrUTJWeWRGTklRVEkxTmta
+cGJtZGxjbkJ5YVc1MFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaApiSFZsUGpG
+bU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZt
+TVdZeFpqRm1NV1l4ClpqRm1NV1l4WmpGbU1XWThMMVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdQQzlP
+YjJSbFBnb2dJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWcKSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0Fn
+SUNBZ0lEeE9iMlJsVG1GdFpUNVRTVTA4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZwpQRTV2
+WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbFRtRnRaVDVKVFZOSlBDOU9iMlJsVG1GdFpUNEtJ
+Q0FnSUNBZ0lDQWdJQ0FnClBGWmhiSFZsUGpFeU16UTFOaW84TDFaaGJIVmxQZ29nSUNBZ0lDQWdJ
+Q0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVSsKQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9i
+MlJsVG1GdFpUNUZRVkJVZVhCbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaApi
+SFZsUGpJelBDOVdZV3gxWlQ0S0lDQWdJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNBOEww
+NXZaR1UrQ2lBZ0lDQWdJRHd2ClRtOWtaVDRLSUNBZ0lEd3ZUbTlrWlQ0S0lDQThMMDV2WkdVK0Nq
+d3ZUV2R0ZEZSeVpXVSsKCi0te2JvdW5kYXJ5fQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL3gt
+eDUwOS1jYS1jZXJ0CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJhc2U2NAoKTFMwdExTMUNS
+VWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVUkxSRU5EUVdoRFowRjNTVUpCWjBsS1FV
+bE1iRVprZDNwTQpWblZ5VFVFd1IwTlRjVWRUU1dJelJGRkZRa04zVlVGTlFrbDRSVVJCVDBKblRs
+WUtRa0ZOVkVJd1ZrSlZRMEpFVVZSRmQwaG9ZMDVOClZGbDNUVlJGZVUxVVJURk5SRVV4VjJoalRr
+MXFXWGROVkVFMVRWUkZNVTFFUlRGWGFrRlRUVkpCZHdwRVoxbEVWbEZSUkVWM1pFWlIKVmtGblVU
+QkZlRTFKU1VKSmFrRk9RbWRyY1docmFVYzVkekJDUVZGRlJrRkJUME5CVVRoQlRVbEpRa05uUzBO
+QlVVVkJDbnB1UVZCVgplakkyVFhOaFpUUjNjelF6WTNwU05ERXZTakpSZEhKVFNWcFZTMjFXVlhO
+V2RXMUVZbGxJY2xCT2RsUllTMU5OV0VGalpYZFBVa1JSCldWZ0tVbkYyU0had2JqaERjMk5DTVN0
+dlIxaGFka2gzZUdvMGVsWXdWMHR2U3pKNlpWaHJZWFV6ZG1ONWJETklTVXQxY0VwbWNUSlUKUlVG
+RFpXWldhbW93ZEFwS1Z5dFlNelZRUjFkd09TOUlOWHBKVlU1V1RsWnFVemRWYlhNNE5FbDJTMmhT
+UWpnMU1USlFRamxWZVVoaApaMWhaVmxnMVIxZHdRV05XY0hsbWNteFNDa1pKT1ZGa2FHZ3JVR0py
+TUhWNWEzUmtZbVl2UTJSbVowaFBiMlZpY2xSMGQxSnNhazB3CmIwUjBXQ3N5UTNZMmFqQjNRa3Mz
+YUVRNGNGQjJaakVyZFhrS1IzcGplbWxuUVZVdk5FdDNOMlZhY1hsa1pqbENLelZTZFhCU0swbGEK
+YVhCWU5ERjRSV2xKY2t0U2QzRnBOVEUzVjFkNldHTnFZVWN5WTA1aVpqUTFNUXA0Y0VnMVVHNVdN
+Mmt4ZEhFd05HcE5SMUZWZWtaMwpTVVJCVVVGQ2J6UkhRVTFJTkhkSVVWbEVWbEl3VDBKQ1dVVkdT
+WGRZTkhaek9FSnBRbU5UWTI5a0NqVnViMXBJVWswNFJUUXJhVTFGClNVZEJNVlZrU1hkUk4wMUVi
+VUZHU1hkWU5IWnpPRUpwUW1OVFkyOWtOVzV2V2toU1RUaEZOQ3RwYjFKaGEwWkVRVk1LVFZKQmQw
+Um4KV1VSV1VWRkVSWGRrUmxGV1FXZFJNRVY0WjJkclFXZDFWVll6UkUxMFZ6WnpkMFJCV1VSV1Vq
+QlVRa0ZWZDBGM1JVSXZla0ZNUW1kTwpWZ3BJVVRoRlFrRk5RMEZSV1hkRVVWbEtTMjlhU1doMlkw
+NUJVVVZNUWxGQlJHZG5SVUpCUm1aUmNVOVVRVGRTZGpkTEsyeDFVVGR3CmJtRnpORUpaZDBoRkNq
+bEhSVkF2ZFc5b2RqWkxUM2t3VkVkUlJtSnlVbFJxUm05TVZrNUNPVUphTVhsdFRVUmFNQzlVU1hk
+SlZXTTMKZDJrM1lUaDBOVzFGY1ZsSU1UVXpkMWNLWVZkdmIybFRhbmxNVEdoMVNUUnpUbkpPUTA5
+MGFYTmtRbkV5Y2pKTlJsaDBObWd3YlVGUgpXVTlRZGpoU09FczNMMlpuVTNoSFJuRjZhSGxPYlcx
+V1RBb3hjVUpLYkdSNE16UlRjSGR6VkVGTVVWWlFZalJvUjNkS2VscG1jakZRClkzQkZVWGcyZUUx
+dVZHdzRlRVZYV2tVelRYTTVPWFZoVlhoaVVYRkpkMUoxQ2t4blFVOXJUa050V1RKdE9EbFdhSHBo
+U0VveGRWWTQKTlVGa1RTOTBSQ3RaYzIxc2JtNXFkRGxNVWtObGFtSkNhWEJxU1VkcVQxaHlaekZL
+VUN0c2VGWUtiWFZOTkhaSUsxQXZiV3h0ZUhOUQpVSG93WkRZMVlpdEZSMjFLV25CdlRHdFBMM1Jr
+VGs1MlExbDZha3B3VkVWWGNFVnpUelpPVFdoTFdXODlDaTB0TFMwdFJVNUVJRU5GClVsUkpSa2xE
+UVZSRkxTMHRMUzBLCg==
\ No newline at end of file
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64
index 975f8e5..5c23f61 100644
--- a/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64
@@ -1,85 +1,86 @@
-Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PXtib3VuZGFyeX0KQ29udGVu
-dC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTMyCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBh
-cHBsaWNhdGlvbi94LXBhc3Nwb2ludC1wcm9maWxlCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6
-IGJhc2U2NAoKUEUxbmJYUlVjbVZsSUhodGJHNXpQU0p6ZVc1amJXdzZaRzFrWkdZeExqSWlQZ29n
-SUR4V1pYSkVWRVErTVM0eVBDOVdaWEpFVkVRKwpDaUFnUEU1dlpHVStDaUFnSUNBOFRtOWtaVTVo
-YldVK1VHVnlVSEp2ZG1sa1pYSlRkV0p6WTNKcGNIUnBiMjQ4TDA1dlpHVk9ZVzFsClBnb2dJQ0Fn
-UEZKVVVISnZjR1Z5ZEdsbGN6NEtJQ0FnSUNBZ1BGUjVjR1UrQ2lBZ0lDQWdJQ0FnUEVSRVJrNWhi
-V1UrZFhKdU9uZG0KWVRwdGJ6cG9iM1J6Y0c5ME1tUnZkREF0Y0dWeWNISnZkbWxrWlhKemRXSnpZ
-M0pwY0hScGIyNDZNUzR3UEM5RVJFWk9ZVzFsUGdvZwpJQ0FnSUNBOEwxUjVjR1UrQ2lBZ0lDQThM
-MUpVVUhKdmNHVnlkR2xsY3o0S0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBOFRtOWtaVTVoCmJXVSth
-VEF3TVR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJSbFRt
-RnRaVDVJYjIxbFUxQTgKTDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lD
-QWdJQ0FnUEU1dlpHVk9ZVzFsUGtaeWFXVnVaR3g1VG1GdApaVHd2VG05a1pVNWhiV1UrQ2lBZ0lD
-QWdJQ0FnSUNBOFZtRnNkV1UrUTJWdWRIVnllU0JJYjNWelpUd3ZWbUZzZFdVK0NpQWdJQ0FnCklD
-QWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcx
-bFBrWlJSRTQ4TDA1dlpHVk8KWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBtMXBOaTVqYnk1
-MWF6d3ZWbUZzZFdVK0NpQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZwpJQ0FnSUNBZ0lEeE9iMlJsUGdv
-Z0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBsSnZZVzFwYm1kRGIyNXpiM0owYVhWdFQwazhMMDV2
-ClpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUGpFeE1qSXpNeXcwTkRVMU5qWThMMVpo
-YkhWbFBnb2dJQ0FnSUNBZ0lEd3YKVG05a1pUNEtJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0E4
-VG05a1pUNEtJQ0FnSUNBZ0lDQThUbTlrWlU1aGJXVStRM0psWkdWdQpkR2xoYkR3dlRtOWtaVTVo
-YldVK0NpQWdJQ0FnSUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVTVoYldVK1VtVmhi
-RzA4CkwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBuTm9ZV3RsYmk1emRHbHlj
-bVZrTG1OdmJUd3ZWbUZzZFdVK0NpQWcKSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9i
-MlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBsVnpaWEp1WVcxbApVR0Z6YzNkdmNtUThM
-MDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2Iy
-UmxUbUZ0ClpUNVZjMlZ5Ym1GdFpUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUR4V1lX
-eDFaVDVxWVcxbGN6d3ZWbUZzZFdVK0NpQWcKSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lD
-QWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxCaApjM04zYjNKa1BD
-OU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQbGx0T1hWYVJFRjNUbmM5UFR3
-dlZtRnNkV1UrCkNpQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0
-S0lDQWdJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWwKUGtWQlVFMWxkR2h2WkR3dlRtOWtaVTVoYldV
-K0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0FnSUR4TwpiMlJsVG1G
-dFpUNUZRVkJVZVhCbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnSUNBOFZtRnNkV1Ur
-TWpFOEwxWmhiSFZsClBnb2dJQ0FnSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnSUNBZ0lDQWdJQ0Fn
-SUR4T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeE8KYjJSbFRtRnRaVDVKYm01bGNrMWxkR2h2
-WkR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQazFUTFVOSQpRVkF0
-VmpJOEwxWmhiSFZsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThM
-MDV2WkdVK0NpQWdJQ0FnCklDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJ
-Q0FnSUNBZ1BFNXZaR1ZPWVcxbFBrUnBaMmwwWVd4RFpYSjAKYVdacFkyRjBaVHd2VG05a1pVNWhi
-V1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbApQ
-a05sY25ScFptbGpZWFJsVkhsd1pUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0FnSUR4V1lX
-eDFaVDU0TlRBNWRqTThMMVpoCmJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lD
-QWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNURaWEowVTBoQk1q
-VTJSbWx1WjJWeVVISnBiblE4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzZFdV
-KwpNV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpG
-bU1XWXhaakZtTVdZeFpqRm1NV1l4ClpqRm1NV1l4Wmp3dlZtRnNkV1UrQ2lBZ0lDQWdJQ0FnSUNB
-OEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWcKSUR4T2IyUmxQZ29nSUNB
-Z0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxOSlRUd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4
-VG05awpaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BFNXZaR1ZPWVcxbFBrbE5VMGs4TDA1dlpHVk9ZVzFs
-UGdvZ0lDQWdJQ0FnSUNBZ0lDQThWbUZzCmRXVSthVzF6YVR3dlZtRnNkV1UrQ2lBZ0lDQWdJQ0Fn
-SUNBOEwwNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWcKSUNBZ0lDQWdQRTV2
-WkdWT1lXMWxQa1ZCVUZSNWNHVThMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBOFZtRnNk
-V1UrTWpROApMMVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEd3ZU
-bTlrWlQ0S0lDQWdJQ0FnUEM5T2IyUmxQZ29nCklDQWdQQzlPYjJSbFBnb2dJRHd2VG05a1pUNEtQ
-QzlOWjIxMFZISmxaVDRLCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94
-LXg1MDktY2EtY2VydApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKCkxTMHRMUzFD
-UlVkSlRpQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVJMUkVORFFXaERaMEYzU1VKQlowbEtR
-VWxNYkVaa2QzcE0KVm5WeVRVRXdSME5UY1VkVFNXSXpSRkZGUWtOM1ZVRk5Ra2w0UlVSQlQwSm5U
-bFlLUWtGTlZFSXdWa0pWUTBKRVVWUkZkMGhvWTA1TgpWRmwzVFZSRmVVMVVSVEZOUkVVeFYyaGpU
-azFxV1hkTlZFRTFUVlJGTVUxRVJURlhha0ZUVFZKQmR3cEVaMWxFVmxGUlJFVjNaRVpSClZrRm5V
-VEJGZUUxSlNVSkpha0ZPUW1kcmNXaHJhVWM1ZHpCQ1FWRkZSa0ZCVDBOQlVUaEJUVWxKUWtOblMw
-TkJVVVZCQ25wdVFWQlYKZWpJMlRYTmhaVFIzY3pRelkzcFNOREV2U2pKUmRISlRTVnBWUzIxV1ZY
-TldkVzFFWWxsSWNsQk9kbFJZUzFOTldFRmpaWGRQVWtSUgpXVmdLVW5GMlNIWndiamhEYzJOQ01T
-dHZSMWhhZGtoM2VHbzBlbFl3VjB0dlN6SjZaVmhyWVhVemRtTjViRE5JU1V0MWNFcG1jVEpVClJV
-RkRaV1pXYW1vd2RBcEtWeXRZTXpWUVIxZHdPUzlJTlhwSlZVNVdUbFpxVXpkVmJYTTRORWwyUzJo
-U1FqZzFNVEpRUWpsVmVVaGgKWjFoWlZsZzFSMWR3UVdOV2NIbG1jbXhTQ2taSk9WRmthR2dyVUdK
-ck1IVjVhM1JrWW1ZdlEyUm1aMGhQYjJWaWNsUjBkMUpzYWswdwpiMFIwV0NzeVEzWTJhakIzUWtz
-M2FFUTRjRkIyWmpFcmRYa0tSM3BqZW1sblFWVXZORXQzTjJWYWNYbGtaamxDS3pWU2RYQlNLMGxh
-CmFYQllOREY0UldsSmNrdFNkM0ZwTlRFM1YxZDZXR05xWVVjeVkwNWlaalExTVFwNGNFZzFVRzVX
-TTJreGRIRXdOR3BOUjFGVmVrWjMKU1VSQlVVRkNielJIUVUxSU5IZElVVmxFVmxJd1QwSkNXVVZH
-U1hkWU5IWnpPRUpwUW1OVFkyOWtDalZ1YjFwSVVrMDRSVFFyYVUxRgpTVWRCTVZWa1NYZFJOMDFF
-YlVGR1NYZFlOSFp6T0VKcFFtTlRZMjlrTlc1dldraFNUVGhGTkN0cGIxSmhhMFpFUVZNS1RWSkJk
-MFJuCldVUldVVkZFUlhka1JsRldRV2RSTUVWNFoyZHJRV2QxVlZZelJFMTBWelp6ZDBSQldVUldV
-akJVUWtGVmQwRjNSVUl2ZWtGTVFtZE8KVmdwSVVUaEZRa0ZOUTBGUldYZEVVVmxLUzI5YVNXaDJZ
-MDVCVVVWTVFsRkJSR2RuUlVKQlJtWlJjVTlVUVRkU2RqZExLMngxVVRkdwpibUZ6TkVKWmQwaEZD
-amxIUlZBdmRXOW9kalpMVDNrd1ZFZFJSbUp5VWxScVJtOU1WazVDT1VKYU1YbHRUVVJhTUM5VVNY
-ZEpWV00zCmQyazNZVGgwTlcxRmNWbElNVFV6ZDFjS1lWZHZiMmxUYW5sTVRHaDFTVFJ6VG5KT1Ew
-OTBhWE5rUW5FeWNqSk5SbGgwTm1nd2JVRlIKV1U5UWRqaFNPRXMzTDJablUzaEhSbkY2YUhsT2JX
-MVdUQW94Y1VKS2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVF
-MXVWR3c0ZUVWWFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhw
-aFNFb3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpG
-S1VDdHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNS
-a1RrNTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmts
-RFFWUkZMUzB0TFMwSwotLXtib3VuZGFyeX0tLQo=
+TUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5
+PXtib3VuZGFyeX07IGNoYXJzZXQ9VVRGLTgKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogOGJp
+dAoKLS17Ym91bmRhcnl9CkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24veC1wYXNzcG9pbnQtcHJv
+ZmlsZTsgY2hhcnNldD1VVEYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKClBF
+MW5iWFJVY21WbElIaHRiRzV6UFNKemVXNWpiV3c2Wkcxa1pHWXhMaklpUGdvZ0lEeFdaWEpFVkVR
+K01TNHlQQzlXWlhKRVZFUSsKQ2lBZ1BFNXZaR1UrQ2lBZ0lDQThUbTlrWlU1aGJXVStVR1Z5VUhK
+dmRtbGtaWEpUZFdKelkzSnBjSFJwYjI0OEwwNXZaR1ZPWVcxbApQZ29nSUNBZ1BGSlVVSEp2Y0dW
+eWRHbGxjejRLSUNBZ0lDQWdQRlI1Y0dVK0NpQWdJQ0FnSUNBZ1BFUkVSazVoYldVK2RYSnVPbmRt
+CllUcHRienBvYjNSemNHOTBNbVJ2ZERBdGNHVnljSEp2ZG1sa1pYSnpkV0p6WTNKcGNIUnBiMjQ2
+TVM0d1BDOUVSRVpPWVcxbFBnb2cKSUNBZ0lDQThMMVI1Y0dVK0NpQWdJQ0E4TDFKVVVISnZjR1Z5
+ZEdsbGN6NEtJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQThUbTlrWlU1aApiV1UrYVRBd01Ud3ZUbTlr
+WlU1aGJXVStDaUFnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0WlQ1SWIyMWxV
+MUE4CkwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZa
+R1ZPWVcxbFBrWnlhV1Z1Wkd4NVRtRnQKWlR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQThW
+bUZzZFdVK1JYaGhiWEJzWlNCT1pYUjNiM0pyUEM5V1lXeDFaVDRLSUNBZwpJQ0FnSUNBOEwwNXZa
+R1UrQ2lBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrUmxGRVRq
+d3ZUbTlrClpVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBOFZtRnNkV1UrYUc5MGMzQnZkQzVsZUdGdGNH
+eGxMbTVsZER3dlZtRnNkV1UrQ2lBZ0lDQWcKSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUR4T2Iy
+UmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGxKdllXMXBibWREYjI1egpiM0owYVhWdFQw
+azhMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQakV4TWpJek15dzBORFUxTmpZ
+OEwxWmhiSFZsClBnb2dJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNB
+Z0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBOFRtOWsKWlU1aGJXVStRM0psWkdWdWRHbGhiRHd2VG05
+a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05awpaVTVoYldV
+K1VtVmhiRzA4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ1BGWmhiSFZsUG1WNFlXMXdiR1V1
+WTI5dFBDOVdZV3gxClpUNEtJQ0FnSUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZ1BFNXZaR1Ur
+Q2lBZ0lDQWdJQ0FnSUNBOFRtOWtaVTVoYldVK1ZYTmwKY201aGJXVlFZWE56ZDI5eVpEd3ZUbTlr
+WlU1aGJXVStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEU1dgpaR1ZP
+WVcxbFBsVnpaWEp1WVcxbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQ
+blZ6WlhJOEwxWmhiSFZsClBnb2dJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdQ
+RTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJSbFRtRnQKWlQ1UVlYTnpkMjl5WkR3dlRtOWta
+VTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhXWVd4MVpUNWpSMFo2WXpOa2RtTnRVVDA4TDFaaApi
+SFZsUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1UrQ2lBZ0lD
+QWdJQ0FnSUNBZ0lEeE9iMlJsClRtRnRaVDVGUVZCTlpYUm9iMlE4TDA1dlpHVk9ZVzFsUGdvZ0lD
+QWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWcKSUNBOFRtOWtaVTVoYldVK1JV
+RlFWSGx3WlR3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQakl4UEM5
+VwpZV3gxWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4VG05
+a1pUNEtJQ0FnSUNBZ0lDQWdJQ0FnCklDQThUbTlrWlU1aGJXVStTVzV1WlhKTlpYUm9iMlE4TDA1
+dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNBZ0lDQWdJRHhXWVd4MVpUNU4KVXkxRFNFRlFMVll5UEM5
+V1lXeDFaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BDOU9iMlJs
+UGdvZwpJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0Fn
+SUR4T2IyUmxUbUZ0WlQ1RWFXZHBkR0ZzClEyVnlkR2xtYVdOaGRHVThMMDV2WkdWT1lXMWxQZ29n
+SUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmwKVG1GdFpUNURaWEow
+YVdacFkyRjBaVlI1Y0dVOEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4Vm1Gc2RXVStl
+RFV3T1hZegpQQzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnSUNBZ0lDQWdJ
+RHhPYjJSbFBnb2dJQ0FnSUNBZ0lDQWdJQ0E4ClRtOWtaVTVoYldVK1EyVnlkRk5JUVRJMU5rWnBi
+bWRsY25CeWFXNTBQQzlPYjJSbFRtRnRaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BGWmgKYkhWbFBqRm1N
+V1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1X
+WXhaakZtTVdZeApaakZtTVdZeFpqRm1NV1k4TDFaaGJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2Iy
+UmxQZ29nSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnCklDQWdJQ0E4VG05a1pUNEtJQ0FnSUNBZ0lD
+QWdJRHhPYjJSbFRtRnRaVDVUU1UwOEwwNXZaR1ZPWVcxbFBnb2dJQ0FnSUNBZ0lDQWcKUEU1dlpH
+VStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0WlQ1SlRWTkpQQzlPYjJSbFRtRnRaVDRLSUNB
+Z0lDQWdJQ0FnSUNBZwpQRlpoYkhWbFBqRXlNelExTmlvOEwxWmhiSFZsUGdvZ0lDQWdJQ0FnSUNB
+Z1BDOU9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ1BFNXZaR1UrCkNpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJS
+bFRtRnRaVDVGUVZCVWVYQmxQQzlPYjJSbFRtRnRaVDRLSUNBZ0lDQWdJQ0FnSUNBZ1BGWmgKYkhW
+bFBqSXpQQzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnSUNBZ0lDQThMMDV2
+WkdVK0NpQWdJQ0FnSUR3dgpUbTlrWlQ0S0lDQWdJRHd2VG05a1pUNEtJQ0E4TDA1dlpHVStDand2
+VFdkdGRGUnlaV1UrCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94LXg1
+MDktY2EtY2VydApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQKCkxTMHRMUzFDUlVk
+SlRpQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVJMUkVORFFXaERaMEYzU1VKQlowbEtRVWxN
+YkVaa2QzcE0KVm5WeVRVRXdSME5UY1VkVFNXSXpSRkZGUWtOM1ZVRk5Ra2w0UlVSQlQwSm5UbFlL
+UWtGTlZFSXdWa0pWUTBKRVVWUkZkMGhvWTA1TgpWRmwzVFZSRmVVMVVSVEZOUkVVeFYyaGpUazFx
+V1hkTlZFRTFUVlJGTVUxRVJURlhha0ZUVFZKQmR3cEVaMWxFVmxGUlJFVjNaRVpSClZrRm5VVEJG
+ZUUxSlNVSkpha0ZPUW1kcmNXaHJhVWM1ZHpCQ1FWRkZSa0ZCVDBOQlVUaEJUVWxKUWtOblMwTkJV
+VVZCQ25wdVFWQlYKZWpJMlRYTmhaVFIzY3pRelkzcFNOREV2U2pKUmRISlRTVnBWUzIxV1ZYTldk
+VzFFWWxsSWNsQk9kbFJZUzFOTldFRmpaWGRQVWtSUgpXVmdLVW5GMlNIWndiamhEYzJOQ01TdHZS
+MWhhZGtoM2VHbzBlbFl3VjB0dlN6SjZaVmhyWVhVemRtTjViRE5JU1V0MWNFcG1jVEpVClJVRkRa
+V1pXYW1vd2RBcEtWeXRZTXpWUVIxZHdPUzlJTlhwSlZVNVdUbFpxVXpkVmJYTTRORWwyUzJoU1Fq
+ZzFNVEpRUWpsVmVVaGgKWjFoWlZsZzFSMWR3UVdOV2NIbG1jbXhTQ2taSk9WRmthR2dyVUdKck1I
+VjVhM1JrWW1ZdlEyUm1aMGhQYjJWaWNsUjBkMUpzYWswdwpiMFIwV0NzeVEzWTJhakIzUWtzM2FF
+UTRjRkIyWmpFcmRYa0tSM3BqZW1sblFWVXZORXQzTjJWYWNYbGtaamxDS3pWU2RYQlNLMGxhCmFY
+QllOREY0UldsSmNrdFNkM0ZwTlRFM1YxZDZXR05xWVVjeVkwNWlaalExTVFwNGNFZzFVRzVXTTJr
+eGRIRXdOR3BOUjFGVmVrWjMKU1VSQlVVRkNielJIUVUxSU5IZElVVmxFVmxJd1QwSkNXVVZHU1hk
+WU5IWnpPRUpwUW1OVFkyOWtDalZ1YjFwSVVrMDRSVFFyYVUxRgpTVWRCTVZWa1NYZFJOMDFFYlVG
+R1NYZFlOSFp6T0VKcFFtTlRZMjlrTlc1dldraFNUVGhGTkN0cGIxSmhhMFpFUVZNS1RWSkJkMFJu
+CldVUldVVkZFUlhka1JsRldRV2RSTUVWNFoyZHJRV2QxVlZZelJFMTBWelp6ZDBSQldVUldVakJV
+UWtGVmQwRjNSVUl2ZWtGTVFtZE8KVmdwSVVUaEZRa0ZOUTBGUldYZEVVVmxLUzI5YVNXaDJZMDVC
+VVVWTVFsRkJSR2RuUlVKQlJtWlJjVTlVUVRkU2RqZExLMngxVVRkdwpibUZ6TkVKWmQwaEZDamxI
+UlZBdmRXOW9kalpMVDNrd1ZFZFJSbUp5VWxScVJtOU1WazVDT1VKYU1YbHRUVVJhTUM5VVNYZEpW
+V00zCmQyazNZVGgwTlcxRmNWbElNVFV6ZDFjS1lWZHZiMmxUYW5sTVRHaDFTVFJ6VG5KT1EwOTBh
+WE5rUW5FeWNqSk5SbGgwTm1nd2JVRlIKV1U5UWRqaFNPRXMzTDJablUzaEhSbkY2YUhsT2JXMVdU
+QW94Y1VKS2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVFMXVW
+R3c0ZUVWWFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhwaFNF
+b3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpGS1VD
+dHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNSa1Rr
+NTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmtsRFFW
+UkZMUzB0TFMwSwotLXtib3VuZGFyeX0tLQo=
\ No newline at end of file
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithUpdateIdentifier.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithUpdateIdentifier.base64
new file mode 100644
index 0000000..bab7607
--- /dev/null
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithUpdateIdentifier.base64
@@ -0,0 +1,88 @@
+TUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5
+PXtib3VuZGFyeX07IGNoYXJzZXQ9VVRGLTgKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFz
+ZTY0CgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94LXBhc3Nwb2ludC1w
+cm9maWxlOyBjaGFyc2V0PVVURi04CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJhc2U2NAoK
+UEUxbmJYUlVjbVZsSUhodGJHNXpQU0p6ZVc1amJXdzZaRzFrWkdZeExqSWlQZ29nSUR4V1pYSkVW
+RVErTVM0eVBDOVdaWEpFVkVRKwpDaUFnUEU1dlpHVStDaUFnSUNBOFRtOWtaVTVoYldVK1VHVnlV
+SEp2ZG1sa1pYSlRkV0p6WTNKcGNIUnBiMjQ4TDA1dlpHVk9ZVzFsClBnb2dJQ0FnUEZKVVVISnZj
+R1Z5ZEdsbGN6NEtJQ0FnSUNBZ1BGUjVjR1UrQ2lBZ0lDQWdJQ0FnUEVSRVJrNWhiV1UrZFhKdU9u
+ZG0KWVRwdGJ6cG9iM1J6Y0c5ME1tUnZkREF0Y0dWeWNISnZkbWxrWlhKemRXSnpZM0pwY0hScGIy
+NDZNUzR3UEM5RVJFWk9ZVzFsUGdvZwpJQ0FnSUNBOEwxUjVjR1UrQ2lBZ0lDQThMMUpVVUhKdmNH
+VnlkR2xsY3o0S0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBOFRtOWtaVTVoCmJXVStWWEJrWVhSbFNX
+UmxiblJwWm1sbGNqd3ZUbTlrWlU1aGJXVStDaUFnSUNBZ0lEeFdZV3gxWlQ0eE1qTTBQQzlXWVd4
+MVpUNEsKSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJRHhPYjJSbFBnb2dJQ0FnSUNBOFRtOWtaVTVoYldV
+K2FUQXdNVHd2VG05a1pVNWhiV1UrQ2lBZwpJQ0FnSUR4T2IyUmxQZ29nSUNBZ0lDQWdJRHhPYjJS
+bFRtRnRaVDVJYjIxbFUxQThMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJRHhPCmIyUmxQZ29nSUNB
+Z0lDQWdJQ0FnUEU1dlpHVk9ZVzFsUGtaeWFXVnVaR3g1VG1GdFpUd3ZUbTlrWlU1aGJXVStDaUFn
+SUNBZ0lDQWcKSUNBOFZtRnNkV1UrUlhoaGJYQnNaU0JPWlhSM2IzSnJQQzlXWVd4MVpUNEtJQ0Fn
+SUNBZ0lDQThMMDV2WkdVK0NpQWdJQ0FnSUNBZwpQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQThUbTlr
+WlU1aGJXVStSbEZFVGp3dlRtOWtaVTVoYldVK0NpQWdJQ0FnSUNBZ0lDQThWbUZzCmRXVSthRzkw
+YzNCdmRDNWxlR0Z0Y0d4bExtNWxkRHd2Vm1Gc2RXVStDaUFnSUNBZ0lDQWdQQzlPYjJSbFBnb2dJ
+Q0FnSUNBZ0lEeE8KYjJSbFBnb2dJQ0FnSUNBZ0lDQWdQRTV2WkdWT1lXMWxQbEp2WVcxcGJtZERi
+MjV6YjNKMGFYVnRUMGs4TDA1dlpHVk9ZVzFsUGdvZwpJQ0FnSUNBZ0lDQWdQRlpoYkhWbFBqRXhN
+akl6TXl3ME5EVTFOalk4TDFaaGJIVmxQZ29nSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnCklDQWdQ
+QzlPYjJSbFBnb2dJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrUTNKbFpH
+VnVkR2xoYkR3dlRtOWsKWlU1aGJXVStDaUFnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lD
+QThUbTlrWlU1aGJXVStVbVZoYkcwOEwwNXZaR1ZPWVcxbApQZ29nSUNBZ0lDQWdJQ0FnUEZaaGJI
+VmxQbVY0WVcxd2JHVXVZMjl0UEM5V1lXeDFaVDRLSUNBZ0lDQWdJQ0E4TDA1dlpHVStDaUFnCklD
+QWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrVlhObGNtNWhiV1ZRWVhO
+emQyOXlaRHd2VG05a1pVNWgKYldVK0NpQWdJQ0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNB
+Z0lDQWdQRTV2WkdWT1lXMWxQbFZ6WlhKdVlXMWxQQzlPYjJSbApUbUZ0WlQ0S0lDQWdJQ0FnSUNB
+Z0lDQWdQRlpoYkhWbFBuVnpaWEk4TDFaaGJIVmxQZ29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29n
+CklDQWdJQ0FnSUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE9iMlJsVG1GdFpUNVFZWE56
+ZDI5eVpEd3ZUbTlrWlU1aGJXVSsKQ2lBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gxWlQ1alIwWjZZek5r
+ZG1OdFVUMDhMMVpoYkhWbFBnb2dJQ0FnSUNBZ0lDQWdQQzlPYjJSbApQZ29nSUNBZ0lDQWdJQ0Fn
+UEU1dlpHVStDaUFnSUNBZ0lDQWdJQ0FnSUR4T2IyUmxUbUZ0WlQ1RlFWQk5aWFJvYjJROEwwNXZa
+R1ZPCllXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBOFRtOWtaVDRLSUNBZ0lDQWdJQ0FnSUNBZ0lDQThU
+bTlrWlU1aGJXVStSVUZRVkhsd1pUd3YKVG05a1pVNWhiV1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lDQWdQ
+RlpoYkhWbFBqSXhQQzlXWVd4MVpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEM5TwpiMlJsUGdvZ0lDQWdJ
+Q0FnSUNBZ0lDQThUbTlrWlQ0S0lDQWdJQ0FnSUNBZ0lDQWdJQ0E4VG05a1pVNWhiV1UrU1c1dVpY
+Sk5aWFJvCmIyUThMMDV2WkdWT1lXMWxQZ29nSUNBZ0lDQWdJQ0FnSUNBZ0lEeFdZV3gxWlQ1TlV5
+MURTRUZRTFZZeVBDOVdZV3gxWlQ0S0lDQWcKSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lD
+QWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnSUNBZwpJQ0E4VG05a1pU
+NEtJQ0FnSUNBZ0lDQWdJRHhPYjJSbFRtRnRaVDVFYVdkcGRHRnNRMlZ5ZEdsbWFXTmhkR1U4TDA1
+dlpHVk9ZVzFsClBnb2dJQ0FnSUNBZ0lDQWdQRTV2WkdVK0NpQWdJQ0FnSUNBZ0lDQWdJRHhPYjJS
+bFRtRnRaVDVEWlhKMGFXWnBZMkYwWlZSNWNHVTgKTDA1dlpHVk9ZVzFsUGdvZ0lDQWdJQ0FnSUNB
+Z0lDQThWbUZzZFdVK2VEVXdPWFl6UEM5V1lXeDFaVDRLSUNBZ0lDQWdJQ0FnSUR3dgpUbTlrWlQ0
+S0lDQWdJQ0FnSUNBZ0lEeE9iMlJsUGdvZ0lDQWdJQ0FnSUNBZ0lDQThUbTlrWlU1aGJXVStRMlZ5
+ZEZOSVFUSTFOa1pwCmJtZGxjbkJ5YVc1MFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0Fn
+UEZaaGJIVmxQakZtTVdZeFpqRm1NV1l4WmpGbU1XWXgKWmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4
+WmpGbU1XWXhaakZtTVdZeFpqRm1NV1l4WmpGbU1XWXhaakZtTVdZOEwxWmhiSFZsUGdvZwpJQ0Fn
+SUNBZ0lDQWdQQzlPYjJSbFBnb2dJQ0FnSUNBZ0lEd3ZUbTlrWlQ0S0lDQWdJQ0FnSUNBOFRtOWta
+VDRLSUNBZ0lDQWdJQ0FnCklEeE9iMlJsVG1GdFpUNVRTVTA4TDA1dlpHVk9ZVzFsUGdvZ0lDQWdJ
+Q0FnSUNBZ1BFNXZaR1UrQ2lBZ0lDQWdJQ0FnSUNBZ0lEeE8KYjJSbFRtRnRaVDVKVFZOSlBDOU9i
+MlJsVG1GdFpUNEtJQ0FnSUNBZ0lDQWdJQ0FnUEZaaGJIVmxQakV5TXpRMU5pbzhMMVpoYkhWbApQ
+Z29nSUNBZ0lDQWdJQ0FnUEM5T2IyUmxQZ29nSUNBZ0lDQWdJQ0FnUEU1dlpHVStDaUFnSUNBZ0lD
+QWdJQ0FnSUR4T2IyUmxUbUZ0ClpUNUZRVkJVZVhCbFBDOU9iMlJsVG1GdFpUNEtJQ0FnSUNBZ0lD
+QWdJQ0FnUEZaaGJIVmxQakl6UEM5V1lXeDFaVDRLSUNBZ0lDQWcKSUNBZ0lEd3ZUbTlrWlQ0S0lD
+QWdJQ0FnSUNBOEwwNXZaR1UrQ2lBZ0lDQWdJRHd2VG05a1pUNEtJQ0FnSUR3dlRtOWtaVDRLSUNB
+OApMMDV2WkdVK0Nqd3ZUV2R0ZEZSeVpXVSsKCi0te2JvdW5kYXJ5fQpDb250ZW50LVR5cGU6IGFw
+cGxpY2F0aW9uL3gteDUwOS1jYS1jZXJ0CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJhc2U2
+NAoKTFMwdExTMUNSVWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVUkxSRU5EUVdoRFow
+RjNTVUpCWjBsS1FVbE1iRVprZDNwTQpWblZ5VFVFd1IwTlRjVWRUU1dJelJGRkZRa04zVlVGTlFr
+bDRSVVJCVDBKblRsWUtRa0ZOVkVJd1ZrSlZRMEpFVVZSRmQwaG9ZMDVOClZGbDNUVlJGZVUxVVJU
+Rk5SRVV4VjJoalRrMXFXWGROVkVFMVRWUkZNVTFFUlRGWGFrRlRUVkpCZHdwRVoxbEVWbEZSUkVW
+M1pFWlIKVmtGblVUQkZlRTFKU1VKSmFrRk9RbWRyY1docmFVYzVkekJDUVZGRlJrRkJUME5CVVRo
+QlRVbEpRa05uUzBOQlVVVkJDbnB1UVZCVgplakkyVFhOaFpUUjNjelF6WTNwU05ERXZTakpSZEhK
+VFNWcFZTMjFXVlhOV2RXMUVZbGxJY2xCT2RsUllTMU5OV0VGalpYZFBVa1JSCldWZ0tVbkYyU0ha
+d2JqaERjMk5DTVN0dlIxaGFka2gzZUdvMGVsWXdWMHR2U3pKNlpWaHJZWFV6ZG1ONWJETklTVXQx
+Y0VwbWNUSlUKUlVGRFpXWldhbW93ZEFwS1Z5dFlNelZRUjFkd09TOUlOWHBKVlU1V1RsWnFVemRW
+YlhNNE5FbDJTMmhTUWpnMU1USlFRamxWZVVoaApaMWhaVmxnMVIxZHdRV05XY0hsbWNteFNDa1pK
+T1ZGa2FHZ3JVR0pyTUhWNWEzUmtZbVl2UTJSbVowaFBiMlZpY2xSMGQxSnNhazB3CmIwUjBXQ3N5
+UTNZMmFqQjNRa3MzYUVRNGNGQjJaakVyZFhrS1IzcGplbWxuUVZVdk5FdDNOMlZhY1hsa1pqbENL
+elZTZFhCU0swbGEKYVhCWU5ERjRSV2xKY2t0U2QzRnBOVEUzVjFkNldHTnFZVWN5WTA1aVpqUTFN
+UXA0Y0VnMVVHNVdNMmt4ZEhFd05HcE5SMUZWZWtaMwpTVVJCVVVGQ2J6UkhRVTFJTkhkSVVWbEVW
+bEl3VDBKQ1dVVkdTWGRZTkhaek9FSnBRbU5UWTI5a0NqVnViMXBJVWswNFJUUXJhVTFGClNVZEJN
+VlZrU1hkUk4wMUViVUZHU1hkWU5IWnpPRUpwUW1OVFkyOWtOVzV2V2toU1RUaEZOQ3RwYjFKaGEw
+WkVRVk1LVFZKQmQwUm4KV1VSV1VWRkVSWGRrUmxGV1FXZFJNRVY0WjJkclFXZDFWVll6UkUxMFZ6
+WnpkMFJCV1VSV1VqQlVRa0ZWZDBGM1JVSXZla0ZNUW1kTwpWZ3BJVVRoRlFrRk5RMEZSV1hkRVVW
+bEtTMjlhU1doMlkwNUJVVVZNUWxGQlJHZG5SVUpCUm1aUmNVOVVRVGRTZGpkTEsyeDFVVGR3CmJt
+RnpORUpaZDBoRkNqbEhSVkF2ZFc5b2RqWkxUM2t3VkVkUlJtSnlVbFJxUm05TVZrNUNPVUphTVhs
+dFRVUmFNQzlVU1hkSlZXTTMKZDJrM1lUaDBOVzFGY1ZsSU1UVXpkMWNLWVZkdmIybFRhbmxNVEdo
+MVNUUnpUbkpPUTA5MGFYTmtRbkV5Y2pKTlJsaDBObWd3YlVGUgpXVTlRZGpoU09FczNMMlpuVTNo
+SFJuRjZhSGxPYlcxV1RBb3hjVUpLYkdSNE16UlRjSGR6VkVGTVVWWlFZalJvUjNkS2VscG1jakZR
+ClkzQkZVWGcyZUUxdVZHdzRlRVZYV2tVelRYTTVPWFZoVlhoaVVYRkpkMUoxQ2t4blFVOXJUa050
+V1RKdE9EbFdhSHBoU0VveGRWWTQKTlVGa1RTOTBSQ3RaYzIxc2JtNXFkRGxNVWtObGFtSkNhWEJx
+U1VkcVQxaHlaekZLVUN0c2VGWUtiWFZOTkhaSUsxQXZiV3h0ZUhOUQpVSG93WkRZMVlpdEZSMjFL
+V25CdlRHdFBMM1JrVGs1MlExbDZha3B3VkVWWGNFVnpUelpPVFdoTFdXODlDaTB0TFMwdFJVNUVJ
+RU5GClVsUkpSa2xEUVZSRkxTMHRMUzBLCi0te2JvdW5kYXJ5fS0tCg==
\ No newline at end of file
diff --git a/wifi/tests/assets/hsr1/README.txt b/wifi/tests/assets/hsr1/README.txt
index d1f8384..9f3cdc2 100644
--- a/wifi/tests/assets/hsr1/README.txt
+++ b/wifi/tests/assets/hsr1/README.txt
@@ -2,4 +2,5 @@
HSR1ProfileWithCACert.base64 - base64 encoded of the data contained in HSR1ProfileWithCAWith.conf
HSR1ProfileWithNonBase64Part.base64 - base64 encoded installation file that contains a part of non-base64 encoding type
HSR1ProfileWithMissingBoundary.base64 - base64 encoded installation file with missing end-boundary in the MIME data
-HSR1ProfileWithInvalidContentType.base64 - base64 encoded installation file with that contains a MIME part with an invalid content type.
+HSR1ProfileWithInvalidContentType.base64 - base64 encoded installation file with that contains a MIME part with an invalid content type
+HSR1ProfileWithUpdateIdentifier.base64 - base64 encoded installation file with that contains an R2 update identifier
diff --git a/wifi/tests/src/android/net/wifi/WifiClientTest.java b/wifi/tests/src/android/net/wifi/WifiClientTest.java
new file mode 100644
index 0000000..42cab55
--- /dev/null
+++ b/wifi/tests/src/android/net/wifi/WifiClientTest.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.wifi;
+
+import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals;
+import static com.android.testutils.ParcelUtilsKt.assertParcelSane;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.net.MacAddress;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.Test;
+
+/**
+ * Unit tests for {@link android.net.wifi.WifiClient}.
+ */
+@SmallTest
+public class WifiClientTest {
+ private static final String INTERFACE_NAME = "wlan0";
+ private static final String MAC_ADDRESS_STRING = "00:0a:95:9d:68:16";
+ private static final MacAddress MAC_ADDRESS = MacAddress.fromString(MAC_ADDRESS_STRING);
+
+ /**
+ * Verify parcel write/read with WifiClient.
+ */
+ @Test
+ public void testWifiClientParcelWriteRead() throws Exception {
+ WifiClient writeWifiClient = new WifiClient(MAC_ADDRESS);
+
+ assertParcelSane(writeWifiClient, 1);
+ }
+
+ /**
+ * Verify equals with WifiClient.
+ */
+ @Test
+ public void testWifiClientEquals() throws Exception {
+ WifiClient writeWifiClient = new WifiClient(MAC_ADDRESS);
+ WifiClient writeWifiClientEquals = new WifiClient(MAC_ADDRESS);
+
+ assertEquals(writeWifiClient, writeWifiClientEquals);
+ assertEquals(writeWifiClient.hashCode(), writeWifiClientEquals.hashCode());
+ assertFieldCountEquals(1, WifiClient.class);
+ }
+
+ /**
+ * Verify not-equals with WifiClient.
+ */
+ @Test
+ public void testWifiClientNotEquals() throws Exception {
+ final MacAddress macAddressNotEquals = MacAddress.fromString("00:00:00:00:00:00");
+ WifiClient writeWifiClient = new WifiClient(MAC_ADDRESS);
+ WifiClient writeWifiClientNotEquals = new WifiClient(macAddressNotEquals);
+
+ assertNotEquals(writeWifiClient, writeWifiClientNotEquals);
+ assertNotEquals(writeWifiClient.hashCode(), writeWifiClientNotEquals.hashCode());
+ }
+}
diff --git a/wifi/tests/src/android/net/wifi/WifiInfoTest.java b/wifi/tests/src/android/net/wifi/WifiInfoTest.java
index 0ce5d66c..ea08ea8 100644
--- a/wifi/tests/src/android/net/wifi/WifiInfoTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiInfoTest.java
@@ -38,6 +38,7 @@
private static final String TEST_PACKAGE_NAME = "com.test.example";
private static final String TEST_FQDN = "test.com";
private static final String TEST_PROVIDER_NAME = "test";
+ private static final int TEST_WIFI_TECHNOLOGY = WifiInfo.WIFI_TECHNOLOGY_11AC;
/**
* Verify parcel write/read with WifiInfo.
@@ -54,6 +55,7 @@
writeWifiInfo.setFQDN(TEST_FQDN);
writeWifiInfo.setProviderFriendlyName(TEST_PROVIDER_NAME);
writeWifiInfo.setNetworkSuggestionOrSpecifierPackageName(TEST_PACKAGE_NAME);
+ writeWifiInfo.setWifiTechnology(TEST_WIFI_TECHNOLOGY);
Parcel parcel = Parcel.obtain();
writeWifiInfo.writeToParcel(parcel, 0);
@@ -72,5 +74,6 @@
assertEquals(TEST_PACKAGE_NAME, readWifiInfo.getNetworkSuggestionOrSpecifierPackageName());
assertEquals(TEST_FQDN, readWifiInfo.getPasspointFqdn());
assertEquals(TEST_PROVIDER_NAME, readWifiInfo.getPasspointProviderFriendlyName());
+ assertEquals(TEST_WIFI_TECHNOLOGY, readWifiInfo.getWifiTechnology());
}
}
diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
index f8a0c8f..8d0579b 100644
--- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
@@ -99,8 +99,7 @@
private static final String[] TEST_MAC_ADDRESSES = {"da:a1:19:0:0:0"};
@Mock Context mContext;
- @Mock
- android.net.wifi.IWifiManager mWifiService;
+ @Mock android.net.wifi.IWifiManager mWifiService;
@Mock ApplicationInfo mApplicationInfo;
@Mock WifiConfiguration mApConfig;
@Mock SoftApCallback mSoftApCallback;
@@ -115,7 +114,8 @@
private TestLooper mLooper;
private WifiManager mWifiManager;
- @Before public void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mLooper = new TestLooper();
mHandler = spy(new Handler(mLooper.getLooper()));
@@ -210,7 +210,7 @@
@Test
public void testCreationOfLocalOnlyHotspotSubscription() throws Exception {
try (WifiManager.LocalOnlyHotspotSubscription sub =
- mWifiManager.new LocalOnlyHotspotSubscription()) {
+ mWifiManager.new LocalOnlyHotspotSubscription()) {
sub.close();
}
}
@@ -752,17 +752,17 @@
* Verify client-provided callback is being called through callback proxy
*/
@Test
- public void softApCallbackProxyCallsOnNumClientsChanged() throws Exception {
+ public void softApCallbackProxyCallsOnConnectedClientsChanged() throws Exception {
ArgumentCaptor<ISoftApCallback.Stub> callbackCaptor =
ArgumentCaptor.forClass(ISoftApCallback.Stub.class);
mWifiManager.registerSoftApCallback(mSoftApCallback, mHandler);
verify(mWifiService).registerSoftApCallback(any(IBinder.class), callbackCaptor.capture(),
anyInt());
- final int testNumClients = 3;
- callbackCaptor.getValue().onNumClientsChanged(testNumClients);
+ final List<WifiClient> testClients = new ArrayList();
+ callbackCaptor.getValue().onConnectedClientsChanged(testClients);
mLooper.dispatchAll();
- verify(mSoftApCallback).onNumClientsChanged(testNumClients);
+ verify(mSoftApCallback).onConnectedClientsChanged(testClients);
}
/*
@@ -776,14 +776,14 @@
verify(mWifiService).registerSoftApCallback(any(IBinder.class), callbackCaptor.capture(),
anyInt());
- final int testNumClients = 5;
+ final List<WifiClient> testClients = new ArrayList();
callbackCaptor.getValue().onStateChanged(WIFI_AP_STATE_ENABLING, 0);
- callbackCaptor.getValue().onNumClientsChanged(testNumClients);
+ callbackCaptor.getValue().onConnectedClientsChanged(testClients);
callbackCaptor.getValue().onStateChanged(WIFI_AP_STATE_FAILED, SAP_START_FAILURE_GENERAL);
mLooper.dispatchAll();
verify(mSoftApCallback).onStateChanged(WIFI_AP_STATE_ENABLING, 0);
- verify(mSoftApCallback).onNumClientsChanged(testNumClients);
+ verify(mSoftApCallback).onConnectedClientsChanged(testClients);
verify(mSoftApCallback).onStateChanged(WIFI_AP_STATE_FAILED, SAP_START_FAILURE_GENERAL);
}
@@ -1020,8 +1020,8 @@
verifyNoMoreInteractions(mWifiService);
}
- /**
-i * Verify that a call to cancel WPS immediately returns a failure.
+ /**
+ * Verify that a call to cancel WPS immediately returns a failure.
*/
@Test
public void testCancelWpsImmediatelyFailsWithCallback() {
@@ -1324,7 +1324,6 @@
/**
* Verify getting the factory MAC address.
- * @throws Exception
*/
@Test
public void testGetFactoryMacAddress() throws Exception {
@@ -1371,7 +1370,6 @@
/**
* Test behavior of isEnhancedOpenSupported
- * @throws Exception
*/
@Test
public void testIsEnhancedOpenSupported() throws Exception {
@@ -1385,7 +1383,6 @@
/**
* Test behavior of isWpa3SaeSupported
- * @throws Exception
*/
@Test
public void testIsWpa3SaeSupported() throws Exception {
@@ -1399,7 +1396,6 @@
/**
* Test behavior of isWpa3SuiteBSupported
- * @throws Exception
*/
@Test
public void testIsWpa3SuiteBSupported() throws Exception {
@@ -1413,7 +1409,6 @@
/**
* Test behavior of isEasyConnectSupported
- * @throws Exception
*/
@Test
public void testIsEasyConnectSupported() throws Exception {
@@ -1427,7 +1422,6 @@
/**
* Test behavior of {@link WifiManager#addNetwork(WifiConfiguration)}
- * @throws Exception
*/
@Test
public void testAddNetwork() throws Exception {
@@ -1444,7 +1438,6 @@
/**
* Test behavior of {@link WifiManager#addNetwork(WifiConfiguration)}
- * @throws Exception
*/
@Test
public void testUpdateNetwork() throws Exception {
@@ -1466,7 +1459,6 @@
/**
* Test behavior of {@link WifiManager#enableNetwork(int, boolean)}
- * @throws Exception
*/
@Test
public void testEnableNetwork() throws Exception {
@@ -1478,7 +1470,6 @@
/**
* Test behavior of {@link WifiManager#disableNetwork(int)}
- * @throws Exception
*/
@Test
public void testDisableNetwork() throws Exception {
@@ -1489,10 +1480,19 @@
}
/**
- * Test behavior of {@link WifiManager#disconnect()}
+ * Test behavior of {@link WifiManager#allowAutojoin(int, boolean)}
* @throws Exception
*/
@Test
+ public void testAllowAutojoin() throws Exception {
+ mWifiManager.allowAutojoin(1, true);
+ verify(mWifiService).allowAutojoin(eq(1), eq(true));
+ }
+
+ /**
+ * Test behavior of {@link WifiManager#disconnect()}
+ */
+ @Test
public void testDisconnect() throws Exception {
when(mWifiService.disconnect(anyString())).thenReturn(true);
assertTrue(mWifiManager.disconnect());
@@ -1501,7 +1501,6 @@
/**
* Test behavior of {@link WifiManager#reconnect()}
- * @throws Exception
*/
@Test
public void testReconnect() throws Exception {
@@ -1512,7 +1511,6 @@
/**
* Test behavior of {@link WifiManager#reassociate()}
- * @throws Exception
*/
@Test
public void testReassociate() throws Exception {
@@ -1523,7 +1521,6 @@
/**
* Test behavior of {@link WifiManager#getSupportedFeatures()}
- * @throws Exception
*/
@Test
public void testGetSupportedFeatures() throws Exception {
@@ -1550,7 +1547,6 @@
/**
* Test behavior of {@link WifiManager#getControllerActivityEnergyInfo()}
- * @throws Exception
*/
@Test
public void testGetControllerActivityEnergyInfo() throws Exception {
@@ -1563,7 +1559,6 @@
/**
* Test behavior of {@link WifiManager#getConnectionInfo()}
- * @throws Exception
*/
@Test
public void testGetConnectionInfo() throws Exception {
@@ -1575,7 +1570,6 @@
/**
* Test behavior of {@link WifiManager#isDualModeSupported()} ()}
- * @throws Exception
*/
@Test
public void testIsDualModeSupported() throws Exception {
@@ -1586,7 +1580,6 @@
/**
* Test behavior of {@link WifiManager#isDualBandSupported()}
- * @throws Exception
*/
@Test
public void testIsDualBandSupported() throws Exception {
@@ -1597,7 +1590,6 @@
/**
* Test behavior of {@link WifiManager#getDhcpInfo()}
- * @throws Exception
*/
@Test
public void testGetDhcpInfo() throws Exception {
@@ -1610,7 +1602,6 @@
/**
* Test behavior of {@link WifiManager#setWifiEnabled(boolean)}
- * @throws Exception
*/
@Test
public void testSetWifiEnabled() throws Exception {
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java b/wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java
index d9a1d9af..439e672 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/ConfigParserTest.java
@@ -54,6 +54,8 @@
"assets/hsr1/HSR1ProfileWithInvalidContentType.base64";
private static final String PASSPOINT_INSTALLATION_FILE_WITHOUT_PROFILE =
"assets/hsr1/HSR1ProfileWithoutProfile.base64";
+ private static final String PASSPOINT_INSTALLATION_FILE_WITH_UPDATE_ID =
+ "assets/hsr1/HSR1ProfileWithUpdateIdentifier.base64";
/**
* Read the content of the given resource file into a String.
@@ -85,17 +87,17 @@
// HomeSP configuration.
HomeSp homeSp = new HomeSp();
- homeSp.setFriendlyName("Century House");
- homeSp.setFqdn("mi6.co.uk");
+ homeSp.setFriendlyName("Example Network");
+ homeSp.setFqdn("hotspot.example.net");
homeSp.setRoamingConsortiumOis(new long[] {0x112233L, 0x445566L});
config.setHomeSp(homeSp);
// Credential configuration.
Credential credential = new Credential();
- credential.setRealm("shaken.stirred.com");
+ credential.setRealm("example.com");
Credential.UserCredential userCredential = new Credential.UserCredential();
- userCredential.setUsername("james");
- userCredential.setPassword("Ym9uZDAwNw==");
+ userCredential.setUsername("user");
+ userCredential.setPassword("cGFzc3dvcmQ=");
userCredential.setEapType(21);
userCredential.setNonEapInnerMethod("MS-CHAP-V2");
credential.setUserCredential(userCredential);
@@ -106,8 +108,8 @@
certCredential.setCertSha256Fingerprint(certSha256Fingerprint);
credential.setCertCredential(certCredential);
Credential.SimCredential simCredential = new Credential.SimCredential();
- simCredential.setImsi("imsi");
- simCredential.setEapType(24);
+ simCredential.setImsi("123456*");
+ simCredential.setEapType(23);
credential.setSimCredential(simCredential);
credential.setCaCertificate(FakeKeys.CA_CERT0);
config.setCredential(credential);
@@ -201,4 +203,21 @@
assertNull(ConfigParser.parsePasspointConfig(
"application/x-wifi-config", configStr.getBytes()));
}
+
+ /**
+ * Verify a valid installation file is parsed successfully with the matching contents, and that
+ * Update identifier is cleared.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithUpdateIdentifier() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_UPDATE_ID);
+ PasspointConfiguration expectedConfig = generateConfigurationFromProfile();
+ PasspointConfiguration actualConfig =
+ ConfigParser.parsePasspointConfig(
+ "application/x-wifi-config", configStr.getBytes());
+ // Expected configuration does not contain an update identifier
+ assertTrue(actualConfig.equals(expectedConfig));
+ }
}
\ No newline at end of file
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
index c3b074e..f501b16 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
@@ -183,7 +183,7 @@
PasspointConfiguration config = PasspointTestUtils.createConfig();
assertTrue(config.validate());
- assertTrue(config.validateForR2());
+ assertFalse(config.isOsuProvisioned());
}
/**
@@ -241,7 +241,6 @@
config.setPolicy(null);
assertTrue(config.validate());
- assertTrue(config.validateForR2());
}
/**
@@ -271,7 +270,6 @@
config.setAaaServerTrustedNames(null);
assertTrue(config.validate());
- assertTrue(config.validateForR2());
}
/**
@@ -348,4 +346,17 @@
PasspointConfiguration copyConfig = new PasspointConfiguration(sourceConfig);
assertTrue(copyConfig.equals(sourceConfig));
}
+
+ /**
+ * Verify that a configuration containing all fields is valid for R2.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void validateFullR2Config() throws Exception {
+ PasspointConfiguration config = PasspointTestUtils.createR2Config();
+ assertTrue(config.validate());
+ assertTrue(config.validateForR2());
+ assertTrue(config.isOsuProvisioned());
+ }
}
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/PasspointTestUtils.java b/wifi/tests/src/android/net/wifi/hotspot2/PasspointTestUtils.java
index adf74eb..8d55acb 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/PasspointTestUtils.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/PasspointTestUtils.java
@@ -132,7 +132,6 @@
*/
public static PasspointConfiguration createConfig() {
PasspointConfiguration config = new PasspointConfiguration();
- config.setUpdateIdentifier(1234);
config.setHomeSp(createHomeSp());
config.setAaaServerTrustedNames(
new String[] {"trusted.fqdn.com", "another-trusted.fqdn.com"});
@@ -145,7 +144,6 @@
trustRootCertList.put("trustRoot.cert2.com",
new byte[CERTIFICATE_FINGERPRINT_BYTES]);
config.setTrustRootCertList(trustRootCertList);
- config.setUpdateIdentifier(1);
config.setCredentialPriority(120);
config.setSubscriptionCreationTimeInMillis(231200);
config.setSubscriptionExpirationTimeInMillis(2134232);
@@ -160,4 +158,15 @@
config.setServiceFriendlyNames(friendlyNames);
return config;
}
+
+ /**
+ * Helper function for creating an R2 {@link PasspointConfiguration} for testing.
+ *
+ * @return {@link PasspointConfiguration}
+ */
+ public static PasspointConfiguration createR2Config() {
+ PasspointConfiguration config = createConfig();
+ config.setUpdateIdentifier(1234);
+ return config;
+ }
}