summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AconfigFlags.bp74
-rw-r--r--Android.bp2
-rw-r--r--OWNERS4
-rw-r--r--apct-tests/perftests/autofill/src/android/view/autofill/LoginTest.java6
-rw-r--r--apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java48
-rw-r--r--apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java2
-rw-r--r--apex/jobscheduler/framework/java/android/app/job/JobInfo.java6
-rw-r--r--apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java76
-rw-r--r--apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java10
-rw-r--r--apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java1
-rw-r--r--apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java4
-rw-r--r--cmds/app_process/app_main.cpp20
-rw-r--r--cmds/backup/backup.cpp2
-rw-r--r--cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java4
-rw-r--r--cmds/bootanimation/Android.bp3
-rw-r--r--cmds/bootanimation/BootAnimation.cpp33
-rw-r--r--cmds/incident/main.cpp10
-rw-r--r--cmds/incident_helper/src/TextParserBase.cpp8
-rw-r--r--cmds/incident_helper/src/main.cpp2
-rw-r--r--cmds/incident_helper/src/parsers/BatteryTypeParser.cpp4
-rw-r--r--cmds/incident_helper/src/parsers/CpuFreqParser.cpp4
-rw-r--r--cmds/incident_helper/src/parsers/CpuInfoParser.cpp10
-rw-r--r--cmds/incident_helper/src/parsers/EventLogTagsParser.cpp4
-rw-r--r--cmds/incident_helper/src/parsers/KernelWakesParser.cpp10
-rw-r--r--cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp4
-rw-r--r--cmds/incident_helper/src/parsers/ProcrankParser.cpp8
-rw-r--r--cmds/incident_helper/src/parsers/PsParser.cpp10
-rw-r--r--cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp4
-rw-r--r--cmds/incidentd/src/IncidentService.cpp24
-rw-r--r--cmds/incidentd/src/Reporter.cpp4
-rw-r--r--cmds/incidentd/src/Section.cpp76
-rw-r--r--cmds/incidentd/src/report_directory.cpp6
-rw-r--r--core/api/current.txt1
-rw-r--r--core/api/system-current.txt1
-rw-r--r--core/java/android/app/search/SearchSession.java2
-rw-r--r--core/java/android/content/Context.java2
-rw-r--r--core/java/android/content/IntentSender.java4
-rw-r--r--core/java/android/hardware/Camera.java131
-rw-r--r--core/java/android/hardware/SensorAdditionalInfo.java2
-rw-r--r--core/java/android/hardware/camera2/CameraDevice.java8
-rw-r--r--core/java/android/hardware/camera2/camera_platform.aconfig8
-rw-r--r--core/java/android/hardware/camera2/params/StreamConfigurationMap.java2
-rw-r--r--core/java/android/nfc/NfcAdapter.java31
-rw-r--r--core/java/android/os/DropBoxManager.java2
-rw-r--r--core/java/android/os/INetworkManagementService.aidl39
-rw-r--r--core/java/android/os/UserManager.java26
-rw-r--r--core/java/android/provider/Settings.java14
-rw-r--r--core/java/android/security/OWNERS12
-rw-r--r--core/java/android/security/net/OWNERS2
-rw-r--r--core/java/android/service/dreams/OWNERS2
-rw-r--r--core/java/android/service/trust/OWNERS4
-rw-r--r--core/java/android/text/flags/use_bounds_for_width.aconfig8
-rw-r--r--core/java/android/view/View.java10
-rw-r--r--core/java/android/window/flags/windowing_sdk.aconfig10
-rw-r--r--core/java/com/android/internal/dynamicanimation/animation/DynamicAnimation.java2
-rw-r--r--core/java/com/android/internal/dynamicanimation/animation/SpringForce.java2
-rw-r--r--core/java/com/android/server/SystemConfig.java16
-rw-r--r--core/jni/android_app_NativeActivity.cpp6
-rw-r--r--core/jni/android_app_backup_FullBackup.cpp5
-rw-r--r--core/jni/android_backup_BackupDataInput.cpp2
-rw-r--r--core/jni/android_backup_BackupHelperDispatcher.cpp2
-rw-r--r--core/jni/android_database_CursorWindow.cpp12
-rw-r--r--core/jni/android_database_SQLiteCommon.cpp2
-rw-r--r--core/jni/android_database_SQLiteConnection.cpp17
-rw-r--r--core/jni/android_ddm_DdmHandleNativeHeap.cpp4
-rw-r--r--core/jni/android_hardware_Camera.cpp27
-rw-r--r--core/jni/android_hardware_SensorManager.cpp2
-rw-r--r--core/jni/android_hardware_camera2_CameraMetadata.cpp14
-rw-r--r--core/jni/android_hardware_camera2_DngCreator.cpp15
-rw-r--r--core/jni/android_media_AudioSystem.cpp4
-rw-r--r--core/jni/android_os_HwParcel.cpp6
-rw-r--r--core/jni/android_os_UEventObserver.cpp4
-rw-r--r--core/jni/android_util_Binder.cpp9
-rw-r--r--core/jni/android_util_Process.cpp18
-rw-r--r--core/res/AndroidManifest.xml8
-rw-r--r--core/res/OWNERS3
-rw-r--r--core/tests/coretests/res/values-id/strings.xml5
-rw-r--r--core/tests/coretests/res/values-in/strings.xml5
-rw-r--r--core/tests/coretests/res/values/strings.xml7
-rw-r--r--core/tests/coretests/src/android/content/res/ResourcesLocaleTest.java21
-rw-r--r--core/tests/coretests/src/android/service/euicc/OWNERS1
-rw-r--r--core/tests/coretests/src/android/window/flags/WindowFlagsTest.java45
-rw-r--r--drm/jni/android_drm_DrmManagerClient.cpp38
-rw-r--r--keystore/java/android/security/keystore/KeyGenParameterSpec.java2
-rw-r--r--libs/androidfw/AssetManager2.cpp4
-rw-r--r--libs/hwui/utils/LinearAllocator.cpp18
-rw-r--r--libs/incident/src/IncidentReportArgs.cpp4
-rw-r--r--libs/services/src/os/DropBoxManager.cpp4
-rw-r--r--location/Android.bp24
-rw-r--r--location/java/android/location/GnssRequest.java4
-rw-r--r--location/placeholder_java/android/location/Placeholder.java27
-rw-r--r--media/java/android/media/Cea708CaptionRenderer.java2
-rw-r--r--media/java/android/media/MediaMetadataRetriever.java2
-rw-r--r--media/java/android/media/voice/KeyphraseModelManager.java2
-rw-r--r--media/jni/android_media_ImageReader.cpp6
-rw-r--r--media/jni/android_media_ImageWriter.cpp2
-rw-r--r--media/jni/android_media_MediaCrypto.cpp2
-rw-r--r--media/jni/android_media_MediaDrm.cpp10
-rw-r--r--media/jni/android_media_MediaMetadataRetriever.cpp4
-rw-r--r--media/jni/android_media_MediaPlayer.cpp4
-rw-r--r--media/jni/android_media_Streams.cpp6
-rw-r--r--media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java2
-rw-r--r--native/android/asset_manager.cpp4
-rw-r--r--native/android/sensor.cpp6
-rw-r--r--native/android/storage_manager.cpp4
-rw-r--r--packages/EncryptedLocalTransport/Android.bp3
-rw-r--r--packages/EncryptedLocalTransport/proguard.flags2
-rw-r--r--packages/Keyguard/proguard.flags27
-rw-r--r--packages/LocalTransport/Android.bp4
-rw-r--r--packages/LocalTransport/proguard.flags5
-rw-r--r--packages/LocalTransport/src/com/android/localtransport/LocalTransport.java10
-rw-r--r--packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java2
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java4
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS5
-rw-r--r--packages/SharedStorageBackup/Android.bp3
-rw-r--r--packages/SharedStorageBackup/proguard.flags2
-rw-r--r--packages/SystemUI/docs/qs-tiles.md2
-rw-r--r--packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java10
-rw-r--r--packages/WAPPushManager/tests/src/com/android/smspush/unitTests/WapPushTest.java4
-rw-r--r--packages/WallpaperBackup/Android.bp3
-rw-r--r--packages/WallpaperBackup/proguard.flags1
-rw-r--r--packages/services/VirtualCamera/OWNERS3
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java4
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java4
-rw-r--r--services/core/java/com/android/server/CertBlacklister.java12
-rw-r--r--services/core/java/com/android/server/NetworkManagementService.java35
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java44
-rw-r--r--services/core/java/com/android/server/TEST_MAPPING24
-rw-r--r--services/core/java/com/android/server/VcnManagementService.java8
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceBroker.java2
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java28
-rw-r--r--services/core/java/com/android/server/connectivity/TEST_MAPPING30
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java55
-rw-r--r--services/core/java/com/android/server/content/SyncManager.java4
-rw-r--r--services/core/java/com/android/server/content/SyncManagerConstants.java10
-rw-r--r--services/core/java/com/android/server/display/WifiDisplayController.java4
-rw-r--r--services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java2
-rw-r--r--services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java8
-rw-r--r--services/core/java/com/android/server/location/injector/SettingsHelper.java20
-rw-r--r--services/core/java/com/android/server/location/injector/SystemSettingsHelper.java8
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyLogger.java8
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyManagerService.java56
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java42
-rw-r--r--services/core/java/com/android/server/pm/UserRestrictionsUtils.java9
-rw-r--r--services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java2
-rw-r--r--services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java6
-rw-r--r--services/core/java/com/android/server/security/KeyChainSystemService.java4
-rw-r--r--services/core/java/com/android/server/security/OWNERS2
-rw-r--r--services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java19
-rw-r--r--services/core/java/com/android/server/security/rkp/RemoteProvisioningShellCommand.java84
-rw-r--r--services/core/java/com/android/server/trust/TrustAgentWrapper.java3
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java150
-rw-r--r--services/core/jni/Android.bp1
-rw-r--r--services/core/jni/gnss/GnssVisibilityControlCallback.cpp2
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/PolicyVersionUpgrader.java3
-rw-r--r--services/net/java/android/net/util/NetworkConstants.java1
-rw-r--r--services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java140
-rw-r--r--services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java6
-rw-r--r--services/tests/servicestests/src/com/android/server/integrity/AppIntegrityManagerServiceImplTest.java32
-rw-r--r--services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java30
-rw-r--r--services/tests/servicestests/src/com/android/server/power/hint/OWNERS2
-rw-r--r--services/tests/servicestests/utils/com/android/server/testutils/TestHandler.java2
-rw-r--r--startop/apps/ColorChanging/app/build.gradle2
-rw-r--r--startop/apps/ColorChanging/app/proguard-rules.pro21
-rw-r--r--telephony/common/com/android/internal/telephony/SmsApplication.java2
-rw-r--r--telephony/java/android/telephony/SmsManager.java2
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java4
-rw-r--r--telephony/java/android/telephony/ims/ImsReasonInfo.java2
-rw-r--r--tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java2
-rw-r--r--tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java2
-rw-r--r--tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java2
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java191
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java16
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java4
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java36
-rw-r--r--tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java2
-rw-r--r--tests/Internal/src/stub/DummyWallpaperService.java2
-rw-r--r--tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java8
-rw-r--r--tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java2
-rw-r--r--tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java2
-rw-r--r--tools/aapt/AaptAssets.cpp2
-rw-r--r--tools/aapt/Android.bp1
-rw-r--r--tools/aapt/Command.cpp4
-rw-r--r--tools/aapt/Package.cpp3
-rw-r--r--tools/aapt/Resource.cpp7
-rw-r--r--tools/aapt/ResourceTable.cpp13
-rw-r--r--tools/aapt/SourcePos.cpp2
-rw-r--r--tools/aapt/Utils.cpp38
-rw-r--r--tools/aapt/Utils.h28
-rw-r--r--tools/aapt2/DominatorTree_test.cpp3
-rw-r--r--tools/obbtool/Main.cpp2
-rw-r--r--tools/split-select/SplitDescription.cpp2
194 files changed, 1451 insertions, 1205 deletions
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
new file mode 100644
index 000000000000..9f48bf475eb2
--- /dev/null
+++ b/AconfigFlags.bp
@@ -0,0 +1,74 @@
+// Copyright (C) 2023 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.
+
+// Aconfig declarations and libraries for the core framework
+java_defaults {
+ name: "framework-minus-apex-aconfig-libraries",
+
+ // Add java_aconfig_libraries to here to add them to the core framework
+ srcs: [
+ ":com.android.hardware.camera2-aconfig-java{.generated_srcjars}",
+ ":com.android.window.flags.window-aconfig-java{.generated_srcjars}",
+ ":com.android.text.flags-aconfig-java{.generated_srcjars}",
+ ],
+ // Add aconfig-annotations-lib as a dependency for the optimization
+ libs: ["aconfig-annotations-lib"],
+}
+
+// Default flags for java_aconfig_libraries that go into framework-minus-apex
+// These libraries will not work standalone
+java_defaults {
+ name: "framework-minus-apex-aconfig-java-defaults",
+ sdk_version: "core_platform",
+ libs: ["fake_device_config"],
+}
+
+// Camera
+aconfig_declarations {
+ name: "com.android.hardware.camera2-aconfig",
+ package: "com.android.hardware.camera2",
+ srcs: ["core/java/android/hardware/camera2/camera_platform.aconfig"],
+}
+
+java_aconfig_library {
+ name: "com.android.hardware.camera2-aconfig-java",
+ aconfig_declarations: "com.android.hardware.camera2-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
+// Window
+aconfig_declarations {
+ name: "com.android.window.flags.window-aconfig",
+ package: "com.android.window.flags",
+ srcs: ["core/java/android/window/flags/*.aconfig"],
+}
+
+java_aconfig_library {
+ name: "com.android.window.flags.window-aconfig-java",
+ aconfig_declarations: "com.android.window.flags.window-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
+// Text
+aconfig_declarations {
+ name: "com.android.text.flags-aconfig",
+ package: "com.android.text.flags",
+ srcs: ["core/java/android/text/flags/*.aconfig"],
+}
+
+java_aconfig_library {
+ name: "com.android.text.flags-aconfig-java",
+ aconfig_declarations: "com.android.text.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
diff --git a/Android.bp b/Android.bp
index 94bcb3ef04c8..274c430169f9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -263,6 +263,7 @@ java_defaults {
defaults: [
"framework-aidl-export-defaults",
"latest_android_hardware_soundtrigger3_java_static",
+ "framework-minus-apex-aconfig-libraries",
],
srcs: [
":framework-non-updatable-sources",
@@ -611,6 +612,7 @@ stubs_defaults {
}
build = [
+ "AconfigFlags.bp",
"ProtoLibraries.bp",
"TestProtoLibraries.bp",
]
diff --git a/OWNERS b/OWNERS
index 8ee488dcb7a2..6c2532445f0f 100644
--- a/OWNERS
+++ b/OWNERS
@@ -16,8 +16,6 @@ narayan@google.com #{LAST_RESORT_SUGGESTION}
ogunwale@google.com #{LAST_RESORT_SUGGESTION}
roosa@google.com #{LAST_RESORT_SUGGESTION}
smoreland@google.com #{LAST_RESORT_SUGGESTION}
-svetoslavganov@android.com #{LAST_RESORT_SUGGESTION}
-svetoslavganov@google.com #{LAST_RESORT_SUGGESTION}
yamasani@google.com #{LAST_RESORT_SUGGESTION}
# API changes are already covered by API-Review+1 (http://mdb/android-api-council)
@@ -30,7 +28,7 @@ per-file */TEST_MAPPING = *
# Support bulk translation updates
per-file */res*/values*/*.xml = byi@google.com, delphij@google.com
-per-file **.bp,**.mk = hansson@google.com
+per-file **.bp,**.mk = hansson@google.com, joeo@google.com
per-file TestProtoLibraries.bp = file:platform/platform_testing:/libraries/health/OWNERS
per-file TestProtoLibraries.bp = file:platform/tools/tradefederation:/OWNERS
diff --git a/apct-tests/perftests/autofill/src/android/view/autofill/LoginTest.java b/apct-tests/perftests/autofill/src/android/view/autofill/LoginTest.java
index a5d1e00139b5..59f08f645def 100644
--- a/apct-tests/perftests/autofill/src/android/view/autofill/LoginTest.java
+++ b/apct-tests/perftests/autofill/src/android/view/autofill/LoginTest.java
@@ -140,7 +140,7 @@ public class LoginTest extends AbstractAutofillPerfTestCase {
state.resumeTiming();
}
- // Sanity check
+ // Check for no errors
callback.assertNoAsyncErrors();
} finally {
mAfm.unregisterCallback(callback);
@@ -190,7 +190,7 @@ public class LoginTest extends AbstractAutofillPerfTestCase {
state.resumeTiming();
}
- // Sanity check
+ // Check for no errors
callback.assertNoAsyncErrors();
} finally {
mAfm.unregisterCallback(callback);
@@ -303,7 +303,7 @@ public class LoginTest extends AbstractAutofillPerfTestCase {
callback.expectEvent(mPassword, EVENT_INPUT_SHOWN);
}
- // Sanity check
+ // Check for no errors
callback.assertNoAsyncErrors();
} finally {
mAfm.unregisterCallback(callback);
diff --git a/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java b/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java
index a44d93972ae1..4d24c8c42530 100644
--- a/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java
+++ b/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java
@@ -97,16 +97,16 @@ public class UserLifecycleTests {
/** Name of users/profiles in the test. Users with this name may be freely removed. */
private static final String TEST_USER_NAME = "UserLifecycleTests_test_user";
- /** Name of dummy package used when timing how long app launches take. */
+ /** Name of placeholder package used when timing how long app launches take. */
private static final String DUMMY_PACKAGE_NAME = "perftests.multiuser.apps.dummyapp";
- // Copy of UserSystemPackageInstaller whitelist mode constants.
- private static final String PACKAGE_WHITELIST_MODE_PROP =
+ // Copy of UserSystemPackageInstaller allowlist mode constants.
+ private static final String PACKAGE_ALLOWLIST_MODE_PROP =
"persist.debug.user.package_whitelist_mode";
- private static final int USER_TYPE_PACKAGE_WHITELIST_MODE_DISABLE = 0;
- private static final int USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE = 0b001;
- private static final int USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST = 0b100;
- private static final int USER_TYPE_PACKAGE_WHITELIST_MODE_DEVICE_DEFAULT = -1;
+ private static final int USER_TYPE_PACKAGE_ALLOWLIST_MODE_DISABLE = 0;
+ private static final int USER_TYPE_PACKAGE_ALLOWLIST_MODE_ENFORCE = 0b001;
+ private static final int USER_TYPE_PACKAGE_ALLOWLIST_MODE_IMPLICIT_ALLOWLIST = 0b100;
+ private static final int USER_TYPE_PACKAGE_ALLOWLIST_MODE_DEVICE_DEFAULT = -1;
private UserManager mUm;
private ActivityManager mAm;
@@ -563,13 +563,13 @@ public class UserLifecycleTests {
}
// TODO: This is just a POC. Do this properly and add more.
- /** Tests starting (unlocking) a newly-created profile using the user-type-pkg-whitelist. */
+ /** Tests starting (unlocking) a newly-created profile using the user-type-pkg-allowlist. */
@Test(timeout = TIMEOUT_MAX_TEST_TIME_MS)
public void managedProfileUnlock_usingWhitelist() {
assumeTrue(mHasManagedUserFeature);
- final int origMode = getUserTypePackageWhitelistMode();
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE
- | USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST);
+ final int origMode = getUserTypePackageAllowlistMode();
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_ALLOWLIST_MODE_ENFORCE
+ | USER_TYPE_PACKAGE_ALLOWLIST_MODE_IMPLICIT_ALLOWLIST);
try {
while (mRunner.keepRunning()) {
@@ -586,15 +586,15 @@ public class UserLifecycleTests {
mRunner.resumeTimingForNextIteration();
}
} finally {
- setUserTypePackageWhitelistMode(origMode);
+ setUserTypePackageAllowlistMode(origMode);
}
}
- /** Tests starting (unlocking) a newly-created profile NOT using the user-type-pkg-whitelist. */
+ /** Tests starting (unlocking) a newly-created profile NOT using the user-type-pkg-allowlist. */
@Test(timeout = TIMEOUT_MAX_TEST_TIME_MS)
public void managedProfileUnlock_notUsingWhitelist() {
assumeTrue(mHasManagedUserFeature);
- final int origMode = getUserTypePackageWhitelistMode();
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_DISABLE);
+ final int origMode = getUserTypePackageAllowlistMode();
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_ALLOWLIST_MODE_DISABLE);
try {
while (mRunner.keepRunning()) {
@@ -611,7 +611,7 @@ public class UserLifecycleTests {
mRunner.resumeTimingForNextIteration();
}
} finally {
- setUserTypePackageWhitelistMode(origMode);
+ setUserTypePackageAllowlistMode(origMode);
}
}
@@ -822,17 +822,17 @@ public class UserLifecycleTests {
attestTrue(errMsg, success);
}
- /** Gets the PACKAGE_WHITELIST_MODE_PROP System Property. */
- private int getUserTypePackageWhitelistMode() {
- return SystemProperties.getInt(PACKAGE_WHITELIST_MODE_PROP,
- USER_TYPE_PACKAGE_WHITELIST_MODE_DEVICE_DEFAULT);
+ /** Gets the PACKAGE_ALLOWLIST_MODE_PROP System Property. */
+ private int getUserTypePackageAllowlistMode() {
+ return SystemProperties.getInt(PACKAGE_ALLOWLIST_MODE_PROP,
+ USER_TYPE_PACKAGE_ALLOWLIST_MODE_DEVICE_DEFAULT);
}
- /** Sets the PACKAGE_WHITELIST_MODE_PROP System Property to the given value. */
- private void setUserTypePackageWhitelistMode(int mode) {
+ /** Sets the PACKAGE_ALLOWLIST_MODE_PROP System Property to the given value. */
+ private void setUserTypePackageAllowlistMode(int mode) {
String result = ShellHelper.runShellCommand(
- String.format("setprop %s %d", PACKAGE_WHITELIST_MODE_PROP, mode));
- attestFalse("Failed to set sysprop " + PACKAGE_WHITELIST_MODE_PROP + ": " + result,
+ String.format("setprop %s %d", PACKAGE_ALLOWLIST_MODE_PROP, mode));
+ attestFalse("Failed to set sysprop " + PACKAGE_ALLOWLIST_MODE_PROP + ": " + result,
result != null && result.contains("Failed"));
}
diff --git a/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java b/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java
index fb62920681de..9e29820706c7 100644
--- a/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java
+++ b/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java
@@ -111,7 +111,7 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase
stopProfiling();
}
- /** A dummy view to get IWindow. */
+ /** A placeholder view to get IWindow. */
private static class ContentView extends LinearLayout {
ContentView(Context context) {
super(context);
diff --git a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java
index f49cdbf403f0..92320d3eec37 100644
--- a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java
+++ b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java
@@ -360,7 +360,7 @@ public class JobInfo implements Parcelable {
/**
* Allows this job to run despite doze restrictions as long as the app is in the foreground
- * or on the temporary whitelist
+ * or on the temporary allowlist
* @hide
*/
public static final int FLAG_IMPORTANT_WHILE_FOREGROUND = 1 << 1;
@@ -1803,13 +1803,13 @@ public class JobInfo implements Parcelable {
/**
* Setting this to true indicates that this job is important while the scheduling app
- * is in the foreground or on the temporary whitelist for background restrictions.
+ * is in the foreground or on the temporary allowlist for background restrictions.
* This means that the system will relax doze restrictions on this job during this time.
*
* Apps should use this flag only for short jobs that are essential for the app to function
* properly in the foreground.
*
- * Note that once the scheduling app is no longer whitelisted from background restrictions
+ * Note that once the scheduling app is no longer allowlisted from background restrictions
* and in the background, or the job failed due to unsatisfied constraints,
* this job should be expected to behave like other jobs without this flag.
*
diff --git a/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java b/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java
index 4ce31e96208c..20da1718abb0 100644
--- a/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java
+++ b/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java
@@ -29,10 +29,10 @@ import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
- * Interface to access and modify the permanent and temporary power save whitelist. The two lists
- * are kept separately. Apps placed on the permanent whitelist are only removed via an explicit
- * removeFromWhitelist call. Apps whitelisted by default by the system cannot be removed. Apps
- * placed on the temporary whitelist are removed from that whitelist after a predetermined amount of
+ * Interface to access and modify the permanent and temporary power save allowlist. The two lists
+ * are kept separately. Apps placed on the permanent allowlist are only removed via an explicit
+ * removeFromAllowlist call. Apps whitelisted by default by the system cannot be removed. Apps
+ * placed on the temporary allowlist are removed from that allowlist after a predetermined amount of
* time.
*
* @deprecated Use {@link PowerExemptionManager} instead
@@ -50,18 +50,18 @@ public class PowerWhitelistManager {
private final PowerExemptionManager mPowerExemptionManager;
/**
- * Indicates that an unforeseen event has occurred and the app should be whitelisted to handle
+ * Indicates that an unforeseen event has occurred and the app should be allowlisted to handle
* it.
*/
public static final int EVENT_UNSPECIFIED = PowerExemptionManager.EVENT_UNSPECIFIED;
/**
- * Indicates that an SMS event has occurred and the app should be whitelisted to handle it.
+ * Indicates that an SMS event has occurred and the app should be allowlisted to handle it.
*/
public static final int EVENT_SMS = PowerExemptionManager.EVENT_SMS;
/**
- * Indicates that an MMS event has occurred and the app should be whitelisted to handle it.
+ * Indicates that an MMS event has occurred and the app should be allowlisted to handle it.
*/
public static final int EVENT_MMS = PowerExemptionManager.EVENT_MMS;
@@ -381,7 +381,7 @@ public class PowerWhitelistManager {
}
/**
- * Add the specified package to the permanent power save whitelist.
+ * Add the specified package to the permanent power save allowlist.
*
* @deprecated Use {@link PowerExemptionManager#addToPermanentAllowList(String)} instead
*/
@@ -392,7 +392,7 @@ public class PowerWhitelistManager {
}
/**
- * Add the specified packages to the permanent power save whitelist.
+ * Add the specified packages to the permanent power save allowlist.
*
* @deprecated Use {@link PowerExemptionManager#addToPermanentAllowList(List)} instead
*/
@@ -403,10 +403,10 @@ public class PowerWhitelistManager {
}
/**
- * Get a list of app IDs of app that are whitelisted. This does not include temporarily
- * whitelisted apps.
+ * Get a list of app IDs of app that are allowlisted. This does not include temporarily
+ * allowlisted apps.
*
- * @param includingIdle Set to true if the app should be whitelisted from device idle as well
+ * @param includingIdle Set to true if the app should be allowlisted from device idle as well
* as other power save restrictions
* @deprecated Use {@link PowerExemptionManager#getAllowListedAppIds(boolean)} instead
* @hide
@@ -418,10 +418,10 @@ public class PowerWhitelistManager {
}
/**
- * Returns true if the app is whitelisted from power save restrictions. This does not include
- * temporarily whitelisted apps.
+ * Returns true if the app is allowlisted from power save restrictions. This does not include
+ * temporarily allowlisted apps.
*
- * @param includingIdle Set to true if the app should be whitelisted from device
+ * @param includingIdle Set to true if the app should be allowlisted from device
* idle as well as other power save restrictions
* @deprecated Use {@link PowerExemptionManager#isAllowListed(String, boolean)} instead
* @hide
@@ -432,11 +432,11 @@ public class PowerWhitelistManager {
}
/**
- * Remove an app from the permanent power save whitelist. Only apps that were added via
+ * Remove an app from the permanent power save allowlist. Only apps that were added via
* {@link #addToWhitelist(String)} or {@link #addToWhitelist(List)} will be removed. Apps
- * whitelisted by default by the system cannot be removed.
+ * allowlisted by default by the system cannot be removed.
*
- * @param packageName The app to remove from the whitelist
+ * @param packageName The app to remove from the allowlist
* @deprecated Use {@link PowerExemptionManager#removeFromPermanentAllowList(String)} instead
*/
@Deprecated
@@ -446,10 +446,10 @@ public class PowerWhitelistManager {
}
/**
- * Add an app to the temporary whitelist for a short amount of time.
+ * Add an app to the temporary allowlist for a short amount of time.
*
- * @param packageName The package to add to the temp whitelist
- * @param durationMs How long to keep the app on the temp whitelist for (in milliseconds)
+ * @param packageName The package to add to the temp allowlist
+ * @param durationMs How long to keep the app on the temp allowlist for (in milliseconds)
* @param reasonCode one of {@link ReasonCode}, use {@link #REASON_UNKNOWN} if not sure.
* @param reason a optional human readable reason string, could be null or empty string.
* @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowList(
@@ -463,10 +463,10 @@ public class PowerWhitelistManager {
}
/**
- * Add an app to the temporary whitelist for a short amount of time.
+ * Add an app to the temporary allowlist for a short amount of time.
*
- * @param packageName The package to add to the temp whitelist
- * @param durationMs How long to keep the app on the temp whitelist for (in milliseconds)
+ * @param packageName The package to add to the temp allowlist
+ * @param durationMs How long to keep the app on the temp allowlist for (in milliseconds)
* @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowList(
* String, int, String, long)} instead
*/
@@ -478,15 +478,15 @@ public class PowerWhitelistManager {
}
/**
- * Add an app to the temporary whitelist for a short amount of time for a specific reason. The
- * temporary whitelist is kept separately from the permanent whitelist and apps are
- * automatically removed from the temporary whitelist after a predetermined amount of time.
+ * Add an app to the temporary allowlist for a short amount of time for a specific reason. The
+ * temporary allowlist is kept separately from the permanent allowlist and apps are
+ * automatically removed from the temporary allowlist after a predetermined amount of time.
*
- * @param packageName The package to add to the temp whitelist
- * @param event The reason to add the app to the temp whitelist
- * @param reason A human-readable reason explaining why the app is temp whitelisted. Only
+ * @param packageName The package to add to the temp allowlist
+ * @param event The reason to add the app to the temp allowlist
+ * @param reason A human-readable reason explaining why the app is temp allowlisted. Only
* used for logging purposes. Could be null or empty string.
- * @return The duration (in milliseconds) that the app is whitelisted for
+ * @return The duration (in milliseconds) that the app is allowlisted for
* @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowListForEvent(
* String, int, String, int)} instead
*/
@@ -499,16 +499,16 @@ public class PowerWhitelistManager {
}
/**
- * Add an app to the temporary whitelist for a short amount of time for a specific reason. The
- * temporary whitelist is kept separately from the permanent whitelist and apps are
- * automatically removed from the temporary whitelist after a predetermined amount of time.
+ * Add an app to the temporary allowlist for a short amount of time for a specific reason. The
+ * temporary allowlist is kept separately from the permanent allowlist and apps are
+ * automatically removed from the temporary allowlist after a predetermined amount of time.
*
- * @param packageName The package to add to the temp whitelist
- * @param event The reason to add the app to the temp whitelist
+ * @param packageName The package to add to the temp allowlist
+ * @param event The reason to add the app to the temp allowlist
* @param reasonCode one of {@link ReasonCode}, use {@link #REASON_UNKNOWN} if not sure.
- * @param reason A human-readable reason explaining why the app is temp whitelisted. Only
+ * @param reason A human-readable reason explaining why the app is temp allowlisted. Only
* used for logging purposes. Could be null or empty string.
- * @return The duration (in milliseconds) that the app is whitelisted for
+ * @return The duration (in milliseconds) that the app is allowlisted for
* @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowListForEvent(
* String, int, String, int)} instead
*/
diff --git a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java
index 342465138ac7..012da85624e1 100644
--- a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java
@@ -713,7 +713,7 @@ public class AlarmManagerService extends SystemService {
private static final long DEFAULT_MIN_INTERVAL = 60 * 1000;
private static final long DEFAULT_MAX_INTERVAL = 365 * INTERVAL_DAY;
private static final long DEFAULT_MIN_WINDOW = 10 * 60 * 1000;
- private static final long DEFAULT_ALLOW_WHILE_IDLE_WHITELIST_DURATION = 10 * 1000;
+ private static final long DEFAULT_ALLOW_WHILE_IDLE_ALLOWLIST_DURATION = 10 * 1000;
private static final long DEFAULT_LISTENER_TIMEOUT = 5 * 1000;
private static final int DEFAULT_MAX_ALARMS_PER_UID = 500;
private static final long DEFAULT_APP_STANDBY_WINDOW = 60 * 60 * 1000; // 1 hr
@@ -768,7 +768,7 @@ public class AlarmManagerService extends SystemService {
// BroadcastOptions.setTemporaryAppWhitelistDuration() to use for FLAG_ALLOW_WHILE_IDLE.
public long ALLOW_WHILE_IDLE_WHITELIST_DURATION
- = DEFAULT_ALLOW_WHILE_IDLE_WHITELIST_DURATION;
+ = DEFAULT_ALLOW_WHILE_IDLE_ALLOWLIST_DURATION;
// Direct alarm listener callback timeout
public long LISTENER_TIMEOUT = DEFAULT_LISTENER_TIMEOUT;
@@ -970,7 +970,7 @@ public class AlarmManagerService extends SystemService {
case KEY_ALLOW_WHILE_IDLE_WHITELIST_DURATION:
ALLOW_WHILE_IDLE_WHITELIST_DURATION = properties.getLong(
KEY_ALLOW_WHILE_IDLE_WHITELIST_DURATION,
- DEFAULT_ALLOW_WHILE_IDLE_WHITELIST_DURATION);
+ DEFAULT_ALLOW_WHILE_IDLE_ALLOWLIST_DURATION);
updateAllowWhileIdleWhitelistDurationLocked();
break;
case KEY_LISTENER_TIMEOUT:
@@ -1593,7 +1593,7 @@ public class AlarmManagerService extends SystemService {
* Check all alarms in {@link #mPendingBackgroundAlarms} and send the ones that are not
* restricted.
*
- * This is only called when the power save whitelist changes, so it's okay to be slow.
+ * This is only called when the power save allowlist changes, so it's okay to be slow.
*/
@GuardedBy("mLock")
void sendAllUnrestrictedPendingBackgroundAlarmsLocked() {
@@ -2235,7 +2235,7 @@ public class AlarmManagerService extends SystemService {
}
}
- // Sanity check the recurrence interval. This will catch people who supply
+ // Validate the recurrence interval. This will catch people who supply
// seconds when the API expects milliseconds, or apps trying shenanigans
// around intentional period overflow, etc.
final long minInterval = mConstants.MIN_INTERVAL;
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java
index 58953c45a794..2994cf2dad6d 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java
@@ -331,6 +331,7 @@ public final class JobServiceContext implements ServiceConnection {
if (DEBUG) {
Slog.d(TAG, job.getServiceComponent().getShortClassName() + " unavailable.");
}
+ mContext.unbindService(this);
mRunningJob = null;
mRunningJobWorkType = WORK_TYPE_NONE;
mRunningCallback = null;
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
index fb342b9ba9b3..913a76a65026 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
@@ -61,6 +61,7 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
@@ -802,6 +803,9 @@ public class AppIdleHistory {
}
}
}
+ } catch (FileNotFoundException e) {
+ // Expected on first boot
+ Slog.d(TAG, "App idle file for user " + userId + " does not exist");
} catch (IOException | XmlPullParserException e) {
Slog.e(TAG, "Unable to read app idle file for user " + userId, e);
} finally {
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 28db61f7d98a..a040b572a003 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -49,7 +49,7 @@ public:
virtual void onVmCreated(JNIEnv* env)
{
- if (mClassName.isEmpty()) {
+ if (mClassName.empty()) {
return; // Zygote. Nothing to do here.
}
@@ -66,10 +66,10 @@ public:
* executing boot class Java code and thereby deny ourselves access to
* non-boot classes.
*/
- char* slashClassName = toSlashClassName(mClassName.string());
+ char* slashClassName = toSlashClassName(mClassName.c_str());
mClass = env->FindClass(slashClassName);
if (mClass == NULL) {
- ALOGE("ERROR: could not find class '%s'\n", mClassName.string());
+ ALOGE("ERROR: could not find class '%s'\n", mClassName.c_str());
}
free(slashClassName);
@@ -98,7 +98,7 @@ public:
virtual void onExit(int code)
{
- if (mClassName.isEmpty()) {
+ if (mClassName.empty()) {
// if zygote
IPCThreadState::self()->stopProcess();
hardware::IPCThreadState::self()->stopProcess();
@@ -179,7 +179,7 @@ int main(int argc, char* const argv[])
argv_String.append(argv[i]);
argv_String.append("\" ");
}
- ALOGV("app_process main with argv: %s", argv_String.string());
+ ALOGV("app_process main with argv: %s", argv_String.c_str());
}
AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv));
@@ -282,7 +282,7 @@ int main(int argc, char* const argv[])
}
Vector<String8> args;
- if (!className.isEmpty()) {
+ if (!className.empty()) {
// We're not in zygote mode, the only argument we need to pass
// to RuntimeInit is the application argument.
//
@@ -300,7 +300,7 @@ int main(int argc, char* const argv[])
restOfArgs.append(argv_new[k]);
restOfArgs.append("\" ");
}
- ALOGV("Class name = %s, args = %s", className.string(), restOfArgs.string());
+ ALOGV("Class name = %s, args = %s", className.c_str(), restOfArgs.c_str());
}
} else {
// We're in zygote mode.
@@ -328,13 +328,13 @@ int main(int argc, char* const argv[])
}
}
- if (!niceName.isEmpty()) {
- runtime.setArgv0(niceName.string(), true /* setProcName */);
+ if (!niceName.empty()) {
+ runtime.setArgv0(niceName.c_str(), true /* setProcName */);
}
if (zygote) {
runtime.start("com.android.internal.os.ZygoteInit", args, zygote);
- } else if (!className.isEmpty()) {
+ } else if (!className.empty()) {
runtime.start("com.android.internal.os.RuntimeInit", args, zygote);
} else {
fprintf(stderr, "Error: no class name or --zygote supplied.\n");
diff --git a/cmds/backup/backup.cpp b/cmds/backup/backup.cpp
index 8d9b528ae6a9..c2ce69011d92 100644
--- a/cmds/backup/backup.cpp
+++ b/cmds/backup/backup.cpp
@@ -75,7 +75,7 @@ static int perform_list(const char* filename)
size_t dataSize;
err = reader.ReadEntityHeader(&key, &dataSize);
if (err == 0) {
- printf(" entity: %s (%zu bytes)\n", key.string(), dataSize);
+ printf(" entity: %s (%zu bytes)\n", key.c_str(), dataSize);
} else {
printf(" Error reading entity header\n");
}
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index ed717c491467..81be44ae7383 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -191,7 +191,7 @@ public class Bmgr {
}
if ("whitelist".equals(op)) {
- doPrintWhitelist();
+ doPrintAllowlist();
return;
}
@@ -873,7 +873,7 @@ public class Bmgr {
}
}
- private void doPrintWhitelist() {
+ private void doPrintAllowlist() {
try {
final String[] whitelist = mBmgr.getTransportWhitelist();
if (whitelist != null) {
diff --git a/cmds/bootanimation/Android.bp b/cmds/bootanimation/Android.bp
index 3534624a58a2..98767ee733ad 100644
--- a/cmds/bootanimation/Android.bp
+++ b/cmds/bootanimation/Android.bp
@@ -74,4 +74,7 @@ cc_library_shared {
"libGLESv2",
"libgui",
],
+ whole_static_libs: [
+ "libc++fs",
+ ],
}
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 5b9d989bdfe6..4690f3386616 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -17,6 +17,7 @@
#define LOG_NDEBUG 0
#define LOG_TAG "BootAnimation"
+#include <filesystem>
#include <vector>
#include <stdint.h>
@@ -690,7 +691,7 @@ void BootAnimation::resizeSurface(int newWidth, int newHeight) {
bool BootAnimation::preloadAnimation() {
findBootAnimationFile();
- if (!mZipFileName.isEmpty()) {
+ if (!mZipFileName.empty()) {
mAnimation = loadAnimation(mZipFileName);
return (mAnimation != nullptr);
}
@@ -820,7 +821,7 @@ bool BootAnimation::threadLoop() {
// We have no bootanimation file, so we use the stock android logo
// animation.
- if (mZipFileName.isEmpty()) {
+ if (mZipFileName.empty()) {
ALOGD("No animation file");
result = android();
} else {
@@ -1136,7 +1137,7 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) {
if (!readFile(animation.zip, "desc.txt", desString)) {
return false;
}
- char const* s = desString.string();
+ char const* s = desString.c_str();
std::string dynamicColoringPartName = "";
bool postDynamicColoring = false;
@@ -1145,7 +1146,7 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) {
const char* endl = strstr(s, "\n");
if (endl == nullptr) break;
String8 line(s, endl - s);
- const char* l = line.string();
+ const char* l = line.c_str();
int fps = 0;
int width = 0;
int height = 0;
@@ -1271,10 +1272,10 @@ bool BootAnimation::preloadZip(Animation& animation) {
continue;
}
- const String8 entryName(name);
- const String8 path(entryName.getPathDir());
- const String8 leaf(entryName.getPathLeaf());
- if (leaf.size() > 0) {
+ const std::filesystem::path entryName(name);
+ const std::filesystem::path path(entryName.parent_path());
+ const std::filesystem::path leaf(entryName.filename());
+ if (!leaf.empty()) {
if (entryName == CLOCK_FONT_ZIP_NAME) {
FileMap* map = zip->createEntryFileMap(entry);
if (map) {
@@ -1292,7 +1293,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
}
for (size_t j = 0; j < pcount; j++) {
- if (path == animation.parts[j].path) {
+ if (path.string() == animation.parts[j].path.c_str()) {
uint16_t method;
// supports only stored png files
if (zip->getEntryInfo(entry, &method, nullptr, nullptr, nullptr, nullptr, nullptr)) {
@@ -1309,7 +1310,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
map->getDataLength());
} else {
Animation::Frame frame;
- frame.name = leaf;
+ frame.name = leaf.c_str();
frame.map = map;
frame.trimWidth = animation.width;
frame.trimHeight = animation.height;
@@ -1329,7 +1330,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
// If there is trimData present, override the positioning defaults.
for (Animation::Part& part : animation.parts) {
- const char* trimDataStr = part.trimData.string();
+ const char* trimDataStr = part.trimData.c_str();
for (size_t frameIdx = 0; frameIdx < part.frames.size(); frameIdx++) {
const char* endl = strstr(trimDataStr, "\n");
// No more trimData for this part.
@@ -1337,7 +1338,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
break;
}
String8 line(trimDataStr, endl - trimDataStr);
- const char* lineStr = line.string();
+ const char* lineStr = line.c_str();
trimDataStr = ++endl;
int width = 0, height = 0, x = 0, y = 0;
if (sscanf(lineStr, "%dx%d+%d+%d", &width, &height, &x, &y) == 4) {
@@ -1565,7 +1566,7 @@ bool BootAnimation::playAnimation(const Animation& animation) {
1.0f);
ALOGD("Playing files = %s/%s, Requested repeat = %d, playUntilComplete = %s",
- animation.fileName.string(), part.path.string(), part.count,
+ animation.fileName.c_str(), part.path.c_str(), part.count,
part.playUntilComplete ? "true" : "false");
// For the last animation, if we have progress indicator from
@@ -1786,17 +1787,17 @@ void BootAnimation::releaseAnimation(Animation* animation) const {
BootAnimation::Animation* BootAnimation::loadAnimation(const String8& fn) {
if (mLoadedFiles.indexOf(fn) >= 0) {
SLOGE("File \"%s\" is already loaded. Cyclic ref is not allowed",
- fn.string());
+ fn.c_str());
return nullptr;
}
ZipFileRO *zip = ZipFileRO::open(fn);
if (zip == nullptr) {
SLOGE("Failed to open animation zip \"%s\": %s",
- fn.string(), strerror(errno));
+ fn.c_str(), strerror(errno));
return nullptr;
}
- ALOGD("%s is loaded successfully", fn.string());
+ ALOGD("%s is loaded successfully", fn.c_str());
Animation *animation = new Animation;
animation->fileName = fn;
diff --git a/cmds/incident/main.cpp b/cmds/incident/main.cpp
index 6e0bd0629274..0d9f4e92662b 100644
--- a/cmds/incident/main.cpp
+++ b/cmds/incident/main.cpp
@@ -83,8 +83,8 @@ StatusListener::onReportSectionStatus(int32_t section, int32_t status)
Status
StatusListener::onReportServiceStatus(const String16& service, int32_t status)
{
- fprintf(stderr, "service '%s' status %d\n", String8(service).string(), status);
- ALOGD("service '%s' status %d\n", String8(service).string(), status);
+ fprintf(stderr, "service '%s' status %d\n", String8(service).c_str(), status);
+ ALOGD("service '%s' status %d\n", String8(service).c_str(), status);
return Status::ok();
}
@@ -384,7 +384,7 @@ main(int argc, char** argv)
status = service->reportIncidentToStream(args, listener, std::move(writeEnd));
if (!status.isOk()) {
- fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
+ fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().c_str());
return 1;
}
@@ -396,14 +396,14 @@ main(int argc, char** argv)
sp<StatusListener> listener(new StatusListener());
status = service->reportIncidentToDumpstate(std::move(writeEnd), listener);
if (!status.isOk()) {
- fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
+ fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().c_str());
return 1;
}
return listener->getExitCodeOrElse(stream_output(fds[0], STDOUT_FILENO));
} else {
status = service->reportIncident(args);
if (!status.isOk()) {
- fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
+ fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().c_str());
return 1;
} else {
return 0;
diff --git a/cmds/incident_helper/src/TextParserBase.cpp b/cmds/incident_helper/src/TextParserBase.cpp
index e9bc70f37026..e625afa626ec 100644
--- a/cmds/incident_helper/src/TextParserBase.cpp
+++ b/cmds/incident_helper/src/TextParserBase.cpp
@@ -27,11 +27,11 @@ status_t NoopParser::Parse(const int in, const int out) const
{
string content;
if (!ReadFdToString(in, &content)) {
- fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.string());
+ fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.c_str());
return -1;
}
if (!WriteStringToFd(content, out)) {
- fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.string());
+ fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.c_str());
return -1;
}
return NO_ERROR;
@@ -42,13 +42,13 @@ status_t ReverseParser::Parse(const int in, const int out) const
{
string content;
if (!ReadFdToString(in, &content)) {
- fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.string());
+ fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.c_str());
return -1;
}
// reverse the content
reverse(content.begin(), content.end());
if (!WriteStringToFd(content, out)) {
- fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.string());
+ fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.c_str());
return -1;
}
return NO_ERROR;
diff --git a/cmds/incident_helper/src/main.cpp b/cmds/incident_helper/src/main.cpp
index ff5fd86cf11e..cc03d4a65f17 100644
--- a/cmds/incident_helper/src/main.cpp
+++ b/cmds/incident_helper/src/main.cpp
@@ -101,7 +101,7 @@ int main(int argc, char** argv) {
fprintf(stderr, "Pasring section %d...\n", sectionID);
TextParserBase* parser = selectParser(sectionID);
if (parser != nullptr) {
- fprintf(stderr, "Running parser: %s\n", parser->name.string());
+ fprintf(stderr, "Running parser: %s\n", parser->name.c_str());
status_t err = parser->Parse(STDIN_FILENO, STDOUT_FILENO);
if (err != NO_ERROR) {
fprintf(stderr, "Parse error in section %d: %s\n", sectionID, strerror(-err));
diff --git a/cmds/incident_helper/src/parsers/BatteryTypeParser.cpp b/cmds/incident_helper/src/parsers/BatteryTypeParser.cpp
index ced6cf807e0d..2a032fbf3aa6 100644
--- a/cmds/incident_helper/src/parsers/BatteryTypeParser.cpp
+++ b/cmds/incident_helper/src/parsers/BatteryTypeParser.cpp
@@ -52,9 +52,9 @@ BatteryTypeParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/CpuFreqParser.cpp b/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
index 43a12f603ba3..c9bf4c528109 100644
--- a/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
@@ -82,9 +82,9 @@ CpuFreqParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
index 5d525e6c7f3e..77751a2fdfc0 100644
--- a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
@@ -130,11 +130,11 @@ CpuInfoParser::Parse(const int in, const int out) const
record = parseRecordByColumns(line, columnIndices);
diff = record.size() - header.size();
if (diff < 0) {
- fprintf(stderr, "[%s]Line %d has %d missing fields\n%s\n", this->name.string(), nline, -diff, line.c_str());
+ fprintf(stderr, "[%s]Line %d has %d missing fields\n%s\n", this->name.c_str(), nline, -diff, line.c_str());
printRecord(record);
continue;
} else if (diff > 0) {
- fprintf(stderr, "[%s]Line %d has %d extra fields\n%s\n", this->name.string(), nline, diff, line.c_str());
+ fprintf(stderr, "[%s]Line %d has %d extra fields\n%s\n", this->name.c_str(), nline, diff, line.c_str());
printRecord(record);
continue;
}
@@ -143,7 +143,7 @@ CpuInfoParser::Parse(const int in, const int out) const
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d fails to insert field %s with value %s\n",
- this->name.string(), nline, header[i].c_str(), record[i].c_str());
+ this->name.c_str(), nline, header[i].c_str(), record[i].c_str());
}
}
proto.end(token);
@@ -155,9 +155,9 @@ CpuInfoParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp b/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp
index 4fd6b068cf1e..0474a5055bf2 100644
--- a/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp
+++ b/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp
@@ -76,9 +76,9 @@ EventLogTagsParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
index 85beaf06eeb8..d16c23cce29b 100644
--- a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
+++ b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
@@ -51,11 +51,11 @@ KernelWakesParser::Parse(const int in, const int out) const
if (record.size() < header.size()) {
// TODO: log this to incident report!
- fprintf(stderr, "[%s]Line %d has missing fields\n%s\n", this->name.string(), nline, line.c_str());
+ fprintf(stderr, "[%s]Line %d has missing fields\n%s\n", this->name.c_str(), nline, line.c_str());
continue;
} else if (record.size() > header.size()) {
// TODO: log this to incident report!
- fprintf(stderr, "[%s]Line %d has extra fields\n%s\n", this->name.string(), nline, line.c_str());
+ fprintf(stderr, "[%s]Line %d has extra fields\n%s\n", this->name.c_str(), nline, line.c_str());
continue;
}
@@ -63,7 +63,7 @@ KernelWakesParser::Parse(const int in, const int out) const
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
- this->name.string(), nline, header[i].c_str(), record[i].c_str());
+ this->name.c_str(), nline, header[i].c_str(), record[i].c_str());
}
}
proto.end(token);
@@ -75,9 +75,9 @@ KernelWakesParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
index 2a89c920c119..36710dfea8f1 100644
--- a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
@@ -114,10 +114,10 @@ PageTypeInfoParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/ProcrankParser.cpp b/cmds/incident_helper/src/parsers/ProcrankParser.cpp
index 4763b482e368..997d2e50a14b 100644
--- a/cmds/incident_helper/src/parsers/ProcrankParser.cpp
+++ b/cmds/incident_helper/src/parsers/ProcrankParser.cpp
@@ -60,7 +60,7 @@ ProcrankParser::Parse(const int in, const int out) const
if (record[record.size() - 1] == "TOTAL") { // TOTAL record
total = line;
} else {
- fprintf(stderr, "[%s]Line %d has missing fields\n%s\n", this->name.string(), nline,
+ fprintf(stderr, "[%s]Line %d has missing fields\n%s\n", this->name.c_str(), nline,
line.c_str());
}
continue;
@@ -70,7 +70,7 @@ ProcrankParser::Parse(const int in, const int out) const
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
- this->name.string(), nline, header[i].c_str(), record[i].c_str());
+ this->name.c_str(), nline, header[i].c_str(), record[i].c_str());
}
}
proto.end(token);
@@ -104,9 +104,9 @@ ProcrankParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/PsParser.cpp b/cmds/incident_helper/src/parsers/PsParser.cpp
index d3cb4be59f66..55aa555794c0 100644
--- a/cmds/incident_helper/src/parsers/PsParser.cpp
+++ b/cmds/incident_helper/src/parsers/PsParser.cpp
@@ -61,12 +61,12 @@ status_t PsParser::Parse(const int in, const int out) const {
diff = record.size() - header.size();
if (diff < 0) {
// TODO: log this to incident report!
- fprintf(stderr, "[%s]Line %d has %d missing fields\n%s\n", this->name.string(), nline, -diff, line.c_str());
+ fprintf(stderr, "[%s]Line %d has %d missing fields\n%s\n", this->name.c_str(), nline, -diff, line.c_str());
printRecord(record);
continue;
} else if (diff > 0) {
// TODO: log this to incident report!
- fprintf(stderr, "[%s]Line %d has %d extra fields\n%s\n", this->name.string(), nline, diff, line.c_str());
+ fprintf(stderr, "[%s]Line %d has %d extra fields\n%s\n", this->name.c_str(), nline, diff, line.c_str());
printRecord(record);
continue;
}
@@ -75,7 +75,7 @@ status_t PsParser::Parse(const int in, const int out) const {
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
- this->name.string(), nline, header[i].c_str(), record[i].c_str());
+ this->name.c_str(), nline, header[i].c_str(), record[i].c_str());
}
}
proto.end(token);
@@ -87,9 +87,9 @@ status_t PsParser::Parse(const int in, const int out) const {
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp b/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp
index eba536bd9e9c..86c34bc25bd8 100644
--- a/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp
+++ b/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp
@@ -219,9 +219,9 @@ SystemPropertiesParser::Parse(const int in, const int out) const
}
if (!proto.flush(out)) {
- fprintf(stderr, "[%s]Error writing proto back\n", this->name.string());
+ fprintf(stderr, "[%s]Error writing proto back\n", this->name.c_str());
return -1;
}
- fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
+ fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.c_str(), proto.size());
return NO_ERROR;
}
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 05a43ad7d936..53c7b744ee0f 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -407,8 +407,8 @@ Status IncidentService::systemRunning() {
Status IncidentService::getIncidentReportList(const String16& pkg16, const String16& cls16,
vector<String16>* result) {
status_t err;
- const string pkg(String8(pkg16).string());
- const string cls(String8(cls16).string());
+ const string pkg(String8(pkg16).c_str());
+ const string cls(String8(cls16).c_str());
// List the reports
vector<sp<ReportFile>> all;
@@ -441,9 +441,9 @@ Status IncidentService::getIncidentReport(const String16& pkg16, const String16&
const String16& id16, IncidentManager::IncidentReport* result) {
status_t err;
- const string pkg(String8(pkg16).string());
- const string cls(String8(cls16).string());
- const string id(String8(id16).string());
+ const string pkg(String8(pkg16).c_str());
+ const string cls(String8(cls16).c_str());
+ const string id(String8(id16).c_str());
IncidentReportArgs args;
sp<ReportFile> file = mWorkDirectory->getReport(pkg, cls, id, &args);
@@ -470,9 +470,9 @@ Status IncidentService::getIncidentReport(const String16& pkg16, const String16&
Status IncidentService::deleteIncidentReports(const String16& pkg16, const String16& cls16,
const String16& id16) {
- const string pkg(String8(pkg16).string());
- const string cls(String8(cls16).string());
- const string id(String8(id16).string());
+ const string pkg(String8(pkg16).c_str());
+ const string cls(String8(cls16).c_str());
+ const string id(String8(id16).c_str());
sp<ReportFile> file = mWorkDirectory->getReport(pkg, cls, id, nullptr);
if (file != nullptr) {
@@ -484,7 +484,7 @@ Status IncidentService::deleteIncidentReports(const String16& pkg16, const Strin
}
Status IncidentService::deleteAllIncidentReports(const String16& pkg16) {
- const string pkg(String8(pkg16).string());
+ const string pkg(String8(pkg16).c_str());
mWorkDirectory->commitAll(pkg);
mBroadcaster->clearPackageBroadcasts(pkg);
@@ -568,7 +568,7 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8
while (SECTION_LIST[idx] != NULL) {
const Section* section = SECTION_LIST[idx];
if (section->id == id) {
- fprintf(out, "Section[%d] %s\n", id, section->name.string());
+ fprintf(out, "Section[%d] %s\n", id, section->name.c_str());
break;
}
idx++;
@@ -592,7 +592,7 @@ status_t IncidentService::cmd_help(FILE* out) {
static void printPrivacy(const Privacy* p, FILE* out, String8 indent) {
if (p == NULL) return;
- fprintf(out, "%sid:%d, type:%d, dest:%d\n", indent.string(), p->field_id, p->type, p->policy);
+ fprintf(out, "%sid:%d, type:%d, dest:%d\n", indent.c_str(), p->field_id, p->type, p->policy);
if (p->children == NULL) return;
for (int i = 0; p->children[i] != NULL; i++) { // NULL-terminated.
printPrivacy(p->children[i], out, indent + " ");
@@ -605,7 +605,7 @@ status_t IncidentService::cmd_privacy(FILE* in, FILE* out, FILE* err, Vector<Str
const int argCount = args.size();
if (argCount >= 3) {
String8 opt = args[1];
- int sectionId = atoi(args[2].string());
+ int sectionId = atoi(args[2].c_str());
const Privacy* p = get_privacy_of_section(sectionId);
if (p == NULL) {
diff --git a/cmds/incidentd/src/Reporter.cpp b/cmds/incidentd/src/Reporter.cpp
index 86a78f095f52..c9cf7275a821 100644
--- a/cmds/incidentd/src/Reporter.cpp
+++ b/cmds/incidentd/src/Reporter.cpp
@@ -711,7 +711,7 @@ status_t Reporter::execute_section(const Section* section, IncidentMetadata* met
return NO_ERROR;
}
- ALOGD("Start incident report section %d '%s'", sectionId, section->name.string());
+ ALOGD("Start incident report section %d '%s'", sectionId, section->name.c_str());
IncidentMetadata::SectionStats* sectionMetadata = metadata->add_sections();
// Notify listener of starting
@@ -747,7 +747,7 @@ status_t Reporter::execute_section(const Section* section, IncidentMetadata* met
sectionId, IIncidentReportStatusListener::STATUS_FINISHED);
});
- ALOGD("Finish incident report section %d '%s'", sectionId, section->name.string());
+ ALOGD("Finish incident report section %d '%s'", sectionId, section->name.c_str());
return NO_ERROR;
}
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 581367a75804..c2aa26948146 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -60,7 +60,7 @@ const char INCIDENT_HELPER[] = "/system/bin/incident_helper";
const char* GZIP[] = {"/system/bin/gzip", NULL};
static pid_t fork_execute_incident_helper(const int id, Fpipe* p2cPipe, Fpipe* c2pPipe) {
- const char* ihArgs[]{INCIDENT_HELPER, "-s", String8::format("%d", id).string(), NULL};
+ const char* ihArgs[]{INCIDENT_HELPER, "-s", String8::format("%d", id).c_str(), NULL};
return fork_execute_cmd(const_cast<char**>(ihArgs), p2cPipe, c2pPipe);
}
@@ -100,7 +100,7 @@ status_t FileSection::Execute(ReportWriter* writer) const {
// add O_CLOEXEC to make sure it is closed when exec incident helper
unique_fd fd(open(mFilename, O_RDONLY | O_CLOEXEC));
if (fd.get() == -1) {
- ALOGW("[%s] failed to open file", this->name.string());
+ ALOGW("[%s] failed to open file", this->name.c_str());
// There may be some devices/architectures that won't have the file.
// Just return here without an error.
return NO_ERROR;
@@ -110,13 +110,13 @@ status_t FileSection::Execute(ReportWriter* writer) const {
Fpipe c2pPipe;
// initiate pipes to pass data to/from incident_helper
if (!p2cPipe.init() || !c2pPipe.init()) {
- ALOGW("[%s] failed to setup pipes", this->name.string());
+ ALOGW("[%s] failed to setup pipes", this->name.c_str());
return -errno;
}
pid_t pid = fork_execute_incident_helper(this->id, &p2cPipe, &c2pPipe);
if (pid == -1) {
- ALOGW("[%s] failed to fork", this->name.string());
+ ALOGW("[%s] failed to fork", this->name.c_str());
return -errno;
}
@@ -128,14 +128,14 @@ status_t FileSection::Execute(ReportWriter* writer) const {
writer->setSectionStats(buffer);
if (readStatus != NO_ERROR || buffer.timedOut()) {
ALOGW("[%s] failed to read data from incident helper: %s, timedout: %s",
- this->name.string(), strerror(-readStatus), buffer.timedOut() ? "true" : "false");
+ this->name.c_str(), strerror(-readStatus), buffer.timedOut() ? "true" : "false");
kill_child(pid);
return readStatus;
}
status_t ihStatus = wait_child(pid);
if (ihStatus != NO_ERROR) {
- ALOGW("[%s] abnormal child process: %s", this->name.string(), strerror(-ihStatus));
+ ALOGW("[%s] abnormal child process: %s", this->name.c_str(), strerror(-ihStatus));
return OK; // Not a fatal error.
}
@@ -169,7 +169,7 @@ status_t GZipSection::Execute(ReportWriter* writer) const {
index++; // look at the next file.
}
if (fd.get() == -1) {
- ALOGW("[%s] can't open all the files", this->name.string());
+ ALOGW("[%s] can't open all the files", this->name.c_str());
return NO_ERROR; // e.g. LAST_KMSG will reach here in user build.
}
FdBuffer buffer;
@@ -177,13 +177,13 @@ status_t GZipSection::Execute(ReportWriter* writer) const {
Fpipe c2pPipe;
// initiate pipes to pass data to/from gzip
if (!p2cPipe.init() || !c2pPipe.init()) {
- ALOGW("[%s] failed to setup pipes", this->name.string());
+ ALOGW("[%s] failed to setup pipes", this->name.c_str());
return -errno;
}
pid_t pid = fork_execute_cmd((char* const*)GZIP, &p2cPipe, &c2pPipe);
if (pid == -1) {
- ALOGW("[%s] failed to fork", this->name.string());
+ ALOGW("[%s] failed to fork", this->name.c_str());
return -errno;
}
// parent process
@@ -202,14 +202,14 @@ status_t GZipSection::Execute(ReportWriter* writer) const {
size_t editPos = internalBuffer->wp()->pos();
internalBuffer->wp()->move(8); // reserve 8 bytes for the varint of the data size.
size_t dataBeginAt = internalBuffer->wp()->pos();
- VLOG("[%s] editPos=%zu, dataBeginAt=%zu", this->name.string(), editPos, dataBeginAt);
+ VLOG("[%s] editPos=%zu, dataBeginAt=%zu", this->name.c_str(), editPos, dataBeginAt);
status_t readStatus = buffer.readProcessedDataInStream(
fd.get(), std::move(p2cPipe.writeFd()), std::move(c2pPipe.readFd()), this->timeoutMs,
isSysfs(mFilenames[index]));
writer->setSectionStats(buffer);
if (readStatus != NO_ERROR || buffer.timedOut()) {
- ALOGW("[%s] failed to read data from gzip: %s, timedout: %s", this->name.string(),
+ ALOGW("[%s] failed to read data from gzip: %s, timedout: %s", this->name.c_str(),
strerror(-readStatus), buffer.timedOut() ? "true" : "false");
kill_child(pid);
return readStatus;
@@ -217,7 +217,7 @@ status_t GZipSection::Execute(ReportWriter* writer) const {
status_t gzipStatus = wait_child(pid);
if (gzipStatus != NO_ERROR) {
- ALOGW("[%s] abnormal child process: %s", this->name.string(), strerror(-gzipStatus));
+ ALOGW("[%s] abnormal child process: %s", this->name.c_str(), strerror(-gzipStatus));
return gzipStatus;
}
// Revisit the actual size from gzip result and edit the internal buffer accordingly.
@@ -290,7 +290,7 @@ status_t WorkerThreadSection::Execute(ReportWriter* writer) const {
FdBuffer buffer;
err = buffer.read(data->pipe.readFd().get(), this->timeoutMs);
if (err != NO_ERROR) {
- ALOGE("[%s] reader failed with error '%s'", this->name.string(), strerror(-err));
+ ALOGE("[%s] reader failed with error '%s'", this->name.c_str(), strerror(-err));
}
// If the worker side is finished, then return its error (which may overwrite
@@ -300,7 +300,7 @@ status_t WorkerThreadSection::Execute(ReportWriter* writer) const {
data->pipe.close();
if (data->workerError != NO_ERROR) {
err = data->workerError;
- ALOGE("[%s] worker failed with error '%s'", this->name.string(), strerror(-err));
+ ALOGE("[%s] worker failed with error '%s'", this->name.c_str(), strerror(-err));
}
workerDone = data->workerDone;
}
@@ -309,17 +309,17 @@ status_t WorkerThreadSection::Execute(ReportWriter* writer) const {
if (err != NO_ERROR) {
char errMsg[128];
snprintf(errMsg, 128, "[%s] failed with error '%s'",
- this->name.string(), strerror(-err));
+ this->name.c_str(), strerror(-err));
writer->error(this, err, "WorkerThreadSection failed.");
return NO_ERROR;
}
if (buffer.truncated()) {
- ALOGW("[%s] too large, truncating", this->name.string());
+ ALOGW("[%s] too large, truncating", this->name.c_str());
// Do not write a truncated section. It won't pass through the PrivacyFilter.
return NO_ERROR;
}
if (!workerDone || buffer.timedOut()) {
- ALOGW("[%s] timed out", this->name.string());
+ ALOGW("[%s] timed out", this->name.c_str());
return NO_ERROR;
}
@@ -360,18 +360,18 @@ status_t CommandSection::Execute(ReportWriter* writer) const {
Fpipe ihPipe;
if (!cmdPipe.init() || !ihPipe.init()) {
- ALOGW("[%s] failed to setup pipes", this->name.string());
+ ALOGW("[%s] failed to setup pipes", this->name.c_str());
return -errno;
}
pid_t cmdPid = fork_execute_cmd((char* const*)mCommand, NULL, &cmdPipe);
if (cmdPid == -1) {
- ALOGW("[%s] failed to fork", this->name.string());
+ ALOGW("[%s] failed to fork", this->name.c_str());
return -errno;
}
pid_t ihPid = fork_execute_incident_helper(this->id, &cmdPipe, &ihPipe);
if (ihPid == -1) {
- ALOGW("[%s] failed to fork", this->name.string());
+ ALOGW("[%s] failed to fork", this->name.c_str());
return -errno;
}
@@ -381,7 +381,7 @@ status_t CommandSection::Execute(ReportWriter* writer) const {
writer->setSectionStats(buffer);
if (readStatus != NO_ERROR || buffer.timedOut()) {
ALOGW("[%s] failed to read data from incident helper: %s, timedout: %s",
- this->name.string(), strerror(-readStatus), buffer.timedOut() ? "true" : "false");
+ this->name.c_str(), strerror(-readStatus), buffer.timedOut() ? "true" : "false");
kill_child(cmdPid);
kill_child(ihPid);
return readStatus;
@@ -393,7 +393,7 @@ status_t CommandSection::Execute(ReportWriter* writer) const {
status_t ihStatus = wait_child(ihPid);
if (cmdStatus != NO_ERROR || ihStatus != NO_ERROR) {
ALOGW("[%s] abnormal child processes, return status: command: %s, incident helper: %s",
- this->name.string(), strerror(-cmdStatus), strerror(-ihStatus));
+ this->name.c_str(), strerror(-cmdStatus), strerror(-ihStatus));
// Not a fatal error.
return NO_ERROR;
}
@@ -428,7 +428,7 @@ status_t DumpsysSection::BlockingCall(unique_fd& pipeWriteFd) const {
sp<IBinder> service = defaultServiceManager()->checkService(mService);
if (service == NULL) {
- ALOGW("DumpsysSection: Can't lookup service: %s", String8(mService).string());
+ ALOGW("DumpsysSection: Can't lookup service: %s", String8(mService).c_str());
return NAME_NOT_FOUND;
}
@@ -463,14 +463,14 @@ status_t TextDumpsysSection::Execute(ReportWriter* writer) const {
// checkService won't wait for the service to show up like getService will.
sp<IBinder> service = defaultServiceManager()->checkService(mService);
if (service == NULL) {
- ALOGW("TextDumpsysSection: Can't lookup service: %s", String8(mService).string());
+ ALOGW("TextDumpsysSection: Can't lookup service: %s", String8(mService).c_str());
return NAME_NOT_FOUND;
}
// Create pipe
Fpipe dumpPipe;
if (!dumpPipe.init()) {
- ALOGW("[%s] failed to setup pipe", this->name.string());
+ ALOGW("[%s] failed to setup pipe", this->name.c_str());
return -errno;
}
@@ -482,7 +482,7 @@ status_t TextDumpsysSection::Execute(ReportWriter* writer) const {
signal(SIGPIPE, sigpipe_handler);
status_t err = service->dump(write_fd.get(), this->mArgs);
if (err != OK) {
- ALOGW("[%s] dump thread failed. Error: %s", this->name.string(), strerror(-err));
+ ALOGW("[%s] dump thread failed. Error: %s", this->name.c_str(), strerror(-err));
}
write_fd.reset();
});
@@ -490,7 +490,7 @@ status_t TextDumpsysSection::Execute(ReportWriter* writer) const {
// Collect dump content
FdBuffer buffer;
ProtoOutputStream proto;
- proto.write(TextDumpProto::COMMAND, std::string(name.string()));
+ proto.write(TextDumpProto::COMMAND, std::string(name.c_str()));
proto.write(TextDumpProto::DUMP_DURATION_NS, int64_t(Nanotime() - start));
buffer.write(proto.data());
@@ -504,7 +504,7 @@ status_t TextDumpsysSection::Execute(ReportWriter* writer) const {
dumpPipe.readFd().reset();
writer->setSectionStats(buffer);
if (readStatus != OK || buffer.timedOut()) {
- ALOGW("[%s] failed to read from dumpsys: %s, timedout: %s", this->name.string(),
+ ALOGW("[%s] failed to read from dumpsys: %s, timedout: %s", this->name.c_str(),
strerror(-readStatus), buffer.timedOut() ? "true" : "false");
worker.detach();
return readStatus;
@@ -579,7 +579,7 @@ status_t LogSection::BlockingCall(unique_fd& pipeWriteFd) const {
// Hence forking a new process to prevent memory fragmentation.
pid_t pid = fork();
if (pid < 0) {
- ALOGW("[%s] failed to fork", this->name.string());
+ ALOGW("[%s] failed to fork", this->name.c_str());
return errno;
}
if (pid > 0) {
@@ -593,7 +593,7 @@ status_t LogSection::BlockingCall(unique_fd& pipeWriteFd) const {
android_logger_list_free);
if (android_logger_open(loggers.get(), mLogID) == NULL) {
- ALOGE("[%s] Can't get logger.", this->name.string());
+ ALOGE("[%s] Can't get logger.", this->name.c_str());
_exit(EXIT_FAILURE);
}
@@ -610,7 +610,7 @@ status_t LogSection::BlockingCall(unique_fd& pipeWriteFd) const {
// status = -EAGAIN, graceful indication for ANDRODI_LOG_NONBLOCK that this is the end.
if (status <= 0) {
if (status != -EAGAIN) {
- ALOGW("[%s] fails to read a log_msg.\n", this->name.string());
+ ALOGW("[%s] fails to read a log_msg.\n", this->name.c_str());
err = -status;
}
break;
@@ -680,7 +680,7 @@ status_t LogSection::BlockingCall(unique_fd& pipeWriteFd) const {
AndroidLogEntry entry;
status = android_log_processLogBuffer(&msg.entry, &entry);
if (status != OK) {
- ALOGW("[%s] fails to process to an entry.\n", this->name.string());
+ ALOGW("[%s] fails to process to an entry.\n", this->name.c_str());
err = status;
break;
}
@@ -702,7 +702,7 @@ status_t LogSection::BlockingCall(unique_fd& pipeWriteFd) const {
}
if (!proto.flush(pipeWriteFd.get())) {
if (errno == EPIPE) {
- ALOGW("[%s] wrote to a broken pipe\n", this->name.string());
+ ALOGW("[%s] wrote to a broken pipe\n", this->name.c_str());
}
err = errno;
break;
@@ -757,7 +757,7 @@ status_t TombstoneSection::BlockingCall(unique_fd& pipeWriteFd) const {
}
ssize_t exe_name_len = readlink(link_name, exe_name, EXE_NAME_LEN);
if (exe_name_len < 0 || exe_name_len >= EXE_NAME_LEN) {
- ALOGE("[%s] Can't read '%s': %s", name.string(), link_name, strerror(errno));
+ ALOGE("[%s] Can't read '%s': %s", name.c_str(), link_name, strerror(errno));
continue;
}
// readlink(2) does not put a null terminator at the end
@@ -788,7 +788,7 @@ status_t TombstoneSection::BlockingCall(unique_fd& pipeWriteFd) const {
Fpipe dumpPipe;
if (!dumpPipe.init()) {
- ALOGW("[%s] failed to setup dump pipe", this->name.string());
+ ALOGW("[%s] failed to setup dump pipe", this->name.c_str());
err = -errno;
break;
}
@@ -822,12 +822,12 @@ status_t TombstoneSection::BlockingCall(unique_fd& pipeWriteFd) const {
// Wait on the child to avoid it becoming a zombie process.
status_t cStatus = wait_child(child);
if (err != NO_ERROR) {
- ALOGW("[%s] failed to read stack dump: %d", this->name.string(), err);
+ ALOGW("[%s] failed to read stack dump: %d", this->name.c_str(), err);
dumpPipe.readFd().reset();
break;
}
if (cStatus != NO_ERROR) {
- ALOGE("[%s] child had an issue: %s\n", this->name.string(), strerror(-cStatus));
+ ALOGE("[%s] child had an issue: %s\n", this->name.c_str(), strerror(-cStatus));
}
// Resize dump buffer
@@ -852,7 +852,7 @@ status_t TombstoneSection::BlockingCall(unique_fd& pipeWriteFd) const {
dumpPipe.readFd().reset();
if (!proto.flush(pipeWriteFd.get())) {
if (errno == EPIPE) {
- ALOGE("[%s] wrote to a broken pipe\n", this->name.string());
+ ALOGE("[%s] wrote to a broken pipe\n", this->name.c_str());
}
err = errno;
break;
diff --git a/cmds/incidentd/src/report_directory.cpp b/cmds/incidentd/src/report_directory.cpp
index 7d20a74437ce..6b2fb8ec308a 100644
--- a/cmds/incidentd/src/report_directory.cpp
+++ b/cmds/incidentd/src/report_directory.cpp
@@ -62,8 +62,8 @@ void clean_directory(const char* directory, off_t maxSize, size_t maxCount) {
continue;
}
String8 filename = dirbase + entry->d_name;
- if (stat(filename.string(), &st) != 0) {
- ALOGE("Unable to stat file %s", filename.string());
+ if (stat(filename.c_str(), &st) != 0) {
+ ALOGE("Unable to stat file %s", filename.c_str());
continue;
}
if (!S_ISREG(st.st_mode)) {
@@ -88,7 +88,7 @@ void clean_directory(const char* directory, off_t maxSize, size_t maxCount) {
// Remove files until we're under our limits.
for (std::vector<std::pair<String8, struct stat>>::iterator it = files.begin();
it != files.end() && totalSize >= maxSize && totalCount >= maxCount; it++) {
- remove(it->first.string());
+ remove(it->first.c_str());
totalSize -= it->second.st_size;
totalCount--;
}
diff --git a/core/api/current.txt b/core/api/current.txt
index 92fa9f484cd3..cba935fadb55 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -32371,6 +32371,7 @@ package android.os {
field public static final String DISALLOW_MICROPHONE_TOGGLE = "disallow_microphone_toggle";
field public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
field public static final String DISALLOW_MOUNT_PHYSICAL_MEDIA = "no_physical_media";
+ field public static final String DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO = "no_near_field_communication_radio";
field public static final String DISALLOW_NETWORK_RESET = "no_network_reset";
field public static final String DISALLOW_OUTGOING_BEAM = "no_outgoing_beam";
field public static final String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls";
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index c893b5432269..26c72f00a4ba 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -276,6 +276,7 @@ package android {
field public static final String RECOVER_KEYSTORE = "android.permission.RECOVER_KEYSTORE";
field public static final String REGISTER_CALL_PROVIDER = "android.permission.REGISTER_CALL_PROVIDER";
field public static final String REGISTER_CONNECTION_MANAGER = "android.permission.REGISTER_CONNECTION_MANAGER";
+ field public static final String REGISTER_NSD_OFFLOAD_ENGINE = "android.permission.REGISTER_NSD_OFFLOAD_ENGINE";
field public static final String REGISTER_SIM_SUBSCRIPTION = "android.permission.REGISTER_SIM_SUBSCRIPTION";
field public static final String REGISTER_STATS_PULL_ATOM = "android.permission.REGISTER_STATS_PULL_ATOM";
field public static final String REMOTE_DISPLAY_PROVIDER = "android.permission.REMOTE_DISPLAY_PROVIDER";
diff --git a/core/java/android/app/search/SearchSession.java b/core/java/android/app/search/SearchSession.java
index 10db3376adc5..f7a26dcc3da0 100644
--- a/core/java/android/app/search/SearchSession.java
+++ b/core/java/android/app/search/SearchSession.java
@@ -99,7 +99,7 @@ public final class SearchSession implements AutoCloseable {
mInterface = android.app.search.ISearchUiManager.Stub.asInterface(b);
mSessionId = new SearchSessionId(
context.getPackageName() + ":" + UUID.randomUUID().toString(), context.getUserId());
- // b/175527717 whitelist possible clients of this API
+ // b/175527717 allowlist possible clients of this API
searchContext.setPackageName(context.getPackageName());
try {
mInterface.createSearchSession(searchContext, mSessionId, mToken);
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 21d4b6461214..d04d8bed56f2 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -473,7 +473,7 @@ public abstract class Context {
public static final int BIND_IMPORTANT_BACKGROUND = 0x00800000;
/**
- * @hide Flag for {@link #bindService}: allows application hosting service to manage whitelists
+ * @hide Flag for {@link #bindService}: allows application hosting service to manage allowlists
* such as temporary allowing a {@code PendingIntent} to bypass Power Save mode.
*/
public static final int BIND_ALLOW_WHITELIST_MANAGEMENT = 0x01000000;
diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java
index 49d3cac63124..d4d9e4759b4b 100644
--- a/core/java/android/content/IntentSender.java
+++ b/core/java/android/content/IntentSender.java
@@ -392,9 +392,9 @@ public class IntentSender implements Parcelable {
}
/** @hide */
- public IntentSender(IIntentSender target, IBinder whitelistToken) {
+ public IntentSender(IIntentSender target, IBinder allowlistToken) {
mTarget = target;
- mWhitelistToken = whitelistToken;
+ mWhitelistToken = allowlistToken;
}
/** @hide */
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index ccc39b6080d7..039644387715 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -41,11 +41,6 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSIllegalArgumentException;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
import android.text.TextUtils;
import android.util.Log;
import android.view.Surface;
@@ -1007,132 +1002,6 @@ public class Camera {
private native final void _addCallbackBuffer(
byte[] callbackBuffer, int msgType);
- /**
- * <p>Create a {@link android.renderscript RenderScript}
- * {@link android.renderscript.Allocation Allocation} to use as a
- * destination of preview callback frames. Use
- * {@link #setPreviewCallbackAllocation setPreviewCallbackAllocation} to use
- * the created Allocation as a destination for camera preview frames.</p>
- *
- * <p>The Allocation will be created with a YUV type, and its contents must
- * be accessed within Renderscript with the {@code rsGetElementAtYuv_*}
- * accessor methods. Its size will be based on the current
- * {@link Parameters#getPreviewSize preview size} configured for this
- * camera.</p>
- *
- * @param rs the RenderScript context for this Allocation.
- * @param usage additional usage flags to set for the Allocation. The usage
- * flag {@link android.renderscript.Allocation#USAGE_IO_INPUT} will always
- * be set on the created Allocation, but additional flags may be provided
- * here.
- * @return a new YUV-type Allocation with dimensions equal to the current
- * preview size.
- * @throws RSIllegalArgumentException if the usage flags are not compatible
- * with an YUV Allocation.
- * @see #setPreviewCallbackAllocation
- * @hide
- */
- public final Allocation createPreviewAllocation(RenderScript rs, int usage)
- throws RSIllegalArgumentException {
- Parameters p = getParameters();
- Size previewSize = p.getPreviewSize();
- Type.Builder yuvBuilder = new Type.Builder(rs,
- Element.createPixel(rs,
- Element.DataType.UNSIGNED_8,
- Element.DataKind.PIXEL_YUV));
- // Use YV12 for wide compatibility. Changing this requires also
- // adjusting camera service's format selection.
- yuvBuilder.setYuvFormat(ImageFormat.YV12);
- yuvBuilder.setX(previewSize.width);
- yuvBuilder.setY(previewSize.height);
-
- Allocation a = Allocation.createTyped(rs, yuvBuilder.create(),
- usage | Allocation.USAGE_IO_INPUT);
-
- return a;
- }
-
- /**
- * <p>Set an {@link android.renderscript.Allocation Allocation} as the
- * target of preview callback data. Use this method for efficient processing
- * of camera preview data with RenderScript. The Allocation must be created
- * with the {@link #createPreviewAllocation createPreviewAllocation }
- * method.</p>
- *
- * <p>Setting a preview allocation will disable any active preview callbacks
- * set by {@link #setPreviewCallback setPreviewCallback} or
- * {@link #setPreviewCallbackWithBuffer setPreviewCallbackWithBuffer}, and
- * vice versa. Using a preview allocation still requires an active standard
- * preview target to be set, either with
- * {@link #setPreviewTexture setPreviewTexture} or
- * {@link #setPreviewDisplay setPreviewDisplay}.</p>
- *
- * <p>To be notified when new frames are available to the Allocation, use
- * {@link android.renderscript.Allocation#setIoInputNotificationHandler Allocation.setIoInputNotificationHandler}. To
- * update the frame currently accessible from the Allocation to the latest
- * preview frame, call
- * {@link android.renderscript.Allocation#ioReceive Allocation.ioReceive}.</p>
- *
- * <p>To disable preview into the Allocation, call this method with a
- * {@code null} parameter.</p>
- *
- * <p>Once a preview allocation is set, the preview size set by
- * {@link Parameters#setPreviewSize setPreviewSize} cannot be changed. If
- * you wish to change the preview size, first remove the preview allocation
- * by calling {@code setPreviewCallbackAllocation(null)}, then change the
- * preview size, create a new preview Allocation with
- * {@link #createPreviewAllocation createPreviewAllocation}, and set it as
- * the new preview callback allocation target.</p>
- *
- * <p>If you are using the preview data to create video or still images,
- * strongly consider using {@link android.media.MediaActionSound} to
- * properly indicate image capture or recording start/stop to the user.</p>
- *
- * @param previewAllocation the allocation to use as destination for preview
- * @throws IOException if configuring the camera to use the Allocation for
- * preview fails.
- * @throws IllegalArgumentException if the Allocation's dimensions or other
- * parameters don't meet the requirements.
- * @see #createPreviewAllocation
- * @see #setPreviewCallback
- * @see #setPreviewCallbackWithBuffer
- * @hide
- */
- public final void setPreviewCallbackAllocation(Allocation previewAllocation)
- throws IOException {
- Surface previewSurface = null;
- if (previewAllocation != null) {
- Parameters p = getParameters();
- Size previewSize = p.getPreviewSize();
- if (previewSize.width != previewAllocation.getType().getX() ||
- previewSize.height != previewAllocation.getType().getY()) {
- throw new IllegalArgumentException(
- "Allocation dimensions don't match preview dimensions: " +
- "Allocation is " +
- previewAllocation.getType().getX() +
- ", " +
- previewAllocation.getType().getY() +
- ". Preview is " + previewSize.width + ", " +
- previewSize.height);
- }
- if ((previewAllocation.getUsage() &
- Allocation.USAGE_IO_INPUT) == 0) {
- throw new IllegalArgumentException(
- "Allocation usage does not include USAGE_IO_INPUT");
- }
- if (previewAllocation.getType().getElement().getDataKind() !=
- Element.DataKind.PIXEL_YUV) {
- throw new IllegalArgumentException(
- "Allocation is not of a YUV type");
- }
- previewSurface = previewAllocation.getSurface();
- mUsingPreviewAllocation = true;
- } else {
- mUsingPreviewAllocation = false;
- }
- setPreviewCallbackSurface(previewSurface);
- }
-
private native final void setPreviewCallbackSurface(Surface s);
private class EventHandler extends Handler
diff --git a/core/java/android/hardware/SensorAdditionalInfo.java b/core/java/android/hardware/SensorAdditionalInfo.java
index 59def9fb3325..d1e101d563c4 100644
--- a/core/java/android/hardware/SensorAdditionalInfo.java
+++ b/core/java/android/hardware/SensorAdditionalInfo.java
@@ -257,7 +257,7 @@ public class SensorAdditionalInfo {
public static SensorAdditionalInfo createLocalGeomagneticField(
float strength, float declination, float inclination) {
if (strength < 10 || strength > 100 // much beyond extreme values on earth
- || declination < 0 || declination > Math.PI
+ || declination < -Math.PI / 2 || declination > Math.PI / 2
|| inclination < -Math.PI / 2 || inclination > Math.PI / 2) {
throw new IllegalArgumentException("Geomagnetic field info out of range");
}
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 2f81e0c118d8..106b7d4ce504 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -540,14 +540,6 @@ public abstract class CameraDevice implements AutoCloseable {
* or configuring it to use one of the supported
* {@link android.media.CamcorderProfile CamcorderProfiles}.</li>
*
- * <li>For efficient YUV processing with {@link android.renderscript}:
- * Create a RenderScript
- * {@link android.renderscript.Allocation Allocation} with a supported YUV
- * type, the IO_INPUT flag, and one of the sizes returned by
- * {@link StreamConfigurationMap#getOutputSizes(Class) getOutputSizes(Allocation.class)},
- * Then obtain the Surface with
- * {@link android.renderscript.Allocation#getSurface}.</li>
- *
* <li>For access to RAW, uncompressed YUV, or compressed JPEG data in the application: Create an
* {@link android.media.ImageReader} object with one of the supported output formats given by
* {@link StreamConfigurationMap#getOutputFormats()}, setting its size to one of the
diff --git a/core/java/android/hardware/camera2/camera_platform.aconfig b/core/java/android/hardware/camera2/camera_platform.aconfig
new file mode 100644
index 000000000000..67f63001ab58
--- /dev/null
+++ b/core/java/android/hardware/camera2/camera_platform.aconfig
@@ -0,0 +1,8 @@
+package: "com.android.hardware.camera2"
+
+flag {
+ namespace: "camera_platform"
+ name: "initial_test_flag"
+ description: "Flag infrastructure test flag"
+ bug: "292631208"
+}
diff --git a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
index 5981d279227d..a89fed2888a7 100644
--- a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
+++ b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
@@ -465,8 +465,6 @@ public final class StreamConfigurationMap {
* Recommended for recording video (simple to use)
* <li>{@link android.media.MediaCodec} -
* Recommended for recording video (more complicated to use, with more flexibility)
- * <li>{@link android.renderscript.Allocation} -
- * Recommended for image processing with {@link android.renderscript RenderScript}
* <li>{@link android.view.SurfaceHolder} -
* Recommended for low-power camera preview with {@link android.view.SurfaceView}
* <li>{@link android.graphics.SurfaceTexture} -
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index 7d0cf9c7e458..a9eb672c4e4d 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -600,6 +600,17 @@ public final class NfcAdapter {
return offHostSE;
}
+ private static void retrieveServiceRegisterer() {
+ if (sServiceRegisterer == null) {
+ NfcServiceManager manager = NfcFrameworkInitializer.getNfcServiceManager();
+ if (manager == null) {
+ Log.e(TAG, "NfcServiceManager is null");
+ throw new UnsupportedOperationException();
+ }
+ sServiceRegisterer = manager.getNfcManagerServiceRegisterer();
+ }
+ }
+
/**
* Returns the NfcAdapter for application context,
* or throws if NFC is not available.
@@ -627,12 +638,7 @@ public final class NfcAdapter {
Log.v(TAG, "this device does not have NFC support");
throw new UnsupportedOperationException();
}
- NfcServiceManager manager = NfcFrameworkInitializer.getNfcServiceManager();
- if (manager == null) {
- Log.e(TAG, "NfcServiceManager is null");
- throw new UnsupportedOperationException();
- }
- sServiceRegisterer = manager.getNfcManagerServiceRegisterer();
+ retrieveServiceRegisterer();
sService = getServiceInterface();
if (sService == null) {
Log.e(TAG, "could not retrieve NFC service");
@@ -706,12 +712,15 @@ public final class NfcAdapter {
throw new IllegalArgumentException(
"context not associated with any application (using a mock context?)");
}
-
- if (sIsInitialized && sServiceRegisterer.tryGet() == null) {
- synchronized (NfcAdapter.class) {
- /* Stale sService pointer */
- if (sIsInitialized) sIsInitialized = false;
+ retrieveServiceRegisterer();
+ if (sServiceRegisterer.tryGet() == null) {
+ if (sIsInitialized) {
+ synchronized (NfcAdapter.class) {
+ /* Stale sService pointer */
+ if (sIsInitialized) sIsInitialized = false;
+ }
}
+ return null;
}
/* Try to initialize the service */
NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
diff --git a/core/java/android/os/DropBoxManager.java b/core/java/android/os/DropBoxManager.java
index 403f55ceb94a..cf3546057549 100644
--- a/core/java/android/os/DropBoxManager.java
+++ b/core/java/android/os/DropBoxManager.java
@@ -364,7 +364,7 @@ public class DropBoxManager {
}
/**
- * Checks any blacklists (set in system settings) to see whether a certain
+ * Checks any denylists (set in system settings) to see whether a certain
* tag is allowed. Entries with disabled tags will be dropped immediately,
* so you can save the work of actually constructing and sending the data.
*
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index ec69e2abca17..6e6ab7bf30f4 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -125,50 +125,65 @@ interface INetworkManagementService
/**
* Returns true if IP forwarding is enabled
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Use {@code android.net.INetd#ipfwdEnabled}")
boolean getIpForwardingEnabled();
/**
* Enables/Disables IP Forwarding
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Avoid using this directly. Instead, enable tethering with "
+ + "{@code android.net.TetheringManager#startTethering}. See also "
+ + "{@code INetd#ipfwdEnableForwarding(String)}.")
void setIpForwardingEnabled(boolean enabled);
/**
* Start tethering services with the specified dhcp server range
* arg is a set of start end pairs defining the ranges.
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "{@code android.net.TetheringManager#startTethering}")
void startTethering(in String[] dhcpRanges);
/**
* Stop currently running tethering services
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "{@code android.net.TetheringManager#stopTethering(int)}")
void stopTethering();
/**
* Returns true if tethering services are started
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Generally track your own tethering requests. "
+ + "See also {@code android.net.INetd#tetherIsEnabled()}")
boolean isTetheringStarted();
/**
* Tethers the specified interface
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Avoid using this directly. Instead, enable tethering with "
+ + "{@code android.net.TetheringManager#startTethering}. See also "
+ + "{@code com.android.net.module.util.NetdUtils#tetherInterface}.")
void tetherInterface(String iface);
/**
* Untethers the specified interface
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Avoid using this directly. Instead, disable "
+ + "tethering with {@code android.net.TetheringManager#stopTethering(int)}. "
+ + "See also {@code NetdUtils#untetherInterface}.")
void untetherInterface(String iface);
/**
* Returns a list of currently tethered interfaces
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "{@code android.net.TetheringManager#getTetheredIfaces()}")
String[] listTetheredInterfaces();
/**
@@ -176,13 +191,17 @@ interface INetworkManagementService
* The address and netmask of the external interface is used for
* the NAT'ed network.
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Avoid using this directly. Instead, enable tethering with "
+ + "{@code android.net.TetheringManager#startTethering}.")
void enableNat(String internalInterface, String externalInterface);
/**
* Disables Network Address Translation between two interfaces.
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
+ publicAlternatives = "Avoid using this directly. Instead, disable tethering with "
+ + "{@code android.net.TetheringManager#stopTethering(int)}.")
void disableNat(String internalInterface, String externalInterface);
/**
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 83a4e9a8e6a8..b32cbff2a863 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -1527,6 +1527,31 @@ public class UserManager {
public static final String DISALLOW_ULTRA_WIDEBAND_RADIO = "no_ultra_wideband_radio";
/**
+ * This user restriction specifies if Near-fied communication is disallowed on the device. If
+ * Near-field communication is disallowed it cannot be turned on via Settings.
+ *
+ * <p>This restriction can only be set by a device owner or a profile owner of an
+ * organization-owned managed profile on the parent profile.
+ * In both cases, the restriction applies globally on the device and will turn off the
+ * Near-field communication radio if it's currently on and prevent the radio from being turned
+ * on in the future.
+ *
+ * <p>
+ * Near-field communication (NFC) is a radio technology that allows two devices (like your phone
+ * and a payments terminal) to communicate with each other when they're close together.
+ *
+ * <p>Default is <code>false</code>.
+ *
+ * <p>Key for user restrictions.
+ * <p>Type: Boolean
+ * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
+ * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO =
+ "no_near_field_communication_radio";
+
+ /**
* List of key values that can be passed into the various user restriction related methods
* in {@link UserManager} & {@link DevicePolicyManager}.
* Note: This is slightly different from the real set of user restrictions listed in {@link
@@ -1609,6 +1634,7 @@ public class UserManager {
DISALLOW_ADD_WIFI_CONFIG,
DISALLOW_CELLULAR_2G,
DISALLOW_ULTRA_WIDEBAND_RADIO,
+ DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO,
})
@Retention(RetentionPolicy.SOURCE)
public @interface UserRestrictionKey {}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 7a757690b868..507f1bb3a015 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1322,7 +1322,7 @@ public final class Settings {
/**
* Activity Action: Ask the user to allow an app to ignore battery optimizations (that is,
- * put them on the whitelist of apps shown by
+ * put them on the allowlist of apps shown by
* {@link #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}). For an app to use this, it also
* must hold the {@link android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}
* permission.
@@ -11543,7 +11543,7 @@ public final class Settings {
public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
/**
- * The package name for the custom bugreport handler app. This app must be whitelisted.
+ * The package name for the custom bugreport handler app. This app must be allowlisted.
* This is currently used only by Power Menu short press.
*
* @hide
@@ -11924,7 +11924,7 @@ public final class Settings {
"location_background_throttle_proximity_alert_interval_ms";
/**
- * Packages that are whitelisted for background throttling (throttling will not be applied).
+ * Packages that are allowlisted for background throttling (throttling will not be applied).
* @hide
*/
@Readable
@@ -11932,7 +11932,7 @@ public final class Settings {
"location_background_throttle_package_whitelist";
/**
- * Packages that are whitelisted for ignoring location settings (may retrieve location even
+ * Packages that are allowlisted for ignoring location settings (may retrieve location even
* when user location settings are off), for emergency purposes.
* @deprecated No longer used from Android 12+
* @hide
@@ -12465,7 +12465,7 @@ public final class Settings {
/**
* List of certificate (hex string representation of the application's certificate - SHA-1
- * or SHA-256) and carrier app package pairs which are whitelisted to prompt the user for
+ * or SHA-256) and carrier app package pairs which are allowlisted to prompt the user for
* install when a sim card with matching UICC carrier privilege rules is inserted. The
* certificate is used as a key, so the certificate encoding here must be the same as the
* certificate encoding used on the SIM.
@@ -15841,7 +15841,7 @@ public final class Settings {
"enable_adb_incremental_install_default";
/**
- * The packages whitelisted to be run in autofill compatibility mode. The list
+ * The packages allowlisted to be run in autofill compatibility mode. The list
* of packages is {@code ":"} colon delimited, and each entry has the name of the
* package and an optional list of url bar resource ids (the list is delimited by
* brackets&mdash{@code [} and {@code ]}&mdash and is also comma delimited).
@@ -15912,7 +15912,7 @@ public final class Settings {
public static final String STYLUS_EVER_USED = "stylus_ever_used";
/**
- * Exemptions to the hidden API blacklist.
+ * Exemptions to the hidden API denylist.
*
* @hide
*/
diff --git a/core/java/android/security/OWNERS b/core/java/android/security/OWNERS
index dd17788c7811..96c0be7f803e 100644
--- a/core/java/android/security/OWNERS
+++ b/core/java/android/security/OWNERS
@@ -1,10 +1,10 @@
# Bug component: 36824
-cbrubaker@google.com
-vishwath@google.com
+brambonne@google.com
+brufino@google.com
+jeffv@google.com
-per-file NetworkSecurityPolicy.java = cbrubaker@google.com
-per-file NetworkSecurityPolicy.java = klyubin@google.com
-per-file FrameworkNetworkSecurityPolicy.java = cbrubaker@google.com
-per-file FrameworkNetworkSecurityPolicy.java = klyubin@google.com
+per-file *NetworkSecurityPolicy.java = file:net/OWNERS
per-file Confirmation*.java = file:/keystore/OWNERS
+per-file FileIntegrityManager.java = file:platform/system/security:/fsverity/OWNERS
+per-file IFileIntegrityService.aidl = file:platform/system/security:/fsverity/OWNERS
diff --git a/core/java/android/security/net/OWNERS b/core/java/android/security/net/OWNERS
index d8281645738b..1d52eed0cb56 100644
--- a/core/java/android/security/net/OWNERS
+++ b/core/java/android/security/net/OWNERS
@@ -1,4 +1,4 @@
# Bug component: 36824
-cbrubaker@google.com
brambonne@google.com
+jeffv@google.com
diff --git a/core/java/android/service/dreams/OWNERS b/core/java/android/service/dreams/OWNERS
index 489a5f62b49d..77bcee832250 100644
--- a/core/java/android/service/dreams/OWNERS
+++ b/core/java/android/service/dreams/OWNERS
@@ -4,5 +4,7 @@ brycelee@google.com
dsandler@google.com
galinap@google.com
jjaggi@google.com
+lusilva@google.com
michaelwr@google.com
santoscordon@google.com
+wxyz@google.com
diff --git a/core/java/android/service/trust/OWNERS b/core/java/android/service/trust/OWNERS
index affe471e7770..d3525250ebb6 100644
--- a/core/java/android/service/trust/OWNERS
+++ b/core/java/android/service/trust/OWNERS
@@ -1,4 +1,4 @@
# Bug component: 36824
-cbrubaker@google.com
-vishwath@google.com
+jacobhobbie@google.com
+dlm@google.com
diff --git a/core/java/android/text/flags/use_bounds_for_width.aconfig b/core/java/android/text/flags/use_bounds_for_width.aconfig
new file mode 100644
index 000000000000..d89d5f4c7216
--- /dev/null
+++ b/core/java/android/text/flags/use_bounds_for_width.aconfig
@@ -0,0 +1,8 @@
+package: "com.android.text.flags"
+
+flag {
+ name: "use_bounds_for_width"
+ namespace: "text"
+ description: "Feature flag for preventing horizontal clipping."
+ bug: "63938206"
+}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f50dc8ddd262..11e43dd4507a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5223,11 +5223,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
@Retention(RetentionPolicy.SOURCE)
public @interface LayerType {}
- @ViewDebug.ExportedProperty(category = "drawing", mapping = {
- @ViewDebug.IntToString(from = LAYER_TYPE_NONE, to = "NONE"),
- @ViewDebug.IntToString(from = LAYER_TYPE_SOFTWARE, to = "SOFTWARE"),
- @ViewDebug.IntToString(from = LAYER_TYPE_HARDWARE, to = "HARDWARE")
- })
int mLayerType = LAYER_TYPE_NONE;
Paint mLayerPaint;
@@ -21888,6 +21883,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
@EnumEntry(value = LAYER_TYPE_SOFTWARE, name = "software"),
@EnumEntry(value = LAYER_TYPE_HARDWARE, name = "hardware")
})
+ @ViewDebug.ExportedProperty(category = "drawing", mapping = {
+ @ViewDebug.IntToString(from = LAYER_TYPE_NONE, to = "NONE"),
+ @ViewDebug.IntToString(from = LAYER_TYPE_SOFTWARE, to = "SOFTWARE"),
+ @ViewDebug.IntToString(from = LAYER_TYPE_HARDWARE, to = "HARDWARE")
+ })
@LayerType
public int getLayerType() {
return mLayerType;
diff --git a/core/java/android/window/flags/windowing_sdk.aconfig b/core/java/android/window/flags/windowing_sdk.aconfig
new file mode 100644
index 000000000000..560e41b1aa33
--- /dev/null
+++ b/core/java/android/window/flags/windowing_sdk.aconfig
@@ -0,0 +1,10 @@
+package: "com.android.window.flags"
+
+# Project link: https://gantry.corp.google.com/projects/android_platform_windowing_sdk/changes
+
+flag {
+ namespace: "windowing_sdk"
+ name: "sync_window_config_update_flag"
+ description: "Whether the feature to sync different window-related config updates is enabled"
+ bug: "260873529"
+}
diff --git a/core/java/com/android/internal/dynamicanimation/animation/DynamicAnimation.java b/core/java/com/android/internal/dynamicanimation/animation/DynamicAnimation.java
index d4fe7c8d7f36..03f10b65629a 100644
--- a/core/java/com/android/internal/dynamicanimation/animation/DynamicAnimation.java
+++ b/core/java/com/android/internal/dynamicanimation/animation/DynamicAnimation.java
@@ -651,7 +651,7 @@ public abstract class DynamicAnimation<T extends DynamicAnimation<T>>
if (!mStartValueIsSet) {
mValue = getPropertyValue();
}
- // Sanity check:
+ // Initial check:
if (mValue > mMaxValue || mValue < mMinValue) {
throw new IllegalArgumentException("Starting value need to be in between min"
+ " value and max value");
diff --git a/core/java/com/android/internal/dynamicanimation/animation/SpringForce.java b/core/java/com/android/internal/dynamicanimation/animation/SpringForce.java
index 36242ae2cf3d..dea4907cd689 100644
--- a/core/java/com/android/internal/dynamicanimation/animation/SpringForce.java
+++ b/core/java/com/android/internal/dynamicanimation/animation/SpringForce.java
@@ -228,7 +228,7 @@ public final class SpringForce implements Force {
}
/**
- * Initialize the string by doing the necessary pre-calculation as well as some sanity check
+ * Initialize the string by doing the necessary pre-calculation as well as some initial check
* on the setup.
*
* @throws IllegalStateException if the final position is not yet set by the time the spring
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 21da321e2b08..221c99906594 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -85,7 +85,7 @@ public class SystemConfig {
private static final int ALLOW_APP_CONFIGS = 0x008;
private static final int ALLOW_PRIVAPP_PERMISSIONS = 0x010;
private static final int ALLOW_OEM_PERMISSIONS = 0x020;
- private static final int ALLOW_HIDDENAPI_WHITELISTING = 0x040;
+ private static final int ALLOW_HIDDENAPI_ALLOWLISTING = 0x040;
private static final int ALLOW_ASSOCIATIONS = 0x080;
// ALLOW_OVERRIDE_APP_RESTRICTIONS allows to use "allow-in-power-save-except-idle",
// "allow-in-power-save", "allow-in-data-usage-save","allow-unthrottled-location",
@@ -234,7 +234,7 @@ public class SystemConfig {
final ArrayMap<String, PermissionEntry> mPermissions = new ArrayMap<>();
// These are the packages that are white-listed to be able to run in the
- // background while in power save mode (but not whitelisted from device idle modes),
+ // background while in power save mode (but not allowlisted from device idle modes),
// as read from the configuration files.
final ArraySet<String> mAllowInPowerSaveExceptIdle = new ArraySet<>();
@@ -258,7 +258,7 @@ public class SystemConfig {
// location settings are off, for emergency purposes, as read from the configuration files.
final ArrayMap<String, ArraySet<String>> mAllowIgnoreLocationSettings = new ArrayMap<>();
- // These are the action strings of broadcasts which are whitelisted to
+ // These are the action strings of broadcasts which are allowlisted to
// be delivered anonymously even to apps which target O+.
final ArraySet<String> mAllowImplicitBroadcasts = new ArraySet<>();
@@ -281,7 +281,7 @@ public class SystemConfig {
final ArrayMap<String, ArrayMap<String, Boolean>> mPackageComponentEnabledState =
new ArrayMap<>();
- // Package names that are exempted from private API blacklisting
+ // Package names that are exempted from private API denylisting
final ArraySet<String> mHiddenApiPackageWhitelist = new ArraySet<>();
// The list of carrier applications which should be disabled until used.
@@ -562,7 +562,7 @@ public class SystemConfig {
/**
* Gets map of packagesNames to userTypes, dictating on which user types each package should NOT
- * be initially installed, even if they are whitelisted, and then removes this map from
+ * be initially installed, even if they are allowlisted, and then removes this map from
* SystemConfig.
* Called by UserManagerService when it is constructed.
*/
@@ -670,10 +670,10 @@ public class SystemConfig {
Environment.getOemDirectory(), "etc", "permissions"), oemPermissionFlag);
// Allow Product to customize these configs
- // TODO(b/157203468): ALLOW_HIDDENAPI_WHITELISTING must be removed because we prohibited
+ // TODO(b/157203468): ALLOW_HIDDENAPI_ALLOWLISTING must be removed because we prohibited
// the use of hidden APIs from the product partition.
int productPermissionFlag = ALLOW_FEATURES | ALLOW_LIBS | ALLOW_PERMISSIONS
- | ALLOW_APP_CONFIGS | ALLOW_PRIVAPP_PERMISSIONS | ALLOW_HIDDENAPI_WHITELISTING
+ | ALLOW_APP_CONFIGS | ALLOW_PRIVAPP_PERMISSIONS | ALLOW_HIDDENAPI_ALLOWLISTING
| ALLOW_ASSOCIATIONS | ALLOW_OVERRIDE_APP_RESTRICTIONS | ALLOW_IMPLICIT_BROADCASTS
| ALLOW_VENDOR_APEX;
if (Build.VERSION.DEVICE_INITIAL_SDK_INT <= Build.VERSION_CODES.R) {
@@ -797,7 +797,7 @@ public class SystemConfig {
final boolean allowPrivappPermissions = (permissionFlag & ALLOW_PRIVAPP_PERMISSIONS)
!= 0;
final boolean allowOemPermissions = (permissionFlag & ALLOW_OEM_PERMISSIONS) != 0;
- final boolean allowApiWhitelisting = (permissionFlag & ALLOW_HIDDENAPI_WHITELISTING)
+ final boolean allowApiWhitelisting = (permissionFlag & ALLOW_HIDDENAPI_ALLOWLISTING)
!= 0;
final boolean allowAssociations = (permissionFlag & ALLOW_ASSOCIATIONS) != 0;
final boolean allowOverrideAppRestrictions =
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index 21369f9cf5f8..d6c559322ef1 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -352,7 +352,7 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName
const char* dirStr = env->GetStringUTFChars(internalDataDir, NULL);
code->internalDataPathObj = dirStr;
- code->internalDataPath = code->internalDataPathObj.string();
+ code->internalDataPath = code->internalDataPathObj.c_str();
env->ReleaseStringUTFChars(internalDataDir, dirStr);
if (externalDataDir != NULL) {
@@ -360,7 +360,7 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName
code->externalDataPathObj = dirStr;
env->ReleaseStringUTFChars(externalDataDir, dirStr);
}
- code->externalDataPath = code->externalDataPathObj.string();
+ code->externalDataPath = code->externalDataPathObj.c_str();
code->sdkVersion = sdkVersion;
@@ -372,7 +372,7 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName
code->obbPathObj = dirStr;
env->ReleaseStringUTFChars(obbDir, dirStr);
}
- code->obbPath = code->obbPathObj.string();
+ code->obbPath = code->obbPathObj.c_str();
jbyte* rawSavedState = NULL;
jsize rawSavedSize = 0;
diff --git a/core/jni/android_app_backup_FullBackup.cpp b/core/jni/android_app_backup_FullBackup.cpp
index 339a7d30e407..5e096d7623ad 100644
--- a/core/jni/android_app_backup_FullBackup.cpp
+++ b/core/jni/android_app_backup_FullBackup.cpp
@@ -106,15 +106,14 @@ static jint backupToTar(JNIEnv* env, jobject clazz, jstring packageNameObj,
: NULL;
if (path.length() < rootpath.length()) {
- ALOGE("file path [%s] shorter than root path [%s]",
- path.string(), rootpath.string());
+ ALOGE("file path [%s] shorter than root path [%s]", path.c_str(), rootpath.c_str());
return (jint) -1;
}
off64_t tarSize = 0;
jint err = write_tarfile(packageName, domain, rootpath, path, &tarSize, writer);
if (!err) {
- ALOGI("measured [%s] at %lld", path.string(), (long long)tarSize);
+ ALOGI("measured [%s] at %lld", path.c_str(), (long long)tarSize);
env->CallVoidMethod(dataOutputObj, sFullBackupDataOutput.addSize, (jlong) tarSize);
}
diff --git a/core/jni/android_backup_BackupDataInput.cpp b/core/jni/android_backup_BackupDataInput.cpp
index 79fa2a28666c..fc081a782b4a 100644
--- a/core/jni/android_backup_BackupDataInput.cpp
+++ b/core/jni/android_backup_BackupDataInput.cpp
@@ -76,7 +76,7 @@ readNextHeader_native(JNIEnv* env, jobject clazz, jlong r, jobject entity)
return err < 0 ? err : -1;
}
// TODO: Set the fields in the entity object
- jstring keyStr = env->NewStringUTF(key.string());
+ jstring keyStr = env->NewStringUTF(key.c_str());
env->SetObjectField(entity, s_keyField, keyStr);
env->SetIntField(entity, s_dataSizeField, dataSize);
return 0;
diff --git a/core/jni/android_backup_BackupHelperDispatcher.cpp b/core/jni/android_backup_BackupHelperDispatcher.cpp
index efe7d0b6ad0a..efce8e164817 100644
--- a/core/jni/android_backup_BackupHelperDispatcher.cpp
+++ b/core/jni/android_backup_BackupHelperDispatcher.cpp
@@ -118,7 +118,7 @@ readHeader_native(JNIEnv* env, jobject clazz, jobject headerObj, jobject fdObj)
}
env->SetIntField(headerObj, s_chunkSizeField, flattenedHeader.dataSize);
- env->SetObjectField(headerObj, s_keyPrefixField, env->NewStringUTF(keyPrefix.string()));
+ env->SetObjectField(headerObj, s_keyPrefixField, env->NewStringUTF(keyPrefix.c_str()));
return (jint) 0;
}
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp
index 243540693785..60da2c2abdd9 100644
--- a/core/jni/android_database_CursorWindow.cpp
+++ b/core/jni/android_database_CursorWindow.cpp
@@ -58,13 +58,13 @@ static void throwExceptionWithRowCol(JNIEnv* env, jint row, jint column) {
msg.appendFormat("Couldn't read row %d, col %d from CursorWindow. "
"Make sure the Cursor is initialized correctly before accessing data from it.",
row, column);
- jniThrowException(env, "java/lang/IllegalStateException", msg.string());
+ jniThrowException(env, "java/lang/IllegalStateException", msg.c_str());
}
static void throwUnknownTypeException(JNIEnv * env, jint type) {
String8 msg;
msg.appendFormat("UNKNOWN type %d", type);
- jniThrowException(env, "java/lang/IllegalStateException", msg.string());
+ jniThrowException(env, "java/lang/IllegalStateException", msg.c_str());
}
static int getFdCount() {
@@ -107,7 +107,7 @@ static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring nameObj, jint curso
fail:
jniThrowExceptionFmt(env, "android/database/CursorWindowAllocationException",
"Could not allocate CursorWindow '%s' of size %d due to error %d.",
- name.string(), cursorWindowSize, status);
+ name.c_str(), cursorWindowSize, status);
return 0;
}
@@ -139,7 +139,7 @@ static void nativeDispose(JNIEnv* env, jclass clazz, jlong windowPtr) {
static jstring nativeGetName(JNIEnv* env, jclass clazz, jlong windowPtr) {
CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr);
- return env->NewStringUTF(window->name().string());
+ return env->NewStringUTF(window->name().c_str());
}
static void nativeWriteToParcel(JNIEnv * env, jclass clazz, jlong windowPtr,
@@ -151,7 +151,7 @@ static void nativeWriteToParcel(JNIEnv * env, jclass clazz, jlong windowPtr,
if (status) {
String8 msg;
msg.appendFormat("Could not write CursorWindow to Parcel due to error %d.", status);
- jniThrowRuntimeException(env, msg.string());
+ jniThrowRuntimeException(env, msg.c_str());
}
}
@@ -267,7 +267,7 @@ static jstring nativeGetString(JNIEnv* env, jclass clazz, jlong windowPtr,
// doesn't like UTF-8 strings with high codepoints. It actually expects
// Modified UTF-8 with encoded surrogate pairs.
String16 utf16(value, sizeIncludingNull - 1);
- return env->NewString(reinterpret_cast<const jchar*>(utf16.string()), utf16.size());
+ return env->NewString(reinterpret_cast<const jchar*>(utf16.c_str()), utf16.size());
} else if (type == CursorWindow::FIELD_TYPE_INTEGER) {
int64_t value = window->getFieldSlotValueLong(fieldSlot);
char buf[32];
diff --git a/core/jni/android_database_SQLiteCommon.cpp b/core/jni/android_database_SQLiteCommon.cpp
index daa20876ba65..c6a75112d185 100644
--- a/core/jni/android_database_SQLiteCommon.cpp
+++ b/core/jni/android_database_SQLiteCommon.cpp
@@ -229,7 +229,7 @@ void throw_sqlite3_exception(JNIEnv* env, int errcode,
fullMessage.append(": ");
fullMessage.append(message);
}
- jniThrowException(env, exceptionClass, fullMessage.string());
+ jniThrowException(env, exceptionClass, fullMessage.c_str());
} else {
jniThrowException(env, exceptionClass, message);
}
diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp
index 32697aeaa47f..03d3bc6857e4 100644
--- a/core/jni/android_database_SQLiteConnection.cpp
+++ b/core/jni/android_database_SQLiteConnection.cpp
@@ -91,15 +91,14 @@ struct SQLiteConnection {
// Called each time a statement begins execution, when tracing is enabled.
static void sqliteTraceCallback(void *data, const char *sql) {
SQLiteConnection* connection = static_cast<SQLiteConnection*>(data);
- ALOG(LOG_VERBOSE, SQLITE_TRACE_TAG, "%s: \"%s\"\n",
- connection->label.string(), sql);
+ ALOG(LOG_VERBOSE, SQLITE_TRACE_TAG, "%s: \"%s\"\n", connection->label.c_str(), sql);
}
// Called each time a statement finishes execution, when profiling is enabled.
static void sqliteProfileCallback(void *data, const char *sql, sqlite3_uint64 tm) {
SQLiteConnection* connection = static_cast<SQLiteConnection*>(data);
- ALOG(LOG_VERBOSE, SQLITE_PROFILE_TAG, "%s: \"%s\" took %0.3f ms\n",
- connection->label.string(), sql, tm * 0.000001f);
+ ALOG(LOG_VERBOSE, SQLITE_PROFILE_TAG, "%s: \"%s\" took %0.3f ms\n", connection->label.c_str(),
+ sql, tm * 0.000001f);
}
// Called after each SQLite VM instruction when cancelation is enabled.
@@ -130,7 +129,7 @@ static jlong nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFla
env->ReleaseStringUTFChars(labelStr, labelChars);
sqlite3* db;
- int err = sqlite3_open_v2(path.string(), &db, sqliteFlags, NULL);
+ int err = sqlite3_open_v2(path.c_str(), &db, sqliteFlags, NULL);
if (err != SQLITE_OK) {
throw_sqlite3_exception_errcode(env, err, "Could not open database");
return 0;
@@ -180,7 +179,7 @@ static jlong nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFla
sqlite3_profile(db, &sqliteProfileCallback, connection);
}
- ALOGV("Opened connection %p with label '%s'", db, label.string());
+ ALOGV("Opened connection %p with label '%s'", db, label.c_str());
return reinterpret_cast<jlong>(connection);
}
@@ -760,7 +759,7 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz,
if (status) {
String8 msg;
msg.appendFormat("Failed to clear the cursor window, status=%d", status);
- throw_sqlite3_exception(env, connection->db, msg.string());
+ throw_sqlite3_exception(env, connection->db, msg.c_str());
return 0;
}
@@ -770,7 +769,7 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz,
String8 msg;
msg.appendFormat("Failed to set the cursor window column count to %d, status=%d",
numColumns, status);
- throw_sqlite3_exception(env, connection->db, msg.string());
+ throw_sqlite3_exception(env, connection->db, msg.c_str());
return 0;
}
@@ -845,7 +844,7 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz,
String8 msg;
msg.appendFormat("Row too big to fit into CursorWindow requiredPos=%d, totalRows=%d",
requiredPos, totalRows);
- throw_sqlite3_exception(env, SQLITE_TOOBIG, NULL, msg.string());
+ throw_sqlite3_exception(env, SQLITE_TOOBIG, NULL, msg.c_str());
return 0;
}
diff --git a/core/jni/android_ddm_DdmHandleNativeHeap.cpp b/core/jni/android_ddm_DdmHandleNativeHeap.cpp
index 2ca4500991fa..d36d29ca301d 100644
--- a/core/jni/android_ddm_DdmHandleNativeHeap.cpp
+++ b/core/jni/android_ddm_DdmHandleNativeHeap.cpp
@@ -100,8 +100,8 @@ static jbyteArray DdmHandleNativeHeap_getLeakInfo(JNIEnv* env, jobject) {
if (array != NULL) {
env->SetByteArrayRegion(array, 0,
sizeof(header), reinterpret_cast<jbyte*>(&header));
- env->SetByteArrayRegion(array, sizeof(header),
- maps.size(), reinterpret_cast<const jbyte*>(maps.string()));
+ env->SetByteArrayRegion(array, sizeof(header), maps.size(),
+ reinterpret_cast<const jbyte*>(maps.c_str()));
env->SetByteArrayRegion(array, sizeof(header) + maps.size(),
header.allocSize, reinterpret_cast<jbyte*>(leak_info.buffer));
}
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 2a670e865ced..5f3a1b5be154 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -17,22 +17,21 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "Camera-JNI"
-#include <utils/Log.h>
-
-#include "jni.h"
-#include <nativehelper/JNIHelp.h>
-#include "core_jni_helpers.h"
#include <android_runtime/android_graphics_SurfaceTexture.h>
#include <android_runtime/android_view_Surface.h>
-
+#include <binder/IMemory.h>
+#include <camera/Camera.h>
+#include <camera/StringUtils.h>
#include <cutils/properties.h>
-#include <utils/Vector.h>
-#include <utils/Errors.h>
-
#include <gui/GLConsumer.h>
#include <gui/Surface.h>
-#include <camera/Camera.h>
-#include <binder/IMemory.h>
+#include <nativehelper/JNIHelp.h>
+#include <utils/Errors.h>
+#include <utils/Log.h>
+#include <utils/Vector.h>
+
+#include "core_jni_helpers.h"
+#include "jni.h"
using namespace android;
@@ -562,7 +561,7 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz, jobj
const char16_t *rawClientName = reinterpret_cast<const char16_t*>(
env->GetStringChars(clientPackageName, NULL));
jsize rawClientNameLen = env->GetStringLength(clientPackageName);
- String16 clientName(rawClientName, rawClientNameLen);
+ std::string clientName = toStdString(rawClientName, rawClientNameLen);
env->ReleaseStringChars(clientPackageName,
reinterpret_cast<const jchar*>(rawClientName));
@@ -875,11 +874,11 @@ static jstring android_hardware_Camera_getParameters(JNIEnv *env, jobject thiz)
if (camera == 0) return 0;
String8 params8 = camera->getParameters();
- if (params8.isEmpty()) {
+ if (params8.empty()) {
jniThrowRuntimeException(env, "getParameters failed (empty parameters)");
return 0;
}
- return env->NewStringUTF(params8.string());
+ return env->NewStringUTF(params8.c_str());
}
static void android_hardware_Camera_reconnect(JNIEnv *env, jobject thiz)
diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp
index cb97698fefea..b482897df85c 100644
--- a/core/jni/android_hardware_SensorManager.cpp
+++ b/core/jni/android_hardware_SensorManager.cpp
@@ -150,7 +150,7 @@ static jstring getJavaInternedString(JNIEnv *env, const String8 &string) {
return gStringOffsets.emptyString;
}
- ScopedLocalRef<jstring> javaString(env, env->NewStringUTF(string.string()));
+ ScopedLocalRef<jstring> javaString(env, env->NewStringUTF(string.c_str()));
jstring internedString = (jstring)
env->CallObjectMethod(javaString.get(), gStringOffsets.intern);
return internedString;
diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp
index 5293c583cfd0..041fed74c573 100644
--- a/core/jni/android_hardware_camera2_CameraMetadata.cpp
+++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp
@@ -514,7 +514,7 @@ static void CameraMetadata_dump(JNIEnv *env, jclass thiz, jlong ptr) {
ssize_t res;
while ((res = TEMP_FAILURE_RETRY(read(readFd, &out[0], /*count*/1))) > 0) {
if (out[0] == '\n') {
- ALOGD("%s", logLine.string());
+ ALOGD("%s", logLine.c_str());
logLine.clear();
} else {
logLine.append(out);
@@ -526,8 +526,8 @@ static void CameraMetadata_dump(JNIEnv *env, jclass thiz, jlong ptr) {
"Failed to read from fd (errno = %#x, message = '%s')",
errno, strerror(errno));
//return;
- } else if (!logLine.isEmpty()) {
- ALOGD("%s", logLine.string());
+ } else if (!logLine.empty()) {
+ ALOGD("%s", logLine.c_str());
}
close(readFd);
@@ -956,8 +956,8 @@ static jint CameraMetadata_setupGlobalVendorTagDescriptor(JNIEnv *env, jclass th
return OK;
} else if (!res.isOk()) {
VendorTagDescriptor::clearGlobalVendorTagDescriptor();
- ALOGE("%s: Failed to setup vendor tag descriptors: %s",
- __FUNCTION__, res.toString8().string());
+ ALOGE("%s: Failed to setup vendor tag descriptors: %s", __FUNCTION__,
+ res.toString8().c_str());
return res.serviceSpecificErrorCode();
}
if (0 < desc->getTagCount()) {
@@ -971,8 +971,8 @@ static jint CameraMetadata_setupGlobalVendorTagDescriptor(JNIEnv *env, jclass th
return OK;
} else if (!res.isOk()) {
VendorTagDescriptorCache::clearGlobalVendorTagCache();
- ALOGE("%s: Failed to setup vendor tag cache: %s",
- __FUNCTION__, res.toString8().string());
+ ALOGE("%s: Failed to setup vendor tag cache: %s", __FUNCTION__,
+ res.toString8().c_str());
return res.serviceSpecificErrorCode();
}
diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp
index c947fba2dbd9..30e546cc290d 100644
--- a/core/jni/android_hardware_camera2_DngCreator.cpp
+++ b/core/jni/android_hardware_camera2_DngCreator.cpp
@@ -1543,7 +1543,8 @@ static sp<TiffWriter> DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image
String8 captureTime = nativeContext->getCaptureTime();
if (writer->addEntry(TAG_DATETIME, NativeContext::DATETIME_COUNT,
- reinterpret_cast<const uint8_t*>(captureTime.string()), TIFF_IFD_0) != OK) {
+ reinterpret_cast<const uint8_t*>(captureTime.c_str()),
+ TIFF_IFD_0) != OK) {
jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
"Invalid metadata for tag %x", TAG_DATETIME);
return nullptr;
@@ -1551,7 +1552,8 @@ static sp<TiffWriter> DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image
// datetime original
if (writer->addEntry(TAG_DATETIMEORIGINAL, NativeContext::DATETIME_COUNT,
- reinterpret_cast<const uint8_t*>(captureTime.string()), TIFF_IFD_0) != OK) {
+ reinterpret_cast<const uint8_t*>(captureTime.c_str()),
+ TIFF_IFD_0) != OK) {
jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
"Invalid metadata for tag %x", TAG_DATETIMEORIGINAL);
return nullptr;
@@ -1879,8 +1881,10 @@ static sp<TiffWriter> DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image
cameraModel += brand.c_str();
BAIL_IF_INVALID_RET_NULL_SP(writer->addEntry(TAG_UNIQUECAMERAMODEL, cameraModel.size() + 1,
- reinterpret_cast<const uint8_t*>(cameraModel.string()), TIFF_IFD_0), env,
- TAG_UNIQUECAMERAMODEL, writer);
+ reinterpret_cast<const uint8_t*>(
+ cameraModel.c_str()),
+ TIFF_IFD_0),
+ env, TAG_UNIQUECAMERAMODEL, writer);
}
{
@@ -2165,7 +2169,8 @@ static sp<TiffWriter> DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image
String8 description = nativeContext->getDescription();
size_t len = description.bytes() + 1;
if (writer->addEntry(TAG_IMAGEDESCRIPTION, len,
- reinterpret_cast<const uint8_t*>(description.string()), TIFF_IFD_0) != OK) {
+ reinterpret_cast<const uint8_t*>(description.c_str()),
+ TIFF_IFD_0) != OK) {
jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
"Invalid metadata for tag %x", TAG_IMAGEDESCRIPTION);
}
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index b7a30e518c13..2af9a38a19f8 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -474,7 +474,7 @@ android_media_AudioSystem_getParameters(JNIEnv *env, jobject thiz, jstring keys)
env->GetStringLength(keys));
env->ReleaseStringCritical(keys, c_keys);
}
- return env->NewStringUTF(AudioSystem::getParameters(c_keys8).string());
+ return env->NewStringUTF(AudioSystem::getParameters(c_keys8).c_str());
}
static void
@@ -503,7 +503,7 @@ android_media_AudioSystem_dyn_policy_callback(int event, String8 regId, int val)
}
jclass clazz = env->FindClass(kClassPathName);
- const char* zechars = regId.string();
+ const char *zechars = regId.c_str();
jstring zestring = env->NewStringUTF(zechars);
env->CallStaticVoidMethod(clazz, gAudioPolicyEventHandlerMethods.postDynPolicyEventFromNative,
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
index 4c4443fc29c3..0e3c51047b31 100644
--- a/core/jni/android_os_HwParcel.cpp
+++ b/core/jni/android_os_HwParcel.cpp
@@ -285,7 +285,7 @@ static void JHwParcel_native_writeInterfaceToken(
hardware::Parcel *parcel =
JHwParcel::GetNativeContext(env, thiz)->getParcel();
- status_t err = parcel->writeInterfaceToken(nameCopy.string());
+ status_t err = parcel->writeInterfaceToken(nameCopy.c_str());
signalExceptionForError(env, err);
}
}
@@ -687,9 +687,7 @@ static void JHwParcel_native_writeHidlMemory(
static jstring MakeStringObjFromHidlString(JNIEnv *env, const hidl_string &s) {
String16 utf16String(s.c_str(), s.size());
- return env->NewString(
- reinterpret_cast<const jchar *>(utf16String.string()),
- utf16String.size());
+ return env->NewString(reinterpret_cast<const jchar *>(utf16String.c_str()), utf16String.size());
}
static jstring JHwParcel_native_readString(JNIEnv *env, jobject thiz) {
diff --git a/core/jni/android_os_UEventObserver.cpp b/core/jni/android_os_UEventObserver.cpp
index eda50758bca9..43a8be1ddc26 100644
--- a/core/jni/android_os_UEventObserver.cpp
+++ b/core/jni/android_os_UEventObserver.cpp
@@ -51,8 +51,8 @@ static bool isMatch(const char* buffer, size_t length) {
const char* field = buffer;
const char* end = buffer + length + 1;
do {
- if (strstr(field, match.string())) {
- ALOGV("Matched uevent message with pattern: %s", match.string());
+ if (strstr(field, match.c_str())) {
+ ALOGV("Matched uevent message with pattern: %s", match.c_str());
return true;
}
field += strlen(field) + 1;
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 9dce5e3a10f3..6ed0a8a047f5 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -953,8 +953,10 @@ void signalExceptionForError(JNIEnv* env, jobject obj, status_t err,
String8 msg;
msg.appendFormat("Unknown binder error code. 0x%" PRIx32, err);
// RemoteException is a checked exception, only throw from certain methods.
- jniThrowException(env, canThrowRemoteException
- ? "android/os/RemoteException" : "java/lang/RuntimeException", msg.string());
+ jniThrowException(env,
+ canThrowRemoteException ? "android/os/RemoteException"
+ : "java/lang/RuntimeException",
+ msg.c_str());
break;
}
}
@@ -1286,8 +1288,7 @@ static jstring android_os_BinderProxy_getInterfaceDescriptor(JNIEnv* env, jobjec
IBinder* target = getBPNativeData(env, obj)->mObject.get();
if (target != NULL) {
const String16& desc = target->getInterfaceDescriptor();
- return env->NewString(reinterpret_cast<const jchar*>(desc.string()),
- desc.size());
+ return env->NewString(reinterpret_cast<const jchar*>(desc.c_str()), desc.size());
}
jniThrowException(env, "java/lang/RuntimeException",
"No binder found for object");
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index b9d5ee4b3015..66f5df3ed477 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -148,7 +148,7 @@ jint android_os_Process_getUidForName(JNIEnv* env, jobject clazz, jstring name)
const size_t N = name8.size();
if (N > 0) {
- const char* str = name8.string();
+ const char* str = name8.c_str();
for (size_t i=0; i<N; i++) {
if (str[i] < '0' || str[i] > '9') {
struct passwd* pwd = getpwnam(str);
@@ -180,7 +180,7 @@ jint android_os_Process_getGidForName(JNIEnv* env, jobject clazz, jstring name)
const size_t N = name8.size();
if (N > 0) {
- const char* str = name8.string();
+ const char* str = name8.c_str();
for (size_t i=0; i<N; i++) {
if (str[i] < '0' || str[i] > '9') {
struct group* grp = getgrnam(str);
@@ -583,8 +583,8 @@ void android_os_Process_setArgV0(JNIEnv* env, jobject clazz, jstring name)
env->ReleaseStringCritical(name, str);
}
- if (!name8.isEmpty()) {
- AndroidRuntime::getRuntime()->setArgv0(name8.string(), true /* setProcName */);
+ if (!name8.empty()) {
+ AndroidRuntime::getRuntime()->setArgv0(name8.c_str(), true /* setProcName */);
}
}
@@ -690,7 +690,7 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt
return;
}
- int fd = open(file.string(), O_RDONLY | O_CLOEXEC);
+ int fd = open(file.c_str(), O_RDONLY | O_CLOEXEC);
if (fd >= 0) {
//ALOGI("Clearing %" PRId32 " sizes", count);
@@ -704,7 +704,7 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt
close(fd);
if (len < 0) {
- ALOGW("Unable to read %s", file.string());
+ ALOGW("Unable to read %s", file.c_str());
len = 0;
}
buffer[len] = 0;
@@ -717,7 +717,7 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt
//ALOGI("Parsing at: %s", p);
for (i=0; i<count; i++) {
const String8& field = fields[i];
- if (strncmp(p, field.string(), field.length()) == 0) {
+ if (strncmp(p, field.c_str(), field.length()) == 0) {
p += field.length();
while (*p == ' ' || *p == '\t') p++;
char* num = p;
@@ -729,7 +729,7 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt
}
char* end;
sizesArray[i] = strtoll(num, &end, 10);
- //ALOGI("Field %s = %" PRId64, field.string(), sizesArray[i]);
+ // ALOGI("Field %s = %" PRId64, field.c_str(), sizesArray[i]);
foundCount++;
break;
}
@@ -746,7 +746,7 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt
free(buffer);
} else {
- ALOGW("Unable to open %s", file.string());
+ ALOGW("Unable to open %s", file.c_str());
}
//ALOGI("Done!");
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c226112898a9..c369a10f4e23 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2225,6 +2225,14 @@
<permission android:name="android.permission.MANAGE_ETHERNET_NETWORKS"
android:protectionLevel="signature" />
+ <!-- Allows system apps to call methods to register itself as a mDNS offload engine.
+ <p>Not for use by third-party or privileged applications.
+ @SystemApi
+ @hide This should only be used by system apps.
+ -->
+ <permission android:name="android.permission.REGISTER_NSD_OFFLOAD_ENGINE"
+ android:protectionLevel="signature" />
+
<!-- ======================================= -->
<!-- Permissions for short range, peripheral networks -->
<!-- ======================================= -->
diff --git a/core/res/OWNERS b/core/res/OWNERS
index b46902e3a8e9..0df7c2047bc1 100644
--- a/core/res/OWNERS
+++ b/core/res/OWNERS
@@ -52,3 +52,6 @@ per-file res/xml/power_profile_test.xml = file:/BATTERY_STATS_OWNERS
# Telephony
per-file res/values/config_telephony.xml = file:/platform/frameworks/opt/telephony:/OWNERS
per-file res/xml/sms_short_codes.xml = file:/platform/frameworks/opt/telephony:/OWNERS
+
+# TV Input Framework
+per-file res/values/config_tv_external_input_logging.xml = file:/services/core/java/com/android/server/tv/OWNERS
diff --git a/core/tests/coretests/res/values-id/strings.xml b/core/tests/coretests/res/values-id/strings.xml
new file mode 100644
index 000000000000..6d71c90866cc
--- /dev/null
+++ b/core/tests/coretests/res/values-id/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Used in ResourcesLocaleTest. -->
+ <string name="locale_test_res_1">Pengujian ID</string>
+</resources>
diff --git a/core/tests/coretests/res/values-in/strings.xml b/core/tests/coretests/res/values-in/strings.xml
new file mode 100644
index 000000000000..63846603ed60
--- /dev/null
+++ b/core/tests/coretests/res/values-in/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Used in ResourcesLocaleTest. -->
+ <string name="locale_test_res_2">Pengujian IN</string>
+</resources>
diff --git a/core/tests/coretests/res/values/strings.xml b/core/tests/coretests/res/values/strings.xml
index e51eab60a998..09e1c690f4e2 100644
--- a/core/tests/coretests/res/values/strings.xml
+++ b/core/tests/coretests/res/values/strings.xml
@@ -131,6 +131,13 @@
<string name="textview_hebrew_text">&#x05DD;&#x05DE;ab?!</string>
+ <!-- Used in ResourcesLocaleTest. Also defined in values-id. "id" is the new ISO code for Indonesian. -->
+ <string name="locale_test_res_1">Testing ID</string>
+ <!-- Used in ResourcesLocaleTest. Also defined in values-in. "in" is the deprecated ISO code for Indonesian. -->
+ <string name="locale_test_res_2">Testing IN</string>
+ <!-- Used in ResourcesLocaleTest. -->
+ <string name="locale_test_res_3">Testing EN</string>
+
<!-- SizeAdaptiveLayout -->
<string name="first">Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.</string>
<string name="actor">Abe Lincoln</string>
diff --git a/core/tests/coretests/src/android/content/res/ResourcesLocaleTest.java b/core/tests/coretests/src/android/content/res/ResourcesLocaleTest.java
index 25c3db5c6910..26e4349243a5 100644
--- a/core/tests/coretests/src/android/content/res/ResourcesLocaleTest.java
+++ b/core/tests/coretests/src/android/content/res/ResourcesLocaleTest.java
@@ -16,6 +16,7 @@
package android.content.res;
+import android.content.Context;
import android.os.FileUtils;
import android.os.LocaleList;
import android.platform.test.annotations.Presubmit;
@@ -97,4 +98,24 @@ public class ResourcesLocaleTest extends AndroidTestCase {
assertEquals(Locale.forLanguageTag("pl-PL"),
resources.getConfiguration().getLocales().get(0));
}
+
+ @SmallTest
+ public void testDeprecatedISOLanguageCode() {
+ assertResGetString(Locale.US, R.string.locale_test_res_1, "Testing ID");
+ assertResGetString(Locale.forLanguageTag("id"), R.string.locale_test_res_2, "Pengujian IN");
+ assertResGetString(Locale.forLanguageTag("id"), R.string.locale_test_res_3, "Testing EN");
+ assertResGetString(new Locale("id"), R.string.locale_test_res_2, "Pengujian IN");
+ assertResGetString(new Locale("id"), R.string.locale_test_res_3, "Testing EN");
+ // The new ISO code "id" isn't supported yet, and thus the values-id are ignored.
+ assertResGetString(new Locale("id"), R.string.locale_test_res_1, "Testing ID");
+ assertResGetString(Locale.forLanguageTag("id"), R.string.locale_test_res_1, "Testing ID");
+ }
+
+ private void assertResGetString(Locale locale, int resId, String expectedString) {
+ LocaleList locales = new LocaleList(locale);
+ final Configuration config = new Configuration();
+ config.setLocales(locales);
+ Context newContext = getContext().createConfigurationContext(config);
+ assertEquals(expectedString, newContext.getResources().getString(resId));
+ }
}
diff --git a/core/tests/coretests/src/android/service/euicc/OWNERS b/core/tests/coretests/src/android/service/euicc/OWNERS
new file mode 100644
index 000000000000..41fc56b45dde
--- /dev/null
+++ b/core/tests/coretests/src/android/service/euicc/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/base:/telephony/java/android/service/euicc/OWNERS
diff --git a/core/tests/coretests/src/android/window/flags/WindowFlagsTest.java b/core/tests/coretests/src/android/window/flags/WindowFlagsTest.java
new file mode 100644
index 000000000000..a8b40325a713
--- /dev/null
+++ b/core/tests/coretests/src/android/window/flags/WindowFlagsTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2023 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.window.flags;
+
+import static com.android.window.flags.Flags.syncWindowConfigUpdateFlag;
+
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for {@link com.android.window.flags.Flags}
+ *
+ * Build/Install/Run:
+ * atest FrameworksCoreTests:WindowFlagsTest
+ */
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+@Presubmit
+public class WindowFlagsTest {
+
+ @Test
+ public void testSyncWindowConfigUpdateFlag() {
+ // No crash when accessing the flag.
+ syncWindowConfigUpdateFlag();
+ }
+}
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp
index e2bb6a6f4d1a..14d5eafa1945 100644
--- a/drm/jni/android_drm_DrmManagerClient.cpp
+++ b/drm/jni/android_drm_DrmManagerClient.cpp
@@ -167,8 +167,8 @@ void JNIOnInfoListener::onInfo(const DrmInfoEvent& event) {
jint uniqueId = event.getUniqueId();
jint type = event.getType();
JNIEnv *env = AndroidRuntime::getJNIEnv();
- jstring message = env->NewStringUTF(event.getMessage().string());
- ALOGV("JNIOnInfoListener::onInfo => %d | %d | %s", uniqueId, type, event.getMessage().string());
+ jstring message = env->NewStringUTF(event.getMessage().c_str());
+ ALOGV("JNIOnInfoListener::onInfo => %d | %d | %s", uniqueId, type, event.getMessage().c_str());
env->CallStaticVoidMethod(
mClass,
@@ -273,15 +273,15 @@ static jobject android_drm_DrmManagerClient_getConstraintsFromContent(
const char* value = pConstraints->getAsByteArray(&key);
if (NULL != value) {
ScopedLocalRef<jbyteArray> dataArray(env, env->NewByteArray(strlen(value)));
- ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.string()));
+ ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.c_str()));
env->SetByteArrayRegion(dataArray.get(), 0, strlen(value), (jbyte*)value);
env->CallVoidMethod(constraints, ContentValues_putByteArray,
keyString.get(), dataArray.get());
}
} else {
String8 value = pConstraints->get(key);
- ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.string()));
- ScopedLocalRef<jstring> valueString(env, env->NewStringUTF(value.string()));
+ ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.c_str()));
+ ScopedLocalRef<jstring> valueString(env, env->NewStringUTF(value.c_str()));
env->CallVoidMethod(constraints, ContentValues_putString,
keyString.get(), valueString.get());
}
@@ -320,8 +320,8 @@ static jobject android_drm_DrmManagerClient_getMetadataFromContent(
// insert the entry<constraintKey, constraintValue>
// to newly created java object
String8 value = pMetadata->get(key);
- ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.string()));
- ScopedLocalRef<jstring> valueString(env, env->NewStringUTF(value.string()));
+ ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.c_str()));
+ ScopedLocalRef<jstring> valueString(env, env->NewStringUTF(value.c_str()));
env->CallVoidMethod(metadata, ContentValues_putString,
keyString.get(), valueString.get());
}
@@ -357,19 +357,19 @@ static jobjectArray android_drm_DrmManagerClient_getAllSupportInfo(
env->CallVoidMethod(
drmSupportInfo, env->GetMethodID(clazz, "setDescription", "(Ljava/lang/String;)V"),
- env->NewStringUTF(info.getDescription().string()));
+ env->NewStringUTF(info.getDescription().c_str()));
DrmSupportInfo::MimeTypeIterator iterator = info.getMimeTypeIterator();
while (iterator.hasNext()) {
String8 value = iterator.next();
- env->CallVoidMethod(drmSupportInfo, addMimeTypeId, env->NewStringUTF(value.string()));
+ env->CallVoidMethod(drmSupportInfo, addMimeTypeId, env->NewStringUTF(value.c_str()));
}
DrmSupportInfo::FileSuffixIterator it = info.getFileSuffixIterator();
while (it.hasNext()) {
String8 value = it.next();
env->CallVoidMethod(
- drmSupportInfo, addFileSuffixId, env->NewStringUTF(value.string()));
+ drmSupportInfo, addFileSuffixId, env->NewStringUTF(value.c_str()));
}
env->SetObjectArrayElement(array, i, drmSupportInfo);
@@ -459,7 +459,7 @@ static jobject android_drm_DrmManagerClient_processDrmInfo(
String8 keyString = Utility::getStringValue(env, key.get());
String8 valueString = Utility::getStringValue(env, valString.get());
- ALOGV("Key: %s | Value: %s", keyString.string(), valueString.string());
+ ALOGV("Key: %s | Value: %s", keyString.c_str(), valueString.c_str());
drmInfo.put(keyString, valueString);
}
@@ -488,15 +488,15 @@ static jobject android_drm_DrmManagerClient_processDrmInfo(
jmethodID constructorId
= env->GetMethodID(clazz, "<init>", "([BLjava/lang/String;Ljava/lang/String;)V");
jobject processedData = env->NewObject(clazz, constructorId, dataArray,
- env->NewStringUTF((drmInfo.get(DrmInfoRequest::ACCOUNT_ID)).string()),
- env->NewStringUTF((drmInfo.get(DrmInfoRequest::SUBSCRIPTION_ID)).string()));
+ env->NewStringUTF((drmInfo.get(DrmInfoRequest::ACCOUNT_ID)).c_str()),
+ env->NewStringUTF((drmInfo.get(DrmInfoRequest::SUBSCRIPTION_ID)).c_str()));
constructorId
= env->GetMethodID(localRef,
"<init>", "(IILandroid/drm/ProcessedData;Ljava/lang/String;)V");
drmInfoStatus = env->NewObject(localRef, constructorId, statusCode, infoType,
- processedData, env->NewStringUTF(pDrmInfoStatus->mimeType.string()));
+ processedData, env->NewStringUTF(pDrmInfoStatus->mimeType.c_str()));
}
delete[] mData; mData = NULL;
@@ -533,7 +533,7 @@ static jobject android_drm_DrmManagerClient_acquireDrmInfo(
String8 keyString = Utility::getStringValue(env, key.get());
String8 valueString = Utility::getStringValue(env, value.get());
- ALOGV("Key: %s | Value: %s", keyString.string(), valueString.string());
+ ALOGV("Key: %s | Value: %s", keyString.c_str(), valueString.c_str());
drmInfoReq.put(keyString, valueString);
}
@@ -554,7 +554,7 @@ static jobject android_drm_DrmManagerClient_acquireDrmInfo(
drmInfoObject
= env->NewObject(localRef,
env->GetMethodID(localRef, "<init>", "(I[BLjava/lang/String;)V"),
- mInfoType, dataArray, env->NewStringUTF(pDrmInfo->getMimeType().string()));
+ mInfoType, dataArray, env->NewStringUTF(pDrmInfo->getMimeType().c_str()));
DrmInfo::KeyIterator it = pDrmInfo->keyIterator();
jmethodID putMethodId
@@ -563,8 +563,8 @@ static jobject android_drm_DrmManagerClient_acquireDrmInfo(
while (it.hasNext()) {
String8 key = it.next();
String8 value = pDrmInfo->get(key);
- ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.string()));
- ScopedLocalRef<jstring> valueString(env, env->NewStringUTF(value.string()));
+ ScopedLocalRef<jstring> keyString(env, env->NewStringUTF(key.c_str()));
+ ScopedLocalRef<jstring> valueString(env, env->NewStringUTF(value.c_str()));
env->CallVoidMethod(drmInfoObject, putMethodId,
keyString.get(), valueString.get());
}
@@ -602,7 +602,7 @@ static jstring android_drm_DrmManagerClient_getOriginalMimeType(
->getOriginalMimeType(uniqueId,
Utility::getStringValue(env, path), fd);
ALOGV("getOriginalMimeType Exit");
- return env->NewStringUTF(mimeType.string());
+ return env->NewStringUTF(mimeType.c_str());
}
static jint android_drm_DrmManagerClient_checkRightsStatus(
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
index 7afb890e6254..9eed904d52be 100644
--- a/keystore/java/android/security/keystore/KeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -1508,7 +1508,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
* key has purpose {@link android.security.keystore.KeyProperties#PURPOSE_SIGN}. If the key
* does not have purpose {@link android.security.keystore.KeyProperties#PURPOSE_SIGN}, it is
* not possible to use the key to sign a certificate, so the public key certificate will
- * contain a dummy signature.
+ * contain a placeholder signature.
*
* <p>Symmetric keys, such as AES and HMAC keys, do not have public key certificates. If a
* {@link #getAttestationChallenge()} returns non-null and the spec is used to generate a
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index 400829e15364..fc9dd145dc5d 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -890,13 +890,13 @@ std::string AssetManager2::GetLastResourceResolution() const {
}
log_stream << "\n\t" << prefix->second << ": " << apk_assets_[step.cookie]->GetDebugName();
- if (!step.config_name.isEmpty()) {
+ if (!step.config_name.empty()) {
log_stream << " - " << step.config_name;
}
}
log_stream << "\nBest matching is from "
- << (last_resolution_.best_config_name.isEmpty() ? "default"
+ << (last_resolution_.best_config_name.empty() ? "default"
: last_resolution_.best_config_name)
<< " configuration of " << last_resolution_.best_package_name;
return log_stream.str();
diff --git a/libs/hwui/utils/LinearAllocator.cpp b/libs/hwui/utils/LinearAllocator.cpp
index 8baa4b770f85..eab888ef4d1a 100644
--- a/libs/hwui/utils/LinearAllocator.cpp
+++ b/libs/hwui/utils/LinearAllocator.cpp
@@ -31,15 +31,11 @@
#include <utils/Log.h>
#include <utils/Macros.h>
-// The ideal size of a page allocation (these need to be multiples of 8)
-#define INITIAL_PAGE_SIZE ((size_t)512) // 512b
-#define MAX_PAGE_SIZE ((size_t)131072) // 128kb
-
// The maximum amount of wasted space we can have per page
// Allocations exceeding this will have their own dedicated page
// If this is too low, we will malloc too much
// Too high, and we may waste too much space
-// Must be smaller than INITIAL_PAGE_SIZE
+// Must be smaller than kInitialPageSize
#define MAX_WASTE_RATIO (0.5f)
#if LOG_NDEBUG
@@ -75,6 +71,10 @@ static void _addAllocation(int count) {
namespace android {
namespace uirenderer {
+// The ideal size of a page allocation (these need to be multiples of 8)
+static constexpr size_t kInitialPageSize = 512; // 512b
+static constexpr size_t kMaxPageSize = 131072; // 128kb
+
class LinearAllocator::Page {
public:
Page* next() { return mNextPage; }
@@ -94,8 +94,8 @@ private:
};
LinearAllocator::LinearAllocator()
- : mPageSize(INITIAL_PAGE_SIZE)
- , mMaxAllocSize(INITIAL_PAGE_SIZE * MAX_WASTE_RATIO)
+ : mPageSize(kInitialPageSize)
+ , mMaxAllocSize(kInitialPageSize * MAX_WASTE_RATIO)
, mNext(0)
, mCurrentPage(0)
, mPages(0)
@@ -135,8 +135,8 @@ bool LinearAllocator::fitsInCurrentPage(size_t size) {
void LinearAllocator::ensureNext(size_t size) {
if (fitsInCurrentPage(size)) return;
- if (mCurrentPage && mPageSize < MAX_PAGE_SIZE) {
- mPageSize = min(MAX_PAGE_SIZE, mPageSize * 2);
+ if (mCurrentPage && mPageSize < kMaxPageSize) {
+ mPageSize = min(kMaxPageSize, mPageSize * 2);
mMaxAllocSize = mPageSize * MAX_WASTE_RATIO;
mPageSize = ALIGN(mPageSize);
}
diff --git a/libs/incident/src/IncidentReportArgs.cpp b/libs/incident/src/IncidentReportArgs.cpp
index d344a981ecea..858813ff4276 100644
--- a/libs/incident/src/IncidentReportArgs.cpp
+++ b/libs/incident/src/IncidentReportArgs.cpp
@@ -152,8 +152,8 @@ IncidentReportArgs::readFromParcel(const Parcel* in)
}
mPrivacyPolicy = privacyPolicy;
- mReceiverPkg = String8(in->readString16()).string();
- mReceiverCls = String8(in->readString16()).string();
+ mReceiverPkg = String8(in->readString16()).c_str();
+ mReceiverCls = String8(in->readString16()).c_str();
int32_t gzip;
err = in->readInt32(&gzip);
diff --git a/libs/services/src/os/DropBoxManager.cpp b/libs/services/src/os/DropBoxManager.cpp
index 3716e019f69a..60bb00ab7309 100644
--- a/libs/services/src/os/DropBoxManager.cpp
+++ b/libs/services/src/os/DropBoxManager.cpp
@@ -196,7 +196,7 @@ DropBoxManager::addData(const String16& tag, uint8_t const* data,
vector<uint8_t> dataArg;
dataArg.assign(data, data + size);
Status status = service->addData(tag, dataArg, flags);
- ALOGD("service->add returned %s", status.toString8().string());
+ ALOGD("service->add returned %s", status.toString8().c_str());
return status;
}
@@ -230,7 +230,7 @@ DropBoxManager::addFile(const String16& tag, int fd, int flags)
android::base::unique_fd uniqueFd(fd);
android::os::ParcelFileDescriptor parcelFd(std::move(uniqueFd));
Status status = service->addFile(tag, parcelFd, flags);
- ALOGD("service->add returned %s", status.toString8().string());
+ ALOGD("service->add returned %s", status.toString8().c_str());
return status;
}
diff --git a/location/Android.bp b/location/Android.bp
new file mode 100644
index 000000000000..ead46e9b28d9
--- /dev/null
+++ b/location/Android.bp
@@ -0,0 +1,24 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_base_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_base_license"],
+}
+
+//location sources that will populate the new module
+filegroup {
+ name: "framework-location-nonupdatable-sources",
+ srcs: [
+ "placeholder_java/android/location/Placeholder.java",
+ ],
+}
+
+java_library {
+ name: "framework-location.stubs.module_lib",
+ srcs: [
+ ":framework-location-nonupdatable-sources",
+ ],
+ sdk_version: "core_platform",
+}
diff --git a/location/java/android/location/GnssRequest.java b/location/java/android/location/GnssRequest.java
index 9c9766fd02d6..f3a40cc3af40 100644
--- a/location/java/android/location/GnssRequest.java
+++ b/location/java/android/location/GnssRequest.java
@@ -41,7 +41,7 @@ public final class GnssRequest implements Parcelable {
*
* <p>If true, GNSS chipset switches off duty cycling. In such a mode, no clock
* discontinuities are expected, and when supported, carrier phase should be continuous in
- * good signal conditions. All non-blacklisted, healthy constellations, satellites and
+ * good signal conditions. All non-denylisted, healthy constellations, satellites and
* frequency bands that the chipset supports must be reported in this mode. The GNSS chipset
* is allowed to consume more power in this mode. If false, GNSS chipset optimizes power via
* duty cycling, constellations and frequency limits, etc.
@@ -138,7 +138,7 @@ public final class GnssRequest implements Parcelable {
*
* <p>If true, GNSS chipset switches off duty cycling. In such a mode, no clock
* discontinuities are expected, and when supported, carrier phase should be continuous in
- * good signal conditions. All non-blacklisted, healthy constellations, satellites and
+ * good signal conditions. All non-denylisted, healthy constellations, satellites and
* frequency bands that the chipset supports must be reported in this mode. The GNSS chipset
* is allowed to consume more power in this mode. If false, GNSS chipset optimizes power via
* duty cycling, constellations and frequency limits, etc.
diff --git a/location/placeholder_java/android/location/Placeholder.java b/location/placeholder_java/android/location/Placeholder.java
new file mode 100644
index 000000000000..f0dbce829174
--- /dev/null
+++ b/location/placeholder_java/android/location/Placeholder.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+/**
+ * Placeholder class so new frameworks-location module isn't empty, will be removed once module is
+ * populated.
+ *
+ * @hide
+ *
+ */
+public class Placeholder {
+}
diff --git a/media/java/android/media/Cea708CaptionRenderer.java b/media/java/android/media/Cea708CaptionRenderer.java
index 88912fef4501..efaf3d22f489 100644
--- a/media/java/android/media/Cea708CaptionRenderer.java
+++ b/media/java/android/media/Cea708CaptionRenderer.java
@@ -194,7 +194,7 @@ class Cea708CCParser {
private final StringBuffer mBuffer = new StringBuffer();
private int mCommand = 0;
- // Assign a dummy listener in order to avoid null checks.
+ // Assign a placeholder listener in order to avoid null checks.
private DisplayListener mListener = new DisplayListener() {
@Override
public void emitEvent(CaptionEvent event) {
diff --git a/media/java/android/media/MediaMetadataRetriever.java b/media/java/android/media/MediaMetadataRetriever.java
index ea261852bb9f..1de08810307e 100644
--- a/media/java/android/media/MediaMetadataRetriever.java
+++ b/media/java/android/media/MediaMetadataRetriever.java
@@ -1155,7 +1155,7 @@ public class MediaMetadataRetriever implements AutoCloseable {
public static final int OPTION_CLOSEST = 0x03;
/** @hide */
- @IntDef(flag = true, prefix = { "OPTION_" }, value = {
+ @IntDef(flag = false, prefix = { "OPTION_" }, value = {
OPTION_PREVIOUS_SYNC,
OPTION_NEXT_SYNC,
OPTION_CLOSEST_SYNC,
diff --git a/media/java/android/media/voice/KeyphraseModelManager.java b/media/java/android/media/voice/KeyphraseModelManager.java
index 8ec8967a353e..290f1ac35200 100644
--- a/media/java/android/media/voice/KeyphraseModelManager.java
+++ b/media/java/android/media/voice/KeyphraseModelManager.java
@@ -35,7 +35,7 @@ import java.util.Objects;
* This class provides management of voice based sound recognition models. Usage of this class is
* restricted to system or signature applications only. This allows OEMs to write apps that can
* manage voice based sound trigger models.
- * Callers of this class are expected to have whitelist manifest permission MANAGE_VOICE_KEYPHRASES.
+ * Callers of this class are expected to have allowlist manifest permission MANAGE_VOICE_KEYPHRASES.
* Callers of this class are expected to be the designated voice interaction service via
* {@link Settings.Secure.VOICE_INTERACTION_SERVICE} or a bundled voice model enrollment application
* detected by {@link android.hardware.soundtrigger.KeyphraseEnrollmentInfo}.
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp
index 3b93b07b98bc..f7d4825844cc 100644
--- a/media/jni/android_media_ImageReader.cpp
+++ b/media/jni/android_media_ImageReader.cpp
@@ -617,7 +617,7 @@ static jint ImageReader_imageSetup(JNIEnv* env, jobject thiz, jobject image) {
"match the ImageReader's configured buffer format 0x%x.",
bufferFormat, ctx->getBufferFormat());
jniThrowException(env, "java/lang/UnsupportedOperationException",
- msg.string());
+ msg.c_str());
return -1;
}
}
@@ -789,7 +789,7 @@ static jobjectArray ImageReader_createImagePlanes(JNIEnv* env, jobject /*thiz*/,
String8 msg;
msg.appendFormat("Format 0x%x is opaque, thus not writable, the number of planes (%d)"
" must be 0", halReaderFormat, numPlanes);
- jniThrowException(env, "java/lang/IllegalArgumentException", msg.string());
+ jniThrowException(env, "java/lang/IllegalArgumentException", msg.c_str());
return NULL;
}
@@ -854,7 +854,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
String8 msg;
msg.appendFormat("Format 0x%x is opaque, thus not writable, the number of planes (%d)"
" must be 0", halReaderFormat, numPlanes);
- jniThrowException(env, "java/lang/IllegalArgumentException", msg.string());
+ jniThrowException(env, "java/lang/IllegalArgumentException", msg.c_str());
return NULL;
}
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index 2c498e5bb4ef..dd1652c98596 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -1068,7 +1068,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
String8 msg;
msg.appendFormat("Format 0x%x is opaque, thus not writable, the number of planes (%d)"
" must be 0", writerFormat, numPlanes);
- jniThrowException(env, "java/lang/IllegalArgumentException", msg.string());
+ jniThrowException(env, "java/lang/IllegalArgumentException", msg.c_str());
return NULL;
}
diff --git a/media/jni/android_media_MediaCrypto.cpp b/media/jni/android_media_MediaCrypto.cpp
index f491be884b2f..5506f6149fa5 100644
--- a/media/jni/android_media_MediaCrypto.cpp
+++ b/media/jni/android_media_MediaCrypto.cpp
@@ -299,7 +299,7 @@ static void android_media_MediaCrypto_setMediaDrmSession(
std::string strerr(StrCryptoError(err));
msg.appendFormat(": general failure (%s)", strerr.c_str());
}
- jniThrowException(env, "android/media/MediaCryptoException", msg.string());
+ jniThrowException(env, "android/media/MediaCryptoException", msg.c_str());
}
}
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
index b70818d1e1b0..c616b84fa6fb 100644
--- a/media/jni/android_media_MediaDrm.cpp
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -708,8 +708,8 @@ static jobject KeyedVectorToHashMap (JNIEnv *env, KeyedVector<String8, String8>
jclass clazz = gFields.hashmapClassId;
jobject hashMap = env->NewObject(clazz, gFields.hashmap.init);
for (size_t i = 0; i < map.size(); ++i) {
- jstring jkey = env->NewStringUTF(map.keyAt(i).string());
- jstring jvalue = env->NewStringUTF(map.valueAt(i).string());
+ jstring jkey = env->NewStringUTF(map.keyAt(i).c_str());
+ jstring jvalue = env->NewStringUTF(map.valueAt(i).c_str());
env->CallObjectMethod(hashMap, gFields.hashmap.put, jkey, jvalue);
env->DeleteLocalRef(jkey);
env->DeleteLocalRef(jvalue);
@@ -1169,7 +1169,7 @@ static jobject android_media_MediaDrm_getKeyRequest(
jbyteArray jrequest = VectorToJByteArray(env, request);
env->SetObjectField(keyObj, gFields.keyRequest.data, jrequest);
- jstring jdefaultUrl = env->NewStringUTF(defaultUrl.string());
+ jstring jdefaultUrl = env->NewStringUTF(defaultUrl.c_str());
env->SetObjectField(keyObj, gFields.keyRequest.defaultUrl, jdefaultUrl);
switch (keyRequestType) {
@@ -1332,7 +1332,7 @@ static jobject android_media_MediaDrm_getProvisionRequestNative(
jbyteArray jrequest = VectorToJByteArray(env, request);
env->SetObjectField(provisionObj, gFields.provisionRequest.data, jrequest);
- jstring jdefaultUrl = env->NewStringUTF(defaultUrl.string());
+ jstring jdefaultUrl = env->NewStringUTF(defaultUrl.c_str());
env->SetObjectField(provisionObj, gFields.provisionRequest.defaultUrl, jdefaultUrl);
}
@@ -1686,7 +1686,7 @@ static jstring android_media_MediaDrm_getPropertyString(
return NULL;
}
- return env->NewStringUTF(value.string());
+ return env->NewStringUTF(value.c_str());
}
static jbyteArray android_media_MediaDrm_getPropertyByteArray(
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index ddc51cdb861c..14587589372b 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -126,7 +126,7 @@ android_media_MediaMetadataRetriever_setDataSourceAndHeaders(
tmp = NULL;
// Don't let somebody trick us in to reading some random block of memory
- if (strncmp("mem://", pathStr.string(), 6) == 0) {
+ if (strncmp("mem://", pathStr.c_str(), 6) == 0) {
jniThrowException(
env, "java/lang/IllegalArgumentException", "Invalid pathname");
return;
@@ -149,7 +149,7 @@ android_media_MediaMetadataRetriever_setDataSourceAndHeaders(
env,
retriever->setDataSource(
httpService,
- pathStr.string(),
+ pathStr.c_str(),
headersVector.size() > 0 ? &headersVector : NULL),
"java/lang/RuntimeException",
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index a548a472fc3a..43de37850b89 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -1214,7 +1214,7 @@ static bool throwDrmExceptionAsNecessary(JNIEnv *env, status_t err, const char *
String8 vendorMessage;
if (err >= ERROR_DRM_VENDOR_MIN && err <= ERROR_DRM_VENDOR_MAX) {
vendorMessage = String8::format("DRM vendor-defined error: %d", err);
- drmMessage = vendorMessage.string();
+ drmMessage = vendorMessage.c_str();
}
if (err == BAD_VALUE) {
@@ -1240,7 +1240,7 @@ static bool throwDrmExceptionAsNecessary(JNIEnv *env, status_t err, const char *
msg = drmMessage;
} else {
errbuf = String8::format("%s: %s", msg, drmMessage);
- msg = errbuf.string();
+ msg = errbuf.c_str();
}
}
throwDrmStateException(env, msg, err);
diff --git a/media/jni/android_media_Streams.cpp b/media/jni/android_media_Streams.cpp
index 4fd515323181..dffeb890a840 100644
--- a/media/jni/android_media_Streams.cpp
+++ b/media/jni/android_media_Streams.cpp
@@ -38,7 +38,7 @@ FileStream::FileStream(const int fd)
FileStream::FileStream(const String8 filename)
: mPosition(0) {
- mFile = fopen(filename.string(), "r");
+ mFile = fopen(filename.c_str(), "r");
if (mFile == NULL) {
return;
}
@@ -86,7 +86,7 @@ bool GetExifFromRawImage(
if (!piex::IsRaw(stream)) {
// Format not supported.
- ALOGV("Format not supported: %s", filename.string());
+ ALOGV("Format not supported: %s", filename.c_str());
return false;
}
@@ -94,7 +94,7 @@ bool GetExifFromRawImage(
if (err != piex::Error::kOk) {
// The input data seems to be broken.
- ALOGV("Raw image not detected: %s (piex error code: %d)", filename.string(), (int32_t)err);
+ ALOGV("Raw image not detected: %s (piex error code: %d)", filename.c_str(), (int32_t)err);
return false;
}
diff --git a/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java b/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java
index 4086dec99218..7f4a4feaf05f 100644
--- a/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java
+++ b/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java
@@ -872,7 +872,7 @@ public class MediaRouter2ManagerTest {
CountDownLatch addedLatch = new CountDownLatch(1);
CountDownLatch preferenceLatch = new CountDownLatch(1);
- // A dummy callback is required to send route feature info.
+ // A placeholder callback is required to send route feature info.
RouteCallback routeCallback = new RouteCallback() {};
MediaRouter2Manager.Callback managerCallback = new MediaRouter2Manager.Callback() {
@Override
diff --git a/native/android/asset_manager.cpp b/native/android/asset_manager.cpp
index 69cf80477dde..1878716da3cd 100644
--- a/native/android/asset_manager.cpp
+++ b/native/android/asset_manager.cpp
@@ -118,7 +118,7 @@ const char* AAssetDir_getNextFileName(AAssetDir* assetDir)
// the string to return and advance the iterator for next time.
if (index < max) {
assetDir->mCachedFileName = assetDir->mAssetDir->getFileName(index);
- returnName = assetDir->mCachedFileName.string();
+ returnName = assetDir->mCachedFileName.c_str();
index++;
}
@@ -134,7 +134,7 @@ void AAssetDir_rewind(AAssetDir* assetDir)
const char* AAssetDir_getFileName(AAssetDir* assetDir, int index)
{
assetDir->mCachedFileName = assetDir->mAssetDir->getFileName(index);
- return assetDir->mCachedFileName.string();
+ return assetDir->mCachedFileName.c_str();
}
void AAssetDir_close(AAssetDir* assetDir)
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp
index 968de34f5d69..bb8708bd1e5e 100644
--- a/native/android/sensor.cpp
+++ b/native/android/sensor.cpp
@@ -304,12 +304,12 @@ int ASensorEventQueue_requestAdditionalInfoEvents(ASensorEventQueue* queue, bool
const char* ASensor_getName(ASensor const* sensor) {
RETURN_IF_SENSOR_IS_NULL(nullptr);
- return static_cast<Sensor const*>(sensor)->getName().string();
+ return static_cast<Sensor const*>(sensor)->getName().c_str();
}
const char* ASensor_getVendor(ASensor const* sensor) {
RETURN_IF_SENSOR_IS_NULL(nullptr);
- return static_cast<Sensor const*>(sensor)->getVendor().string();
+ return static_cast<Sensor const*>(sensor)->getVendor().c_str();
}
int ASensor_getType(ASensor const* sensor) {
@@ -339,7 +339,7 @@ int ASensor_getFifoReservedEventCount(ASensor const* sensor) {
const char* ASensor_getStringType(ASensor const* sensor) {
RETURN_IF_SENSOR_IS_NULL(nullptr);
- return static_cast<Sensor const*>(sensor)->getStringType().string();
+ return static_cast<Sensor const*>(sensor)->getStringType().c_str();
}
int ASensor_getReportingMode(ASensor const* sensor) {
diff --git a/native/android/storage_manager.cpp b/native/android/storage_manager.cpp
index 294ca9cfd3b4..6db87dfdd565 100644
--- a/native/android/storage_manager.cpp
+++ b/native/android/storage_manager.cpp
@@ -175,7 +175,7 @@ public:
String16 filename16(filename);
String16 path16;
if (mMountService->getMountedObbPath(filename16, path16)) {
- return String8(path16).string();
+ return String8(path16).c_str();
} else {
return NULL;
}
@@ -183,7 +183,7 @@ public:
};
void ObbActionListener::onObbResult(const android::String16& filename, const int32_t nonce, const int32_t state) {
- mStorageManager->fireCallback(String8(filename).string(), nonce, state);
+ mStorageManager->fireCallback(String8(filename).c_str(), nonce, state);
}
diff --git a/packages/EncryptedLocalTransport/Android.bp b/packages/EncryptedLocalTransport/Android.bp
index 09e563076c95..9ae6d9648979 100644
--- a/packages/EncryptedLocalTransport/Android.bp
+++ b/packages/EncryptedLocalTransport/Android.bp
@@ -27,9 +27,6 @@ android_app {
name: "EncryptedLocalTransport",
defaults: ["platform_app_defaults"],
srcs: ["src/**/*.java"],
- optimize: {
- proguard_flags_files: ["proguard.flags"],
- },
static_libs: ["LocalTransport"],
platform_apis: true,
certificate: "platform",
diff --git a/packages/EncryptedLocalTransport/proguard.flags b/packages/EncryptedLocalTransport/proguard.flags
deleted file mode 100644
index e4ce3c524e35..000000000000
--- a/packages/EncryptedLocalTransport/proguard.flags
+++ /dev/null
@@ -1,2 +0,0 @@
--keep class com.android.localTransport.EncryptedLocalTransport
--keep class com.android.localTransport.EncryptedLocalTransportService
diff --git a/packages/Keyguard/proguard.flags b/packages/Keyguard/proguard.flags
deleted file mode 100644
index fb74b64cb92b..000000000000
--- a/packages/Keyguard/proguard.flags
+++ /dev/null
@@ -1,27 +0,0 @@
--keep public class * {
- public void setBackgroundAlpha(float);
- public float getBackgroundAlpha();
- public void setContentAlpha(float);
- public float getContentAlpha();
- public void setAlpha(float);
- public float getAlpha();
- public void setAlpha(int);
- public int getAlpha();
- public void setRotationX(float);
- public float getRotationX();
- public void setRotationY(float);
- public float getRotationY();
- public void setPivotX(float);
- public float getPivotX();
- public void setPivotY(float);
- public float getPivotY();
- public void setScaleX(float);
- public float getScaleX();
- public void setScaleY(float);
- public float getScaleY();
- public void setTranslationX(float);
- public float getTranslationX();
- public void setTranslationY(float);
- public float getTranslationY();
-}
-
diff --git a/packages/LocalTransport/Android.bp b/packages/LocalTransport/Android.bp
index d4fa1915a140..e7a273b83a7d 100644
--- a/packages/LocalTransport/Android.bp
+++ b/packages/LocalTransport/Android.bp
@@ -27,9 +27,7 @@ android_app {
name: "LocalTransport",
defaults: ["platform_app_defaults"],
srcs: ["src/**/*.java"],
- optimize: {
- proguard_flags_files: ["proguard.flags"],
- },
+ libs: ["keepanno-annotations"],
platform_apis: true,
certificate: "platform",
privileged: true,
diff --git a/packages/LocalTransport/proguard.flags b/packages/LocalTransport/proguard.flags
deleted file mode 100644
index c1f51b892d40..000000000000
--- a/packages/LocalTransport/proguard.flags
+++ /dev/null
@@ -1,5 +0,0 @@
--keep class com.android.localTransport.LocalTransport
--keep class com.android.localTransport.LocalTransportParameters
--keep class com.android.localTransport.LocalTransportService
-
-
diff --git a/packages/LocalTransport/src/com/android/localtransport/LocalTransport.java b/packages/LocalTransport/src/com/android/localtransport/LocalTransport.java
index 4344e9401fc9..6540cc060bc2 100644
--- a/packages/LocalTransport/src/com/android/localtransport/LocalTransport.java
+++ b/packages/LocalTransport/src/com/android/localtransport/LocalTransport.java
@@ -35,6 +35,9 @@ import android.util.ArrayMap;
import android.util.Base64;
import android.util.Log;
+import com.android.tools.r8.keepanno.annotations.KeepTarget;
+import com.android.tools.r8.keepanno.annotations.UsesReflection;
+
import libcore.io.IoUtils;
import java.io.BufferedOutputStream;
@@ -122,6 +125,13 @@ public class LocalTransport extends BackupTransport {
return mParameters;
}
+
+ @UsesReflection({
+ // As the runtime class name is used to generate the returned name, and the returned
+ // name may be used used with reflection, generate the necessary keep rules.
+ @KeepTarget(classConstant = LocalTransport.class),
+ @KeepTarget(extendsClassConstant = LocalTransport.class)
+ })
@Override
public String name() {
return new ComponentName(mContext, this.getClass()).flattenToShortString();
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
index 9c6113ce4b47..3de6cfd10920 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -371,7 +371,7 @@ public class PackageInstallerActivity extends AlertActivity {
if (mLocalLOGV) Log.i(TAG, "onResume(): mAppSnippet=" + mAppSnippet);
if (mAppSnippet != null) {
- // load dummy layout with OK button disabled until we override this layout in
+ // load placeholder layout with OK button disabled until we override this layout in
// startInstallConfirm
bindUi();
checkIfAllowedAndInitiateInstall();
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
index 2d958a919793..1ab787e5e327 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
@@ -294,8 +294,8 @@ public class BluetoothUtils {
*/
public static boolean isDeviceClassMatched(@NonNull BluetoothDevice bluetoothDevice,
int device) {
- return bluetoothDevice.getBluetoothClass() != null
- && bluetoothDevice.getBluetoothClass().getDeviceClass() == device;
+ final BluetoothClass bluetoothClass = bluetoothDevice.getBluetoothClass();
+ return bluetoothClass != null && bluetoothClass.getDeviceClass() == device;
}
private static boolean isAdvancedHeaderEnabled() {
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS b/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS
index 5e6697289d5a..7669e79b42be 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS
@@ -3,7 +3,10 @@ siyuanh@google.com
hughchen@google.com
timhypeng@google.com
robertluo@google.com
-changbetty@google.com
songferngwang@google.com
+yqian@google.com
+chelseahao@google.com
+yiyishen@google.com
+hahong@google.com
# Emergency approvers in case the above are not available
diff --git a/packages/SharedStorageBackup/Android.bp b/packages/SharedStorageBackup/Android.bp
index 21516fade1ab..225b5b4234b6 100644
--- a/packages/SharedStorageBackup/Android.bp
+++ b/packages/SharedStorageBackup/Android.bp
@@ -27,9 +27,6 @@ android_app {
name: "SharedStorageBackup",
defaults: ["platform_app_defaults"],
srcs: ["src/**/*.java"],
- optimize: {
- proguard_flags_files: ["proguard.flags"],
- },
platform_apis: true,
certificate: "platform",
privileged: true,
diff --git a/packages/SharedStorageBackup/proguard.flags b/packages/SharedStorageBackup/proguard.flags
deleted file mode 100644
index 6a66a47e3050..000000000000
--- a/packages/SharedStorageBackup/proguard.flags
+++ /dev/null
@@ -1,2 +0,0 @@
--keep class com.android.sharedstoragebackup.SharedStorageAgent
--keep class com.android.sharedstoragebackup.ObbBackupService
diff --git a/packages/SystemUI/docs/qs-tiles.md b/packages/SystemUI/docs/qs-tiles.md
index 488f8c728d82..bd0b4abbeb34 100644
--- a/packages/SystemUI/docs/qs-tiles.md
+++ b/packages/SystemUI/docs/qs-tiles.md
@@ -123,7 +123,7 @@ A third party tile is any Quick Settings tile that is provided by an app (that's
### API classes
-The classes that define the public API are in [core/java/android/service/quicksettings](core/java/android/service/quicksettings).
+The classes that define the public API are in [core/java/android/service/quicksettings](/core/java/android/service/quicksettings).
#### Tile
diff --git a/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java b/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
index 0369d5b32883..ddc4e32fc879 100644
--- a/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
+++ b/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
@@ -131,7 +131,7 @@ public class AAAPlusPlusVerifySysuiRequiredTestPropertiesTest extends SysuiTestC
// with the main process dependency graph because it will not exist
// at runtime and could lead to incorrect tests which assume
// the main SystemUI process. Therefore, exclude this package
- // from the base class whitelist.
+ // from the base class allowlist.
filter.add(s -> !s.startsWith("com.android.systemui.screenshot"));
return filter;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
index 5e2fa98178f4..1b7590983db7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
@@ -64,7 +64,7 @@ import java.util.List;
public class InflatedSmartRepliesTest extends SysuiTestCase {
private static final Intent TEST_INTENT = new Intent("com.android.SMART_REPLY_VIEW_ACTION");
- private static final Intent WHITELISTED_TEST_INTENT =
+ private static final Intent ALLOWLISTED_TEST_INTENT =
new Intent("com.android.WHITELISTED_TEST_ACTION");
@Mock private SmartReplyConstants mSmartReplyConstants;
@@ -343,7 +343,7 @@ public class InflatedSmartRepliesTest extends SysuiTestCase {
assertThat(smartReplyState.getSmartReplies().choices)
.containsExactlyElementsIn(mEntry.getSmartReplies()).inOrder();
- // Since no apps are whitelisted no actions should be shown.
+ // Since no apps are allowlisted no actions should be shown.
assertThat(smartReplyState.getSmartActions().actions).isEmpty();
assertThat(smartReplyState.getSuppressedActions()).isNull();
assertThat(smartReplyState.getHasPhishingAction()).isFalse();
@@ -358,7 +358,7 @@ public class InflatedSmartRepliesTest extends SysuiTestCase {
allowedResolveInfo.activityInfo.packageName = allowedPackage;
when(mPackageManagerWrapper
.resolveActivity(
- argThat(intent -> WHITELISTED_TEST_INTENT.getAction().equals(
+ argThat(intent -> ALLOWLISTED_TEST_INTENT.getAction().equals(
intent.getAction())),
anyInt() /* flags */))
.thenReturn(allowedResolveInfo);
@@ -368,7 +368,7 @@ public class InflatedSmartRepliesTest extends SysuiTestCase {
// suggestions.
setupAppGeneratedReplies(null /* smartReplies */);
ArrayList<Notification.Action> actions = new ArrayList<>();
- actions.add(createAction("allowed action", WHITELISTED_TEST_INTENT));
+ actions.add(createAction("allowed action", ALLOWLISTED_TEST_INTENT));
actions.add(createAction("non-allowed action", TEST_INTENT));
modifyRanking(mEntry)
@@ -379,7 +379,7 @@ public class InflatedSmartRepliesTest extends SysuiTestCase {
InflatedSmartReplyState smartReplyState =
mSmartReplyStateInflater.chooseSmartRepliesAndActions(mEntry);
- // Only the action for the whitelisted package should be allowed.
+ // Only the action for the allowlisted package should be allowed.
assertThat(smartReplyState.getSmartActions().actions)
.containsExactly(mEntry.getSmartActions().get(0));
assertThat(smartReplyState.getSuppressedActions()).isNull();
diff --git a/packages/WAPPushManager/tests/src/com/android/smspush/unitTests/WapPushTest.java b/packages/WAPPushManager/tests/src/com/android/smspush/unitTests/WapPushTest.java
index b9dac4e2b28e..c7abed887cac 100644
--- a/packages/WAPPushManager/tests/src/com/android/smspush/unitTests/WapPushTest.java
+++ b/packages/WAPPushManager/tests/src/com/android/smspush/unitTests/WapPushTest.java
@@ -2237,10 +2237,6 @@ public class WapPushTest extends ServiceTestCase<WapPushManager> {
mClassName = "com.android.smspush.unitTests.ReceiverActivity";
- // Phone dummy = new DummyPhone(getContext());
- // Phone gsm = PhoneFactory.getGsmPhone();
- // GSMPhone gsm = new GSMPhone(getContext(), new SimulatedCommands(), null, true);
- // WapPushOverSms dispatcher = new WapPushOverSms(dummy, null);
try {
// set up data
diff --git a/packages/WallpaperBackup/Android.bp b/packages/WallpaperBackup/Android.bp
index d142f25c6a62..840e99af045a 100644
--- a/packages/WallpaperBackup/Android.bp
+++ b/packages/WallpaperBackup/Android.bp
@@ -27,9 +27,6 @@ android_app {
name: "WallpaperBackup",
defaults: ["platform_app_defaults"],
srcs: ["src/**/*.java"],
- optimize: {
- proguard_flags_files: ["proguard.flags"],
- },
platform_apis: true,
certificate: "platform",
privileged: false,
diff --git a/packages/WallpaperBackup/proguard.flags b/packages/WallpaperBackup/proguard.flags
deleted file mode 100644
index 247e6efb10ef..000000000000
--- a/packages/WallpaperBackup/proguard.flags
+++ /dev/null
@@ -1 +0,0 @@
--keep class com.android.wallpaperbackup.WallpaperBackupAgent
diff --git a/packages/services/VirtualCamera/OWNERS b/packages/services/VirtualCamera/OWNERS
new file mode 100644
index 000000000000..c66443fb8a14
--- /dev/null
+++ b/packages/services/VirtualCamera/OWNERS
@@ -0,0 +1,3 @@
+include /services/companion/java/com/android/server/companion/virtual/OWNERS
+caen@google.com
+jsebechlebsky@google.com \ No newline at end of file
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index 9d91b9753691..3714bedba225 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -3960,14 +3960,14 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BIND_APPWIDGET, null);
} catch (SecurityException se) {
- if (!isCallerBindAppWidgetWhiteListedLocked(packageName)) {
+ if (!isCallerBindAppWidgetAllowListedLocked(packageName)) {
return false;
}
}
return true;
}
- private boolean isCallerBindAppWidgetWhiteListedLocked(String packageName) {
+ private boolean isCallerBindAppWidgetAllowListedLocked(String packageName) {
final int userId = UserHandle.getCallingUserId();
final int packageUid = getUidForPackage(packageName, userId);
if (packageUid < 0) {
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 20b2a74f5be5..7b3c330a9ee8 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -1351,7 +1351,7 @@ final class AutofillManagerServiceImpl
Slog.v(TAG, "setAugmentedAutofillWhitelistLocked(packages=" + packages + ", activities="
+ activities + ")");
}
- whitelistForAugmentedAutofillPackages(packages, activities);
+ allowlistForAugmentedAutofillPackages(packages, activities);
final String serviceName;
if (mRemoteAugmentedAutofillServiceInfo != null) {
serviceName = mRemoteAugmentedAutofillServiceInfo.getComponentName()
@@ -1415,7 +1415,7 @@ final class AutofillManagerServiceImpl
/**
* @throws IllegalArgumentException if packages or components are empty.
*/
- private void whitelistForAugmentedAutofillPackages(@Nullable List<String> packages,
+ private void allowlistForAugmentedAutofillPackages(@Nullable List<String> packages,
@Nullable List<ComponentName> components) {
// TODO(b/123100824): add CTS test for when it's null
synchronized (mLock) {
diff --git a/services/core/java/com/android/server/CertBlacklister.java b/services/core/java/com/android/server/CertBlacklister.java
index c16378be7342..e726c6abfac3 100644
--- a/services/core/java/com/android/server/CertBlacklister.java
+++ b/services/core/java/com/android/server/CertBlacklister.java
@@ -31,17 +31,17 @@ import java.io.IOException;
import libcore.io.IoUtils;
/**
- * <p>CertBlacklister provides a simple mechanism for updating the platform blacklists for SSL
+ * <p>CertBlacklister provides a simple mechanism for updating the platform denylists for SSL
* certificate public keys and serial numbers.
*/
public class CertBlacklister extends Binder {
private static final String TAG = "CertBlacklister";
- private static final String BLACKLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/";
+ private static final String DENYLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/";
- public static final String PUBKEY_PATH = BLACKLIST_ROOT + "pubkey_blacklist.txt";
- public static final String SERIAL_PATH = BLACKLIST_ROOT + "serial_blacklist.txt";
+ public static final String PUBKEY_PATH = DENYLIST_ROOT + "pubkey_blacklist.txt";
+ public static final String SERIAL_PATH = DENYLIST_ROOT + "serial_blacklist.txt";
public static final String PUBKEY_BLACKLIST_KEY = "pubkey_blacklist";
public static final String SERIAL_BLACKLIST_KEY = "serial_blacklist";
@@ -66,14 +66,14 @@ public class CertBlacklister extends Binder {
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
- writeBlacklist();
+ writeDenylist();
}
public String getValue() {
return Settings.Secure.getString(mContentResolver, mKey);
}
- private void writeBlacklist() {
+ private void writeDenylist() {
new Thread("BlacklistUpdater") {
public void run() {
synchronized(mTmpDir) {
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index a027e0410601..1da368eebdc8 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -75,6 +75,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IBatteryStats;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.HexDump;
+import com.android.modules.utils.build.SdkLevel;
import com.android.net.module.util.NetdUtils;
import com.android.net.module.util.NetdUtils.ModifyOperation;
import com.android.net.module.util.PermissionUtils;
@@ -779,7 +780,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public boolean getIpForwardingEnabled() throws IllegalStateException{
PermissionUtils.enforceNetworkStackPermission(mContext);
-
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException(
+ "NMS#getIpForwardingEnabled not supported in V+");
+ }
try {
return mNetdService.ipfwdEnabled();
} catch (RemoteException | ServiceSpecificException e) {
@@ -790,6 +794,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void setIpForwardingEnabled(boolean enable) {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException(
+ "NMS#setIpForwardingEnabled not supported in V+");
+ }
try {
if (enable) {
mNetdService.ipfwdEnableForwarding("tethering");
@@ -804,6 +812,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void startTethering(String[] dhcpRange) {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#startTethering not supported in V+");
+ }
try {
NetdUtils.tetherStart(mNetdService, true /* usingLegacyDnsProxy */, dhcpRange);
} catch (RemoteException | ServiceSpecificException e) {
@@ -814,6 +825,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void stopTethering() {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#stopTethering not supported in V+");
+ }
try {
mNetdService.tetherStop();
} catch (RemoteException | ServiceSpecificException e) {
@@ -824,6 +838,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public boolean isTetheringStarted() {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#isTetheringStarted not supported in V+");
+ }
try {
return mNetdService.tetherIsEnabled();
} catch (RemoteException | ServiceSpecificException e) {
@@ -834,6 +851,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void tetherInterface(String iface) {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#tetherInterface not supported in V+");
+ }
try {
final LinkAddress addr = getInterfaceConfig(iface).getLinkAddress();
final IpPrefix dest = new IpPrefix(addr.getAddress(), addr.getPrefixLength());
@@ -846,6 +866,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void untetherInterface(String iface) {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#untetherInterface not supported in V+");
+ }
try {
NetdUtils.untetherInterface(mNetdService, iface);
} catch (RemoteException | ServiceSpecificException e) {
@@ -856,6 +879,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public String[] listTetheredInterfaces() {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException(
+ "NMS#listTetheredInterfaces not supported in V+");
+ }
try {
return mNetdService.tetherInterfaceList();
} catch (RemoteException | ServiceSpecificException e) {
@@ -866,6 +893,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void enableNat(String internalInterface, String externalInterface) {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#enableNat not supported in V+");
+ }
try {
mNetdService.tetherAddForward(internalInterface, externalInterface);
} catch (RemoteException | ServiceSpecificException e) {
@@ -876,6 +906,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void disableNat(String internalInterface, String externalInterface) {
PermissionUtils.enforceNetworkStackPermission(mContext);
+ if (SdkLevel.isAtLeastV()) {
+ throw new UnsupportedOperationException("NMS#disableNat not supported in V+");
+ }
try {
mNetdService.tetherRemoveForward(internalInterface, externalInterface);
} catch (RemoteException | ServiceSpecificException e) {
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 08c71c3eae70..7f929604d684 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -736,6 +736,7 @@ class StorageManagerService extends IStorageManager.Stub
private static final int H_VOLUME_STATE_CHANGED = 15;
private static final int H_CLOUD_MEDIA_PROVIDER_CHANGED = 16;
private static final int H_SECURE_KEYGUARD_STATE_CHANGED = 17;
+ private static final int H_REMOUNT_VOLUMES_ON_MOVE = 18;
class StorageManagerServiceHandler extends Handler {
public StorageManagerServiceHandler(Looper looper) {
@@ -883,6 +884,10 @@ class StorageManagerService extends IStorageManager.Stub
}
break;
}
+ case H_REMOUNT_VOLUMES_ON_MOVE: {
+ remountVolumesForRunningUsersOnMove();
+ break;
+ }
}
}
}
@@ -1372,6 +1377,44 @@ class StorageManagerService extends IStorageManager.Stub
}
}
+ /**
+ * This method informs vold and storaged that the user has stopped and started whenever move
+ * storage is performed. This ensures that the correct emulated volumes are mounted for the
+ * users other than the current user. This solves an edge case wherein the correct emulated
+ * volumes are not mounted, this will cause the media data to be still stored on internal
+ * storage whereas the data should be stored in the adopted primary storage. This method stops
+ * the users at vold first which will remove the old volumes which and starts the users at vold
+ * which will reattach the correct volumes. This does not performs a full reset as full reset
+ * clears every state from vold and SMS {@link #resetIfRebootedAndConnected} which is expensive
+ * and causes instability.
+ */
+ private void remountVolumesForRunningUsersOnMove() {
+ // Do not want to hold the lock for long
+ final List<Integer> unlockedUsers = new ArrayList<>();
+ synchronized (mLock) {
+ for (int userId : mSystemUnlockedUsers) {
+ if (userId == mCurrentUserId) continue;
+ unlockedUsers.add(userId);
+ }
+ }
+ for (Integer userId : unlockedUsers) {
+ try {
+ mVold.onUserStopped(userId);
+ mStoraged.onUserStopped(userId);
+ } catch (Exception e) {
+ Slog.wtf(TAG, e);
+ }
+ }
+ for (Integer userId : unlockedUsers) {
+ try {
+ mVold.onUserStarted(userId);
+ mStoraged.onUserStarted(userId);
+ } catch (Exception e) {
+ Slog.wtf(TAG, e);
+ }
+ }
+ }
+
private boolean supportsBlockCheckpoint() throws RemoteException {
enforcePermission(android.Manifest.permission.MOUNT_FORMAT_FILESYSTEMS);
return mVold.supportsBlockCheckpoint();
@@ -1907,6 +1950,7 @@ class StorageManagerService extends IStorageManager.Stub
mPrimaryStorageUuid = mMoveTargetUuid;
writeSettingsLocked();
+ mHandler.obtainMessage(H_REMOUNT_VOLUMES_ON_MOVE).sendToTarget();
}
if (PackageManager.isMoveStatusFinished(status)) {
diff --git a/services/core/java/com/android/server/TEST_MAPPING b/services/core/java/com/android/server/TEST_MAPPING
index 4b00aca88207..ada63c661a6f 100644
--- a/services/core/java/com/android/server/TEST_MAPPING
+++ b/services/core/java/com/android/server/TEST_MAPPING
@@ -61,6 +61,15 @@
{
"name": "CtsVcnTestCases",
"file_patterns": ["VcnManagementService\\.java"]
+ },
+ {
+ "name": "FrameworksNetTests",
+ "options": [
+ {
+ "exclude-annotation": "com.android.testutils.SkipPresubmit"
+ }
+ ],
+ "file_patterns": ["VpnManagerService\\.java"]
}
],
"presubmit-large": [
@@ -78,6 +87,21 @@
}
],
"file_patterns": ["ClipboardService\\.java"]
+ },
+ {
+ "name": "CtsHostsideNetworkTests",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ },
+ {
+ "exclude-annotation": "android.platform.test.annotations.FlakyTest"
+ },
+ {
+ "exclude-annotation": "com.android.testutils.SkipPresubmit"
+ }
+ ],
+ "file_patterns": ["VpnManagerService\\.java"]
}
],
"postsubmit": [
diff --git a/services/core/java/com/android/server/VcnManagementService.java b/services/core/java/com/android/server/VcnManagementService.java
index c6e9a7d5e2e5..7acca19f9d79 100644
--- a/services/core/java/com/android/server/VcnManagementService.java
+++ b/services/core/java/com/android/server/VcnManagementService.java
@@ -456,7 +456,13 @@ public class VcnManagementService extends IVcnManagementService.Stub {
final List<SubscriptionInfo> subscriptionInfos = new ArrayList<>();
Binder.withCleanCallingIdentity(
() -> {
- subscriptionInfos.addAll(subMgr.getSubscriptionsInGroup(subscriptionGroup));
+ List<SubscriptionInfo> subsInGroup =
+ subMgr.getSubscriptionsInGroup(subscriptionGroup);
+ if (subsInGroup == null) {
+ logWtf("Received null from getSubscriptionsInGroup");
+ subsInGroup = Collections.emptyList();
+ }
+ subscriptionInfos.addAll(subsInGroup);
});
for (SubscriptionInfo info : subscriptionInfos) {
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index c17d2c8ad82b..1ad2420ed203 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -1941,7 +1941,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
if (btSCoOn) {
// Use the SCO device known to BtHelper so that it matches exactly
// what has been communicated to audio policy manager. The device
- // returned by requestedCommunicationDevice() can be a dummy SCO device if legacy
+ // returned by requestedCommunicationDevice() can be a placeholder SCO device if legacy
// APIs are used to start SCO audio.
AudioDeviceAttributes device = mBtHelper.getHeadsetAudioDevice();
if (device != null) {
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 4c234a0839e2..7e9c253f622e 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -146,6 +146,7 @@ import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ResultReceiver;
+import android.os.ServiceDebugInfo;
import android.os.ServiceManager;
import android.os.ShellCallback;
import android.os.SystemClock;
@@ -12322,12 +12323,25 @@ public class AudioService extends IAudioService.Stub
private static final String AUDIO_HAL_SERVICE_PREFIX = "android.hardware.audio";
- private Set<Integer> getAudioHalPids() {
+ private void getAudioAidlHalPids(HashSet<Integer> pids) {
+ try {
+ ServiceDebugInfo[] infos = ServiceManager.getServiceDebugInfo();
+ if (infos == null) return;
+ for (ServiceDebugInfo info : infos) {
+ if (info.debugPid > 0 && info.name.startsWith(AUDIO_HAL_SERVICE_PREFIX)) {
+ pids.add(info.debugPid);
+ }
+ }
+ } catch (RuntimeException e) {
+ // ignored, pid hashset does not change
+ }
+ }
+
+ private void getAudioHalHidlPids(HashSet<Integer> pids) {
try {
IServiceManager serviceManager = IServiceManager.getService();
ArrayList<IServiceManager.InstanceDebugInfo> dump =
serviceManager.debugDump();
- HashSet<Integer> pids = new HashSet<>();
for (IServiceManager.InstanceDebugInfo info : dump) {
if (info.pid != IServiceManager.PidConstant.NO_PID
&& info.interfaceName != null
@@ -12335,12 +12349,18 @@ public class AudioService extends IAudioService.Stub
pids.add(info.pid);
}
}
- return pids;
} catch (RemoteException | RuntimeException e) {
- return new HashSet<Integer>();
+ // ignored, pid hashset does not change
}
}
+ private Set<Integer> getAudioHalPids() {
+ HashSet<Integer> pids = new HashSet<>();
+ getAudioAidlHalPids(pids);
+ getAudioHalHidlPids(pids);
+ return pids;
+ }
+
private void updateAudioHalPids() {
Set<Integer> pidsSet = getAudioHalPids();
if (pidsSet.isEmpty()) {
diff --git a/services/core/java/com/android/server/connectivity/TEST_MAPPING b/services/core/java/com/android/server/connectivity/TEST_MAPPING
new file mode 100644
index 000000000000..687d4b06b4c0
--- /dev/null
+++ b/services/core/java/com/android/server/connectivity/TEST_MAPPING
@@ -0,0 +1,30 @@
+{
+ "presubmit": [
+ {
+ "name": "FrameworksNetTests",
+ "options": [
+ {
+ "exclude-annotation": "com.android.testutils.SkipPresubmit"
+ }
+ ],
+ "file_patterns": ["Vpn\\.java", "VpnIkeV2Utils\\.java", "VpnProfileStore\\.java"]
+ }
+ ],
+ "presubmit-large": [
+ {
+ "name": "CtsHostsideNetworkTests",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ },
+ {
+ "exclude-annotation": "android.platform.test.annotations.FlakyTest"
+ },
+ {
+ "exclude-annotation": "com.android.testutils.SkipPresubmit"
+ }
+ ],
+ "file_patterns": ["Vpn\\.java", "VpnIkeV2Utils\\.java", "VpnProfileStore\\.java"]
+ }
+ ]
+} \ No newline at end of file
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index cba5039f714d..bfccd58b3f5d 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -3066,7 +3066,8 @@ public class Vpn {
* <p>This variable controls the retry delay, and is reset when the VPN pass network
* validation.
*/
- private int mValidationFailRetryCount = 0;
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+ int mValidationFailRetryCount = 0;
/**
* The number of attempts since the last successful connection.
@@ -3296,13 +3297,6 @@ public class Vpn {
}
agentConnect(this::onValidationStatus);
return; // Link properties are already sent.
- } else {
- // Underlying networks also set in agentConnect()
- doSetUnderlyingNetworks(networkAgent, Collections.singletonList(network));
- mNetworkCapabilities =
- new NetworkCapabilities.Builder(mNetworkCapabilities)
- .setUnderlyingNetworks(Collections.singletonList(network))
- .build();
}
lp = makeLinkProperties(); // Accesses VPN instance fields; must be locked
@@ -3384,8 +3378,6 @@ public class Vpn {
final LinkProperties oldLp = makeLinkProperties();
- final boolean underlyingNetworkHasChanged =
- !Arrays.equals(mConfig.underlyingNetworks, new Network[]{network});
mConfig.underlyingNetworks = new Network[] {network};
mConfig.mtu = calculateVpnMtu();
@@ -3417,18 +3409,9 @@ public class Vpn {
removed.getAddress(), removed.getPrefixLength());
}
} else {
- // Put below 3 updates into else block is because agentConnect() will do
- // those things, so there is no need to do the redundant work.
+ // Put below update into else block is because agentConnect() will do
+ // the same things, so there is no need to do the redundant work.
if (!newLp.equals(oldLp)) doSendLinkProperties(mNetworkAgent, newLp);
- if (underlyingNetworkHasChanged) {
- mNetworkCapabilities =
- new NetworkCapabilities.Builder(mNetworkCapabilities)
- .setUnderlyingNetworks(
- Collections.singletonList(network))
- .build();
- doSetUnderlyingNetworks(mNetworkAgent,
- Collections.singletonList(network));
- }
}
}
@@ -3554,10 +3537,28 @@ public class Vpn {
*/
private void startOrMigrateIkeSession(@Nullable Network underlyingNetwork) {
if (underlyingNetwork == null) {
+ // For null underlyingNetwork case, there will not be a NetworkAgent available so
+ // no underlying network update is necessary here. Note that updating
+ // mNetworkCapabilities here would also be reasonable, but it will be updated next
+ // time the VPN connects anyway.
Log.d(TAG, "There is no active network for starting an IKE session");
return;
}
+ final List<Network> networks = Collections.singletonList(underlyingNetwork);
+ // Update network capabilities if underlying network is changed.
+ if (!networks.equals(mNetworkCapabilities.getUnderlyingNetworks())) {
+ mNetworkCapabilities =
+ new NetworkCapabilities.Builder(mNetworkCapabilities)
+ .setUnderlyingNetworks(networks)
+ .build();
+ // No NetworkAgent case happens when Vpn tries to start a new VPN. The underlying
+ // network update will be done later with NetworkAgent connected event.
+ if (mNetworkAgent != null) {
+ doSetUnderlyingNetworks(mNetworkAgent, networks);
+ }
+ }
+
if (maybeMigrateIkeSessionAndUpdateVpnTransportInfo(underlyingNetwork)) return;
startIkeSession(underlyingNetwork);
@@ -3897,6 +3898,18 @@ public class Vpn {
// Skip other invalid status if the scheduled recovery exists.
if (mScheduledHandleDataStallFuture != null) return;
+ // Trigger network validation on the underlying network to possibly cause system
+ // switch default network or try recover if the current default network is broken.
+ //
+ // For the same underlying network, the first validation result should clarify if
+ // it's caused by broken underlying network. So only perform underlying network
+ // re-evaluation after first validation failure to prevent extra network resource
+ // costs on sending probes.
+ if (mValidationFailRetryCount == 0) {
+ mConnectivityManager.reportNetworkConnectivity(
+ mActiveNetwork, false /* hasConnectivity */);
+ }
+
if (mValidationFailRetryCount < MAX_MOBIKE_RECOVERY_ATTEMPT) {
Log.d(TAG, "Validation failed");
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index eb81e70363d4..7df66e6521a5 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -714,7 +714,7 @@ public class SyncManager {
// This can be noisy, therefore we will allowlist sync adapters installed
// before we started checking for account access because they already know
// the account (they run before) which is the genie is out of the bottle.
- whiteListExistingSyncAdaptersIfNeeded();
+ allowListExistingSyncAdaptersIfNeeded();
mLogger.log("Sync manager initialized: " + Build.FINGERPRINT);
}
@@ -755,7 +755,7 @@ public class SyncManager {
}
}
- private void whiteListExistingSyncAdaptersIfNeeded() {
+ private void allowListExistingSyncAdaptersIfNeeded() {
if (!mSyncStorageEngine.shouldGrantSyncAdaptersAccountAccess()) {
return;
}
diff --git a/services/core/java/com/android/server/content/SyncManagerConstants.java b/services/core/java/com/android/server/content/SyncManagerConstants.java
index 2a5858c3e182..409b469dc6bf 100644
--- a/services/core/java/com/android/server/content/SyncManagerConstants.java
+++ b/services/core/java/com/android/server/content/SyncManagerConstants.java
@@ -52,11 +52,11 @@ public class SyncManagerConstants extends ContentObserver {
private static final int DEF_MAX_RETRIES_WITH_APP_STANDBY_EXEMPTION = 5;
private int mMaxRetriesWithAppStandbyExemption = DEF_MAX_RETRIES_WITH_APP_STANDBY_EXEMPTION;
- private static final String KEY_EXEMPTION_TEMP_WHITELIST_DURATION_IN_SECONDS =
+ private static final String KEY_EXEMPTION_TEMP_ALLOWLIST_DURATION_IN_SECONDS =
"exemption_temp_whitelist_duration_in_seconds";
- private static final int DEF_EXEMPTION_TEMP_WHITELIST_DURATION_IN_SECONDS = 10 * 60;
+ private static final int DEF_EXEMPTION_TEMP_ALLOWLIST_DURATION_IN_SECONDS = 10 * 60;
private int mKeyExemptionTempWhitelistDurationInSeconds
- = DEF_EXEMPTION_TEMP_WHITELIST_DURATION_IN_SECONDS;
+ = DEF_EXEMPTION_TEMP_ALLOWLIST_DURATION_IN_SECONDS;
protected SyncManagerConstants(Context context) {
super(null);
@@ -105,8 +105,8 @@ public class SyncManagerConstants extends ContentObserver {
DEF_MAX_RETRIES_WITH_APP_STANDBY_EXEMPTION);
mKeyExemptionTempWhitelistDurationInSeconds = parser.getInt(
- KEY_EXEMPTION_TEMP_WHITELIST_DURATION_IN_SECONDS,
- DEF_EXEMPTION_TEMP_WHITELIST_DURATION_IN_SECONDS);
+ KEY_EXEMPTION_TEMP_ALLOWLIST_DURATION_IN_SECONDS,
+ DEF_EXEMPTION_TEMP_ALLOWLIST_DURATION_IN_SECONDS);
}
}
diff --git a/services/core/java/com/android/server/display/WifiDisplayController.java b/services/core/java/com/android/server/display/WifiDisplayController.java
index cd36dd02a8c6..04ae13f2e2cc 100644
--- a/services/core/java/com/android/server/display/WifiDisplayController.java
+++ b/services/core/java/com/android/server/display/WifiDisplayController.java
@@ -1062,8 +1062,10 @@ final class WifiDisplayController implements DumpUtils.Dump {
}
private static WifiDisplay createWifiDisplay(WifiP2pDevice device) {
+ WifiP2pWfdInfo wfdInfo = device.getWfdInfo();
+ boolean isSessionAvailable = wfdInfo != null && wfdInfo.isSessionAvailable();
return new WifiDisplay(device.deviceAddress, device.deviceName, null,
- true, device.getWfdInfo().isSessionAvailable(), false);
+ true, isSessionAvailable, false);
}
private final BroadcastReceiver mWifiP2pReceiver = new BroadcastReceiver() {
diff --git a/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java b/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
index 025ccd172ea9..8d4eff9e157c 100644
--- a/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
+++ b/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
@@ -725,7 +725,7 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub {
}
private String getCallingRulePusherPackageName(int callingUid) {
- // Obtain the system apps that are whitelisted in config_integrityRuleProviderPackages.
+ // Obtain the system apps that are allowlisted in config_integrityRuleProviderPackages.
List<String> allowedRuleProviders = getAllowedRuleProviderSystemApps();
if (DEBUG_INTEGRITY_COMPONENT) {
Slog.i(
diff --git a/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java b/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java
index a54047665aba..ac762f5abe09 100644
--- a/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java
+++ b/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java
@@ -189,10 +189,10 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
this::onProviderEnabledChanged;
private final SettingsHelper.GlobalSettingChangedListener
mBackgroundThrottlePackageWhitelistChangedListener =
- this::onBackgroundThrottlePackageWhitelistChanged;
+ this::onBackgroundThrottlePackageAllowlistChanged;
private final SettingsHelper.UserSettingChangedListener
mLocationPackageBlacklistChangedListener =
- this::onLocationPackageBlacklistChanged;
+ this::onLocationPackageDenylistChanged;
private final LocationPermissionsHelper.LocationPermissionsListener
mLocationPermissionsListener =
new LocationPermissionsHelper.LocationPermissionsListener() {
@@ -382,11 +382,11 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
updateRegistrations(registration -> registration.getIdentity().getUserId() == userId);
}
- private void onBackgroundThrottlePackageWhitelistChanged() {
+ private void onBackgroundThrottlePackageAllowlistChanged() {
updateRegistrations(registration -> true);
}
- private void onLocationPackageBlacklistChanged(int userId) {
+ private void onLocationPackageDenylistChanged(int userId) {
updateRegistrations(registration -> registration.getIdentity().getUserId() == userId);
}
diff --git a/services/core/java/com/android/server/location/injector/SettingsHelper.java b/services/core/java/com/android/server/location/injector/SettingsHelper.java
index 490bfe1ab82f..32cbff8d50c7 100644
--- a/services/core/java/com/android/server/location/injector/SettingsHelper.java
+++ b/services/core/java/com/android/server/location/injector/SettingsHelper.java
@@ -93,37 +93,37 @@ public abstract class SettingsHelper {
GlobalSettingChangedListener listener);
/**
- * Check if the given package is blacklisted for location access.
+ * Check if the given package is denylisted for location access.
*/
public abstract boolean isLocationPackageBlacklisted(int userId, String packageName);
/**
- * Add a listener for changes to the location package blacklist. Callbacks occur on an
+ * Add a listener for changes to the location package denylist. Callbacks occur on an
* unspecified thread.
*/
public abstract void addOnLocationPackageBlacklistChangedListener(
UserSettingChangedListener listener);
/**
- * Remove a listener for changes to the location package blacklist.
+ * Remove a listener for changes to the location package denylist.
*/
public abstract void removeOnLocationPackageBlacklistChangedListener(
UserSettingChangedListener listener);
/**
- * Retrieve the background throttle package whitelist.
+ * Retrieve the background throttle package allowlist.
*/
public abstract Set<String> getBackgroundThrottlePackageWhitelist();
/**
- * Add a listener for changes to the background throttle package whitelist. Callbacks occur on
+ * Add a listener for changes to the background throttle package allowlist. Callbacks occur on
* an unspecified thread.
*/
public abstract void addOnBackgroundThrottlePackageWhitelistChangedListener(
GlobalSettingChangedListener listener);
/**
- * Remove a listener for changes to the background throttle package whitelist.
+ * Remove a listener for changes to the background throttle package allowlist.
*/
public abstract void removeOnBackgroundThrottlePackageWhitelistChangedListener(
GlobalSettingChangedListener listener);
@@ -134,14 +134,14 @@ public abstract class SettingsHelper {
public abstract boolean isGnssMeasurementsFullTrackingEnabled();
/**
- * Add a listener for changes to the background throttle package whitelist. Callbacks occur on
+ * Add a listener for changes to the background throttle package allowlist. Callbacks occur on
* an unspecified thread.
*/
public abstract void addOnGnssMeasurementsFullTrackingEnabledChangedListener(
GlobalSettingChangedListener listener);
/**
- * Remove a listener for changes to the background throttle package whitelist.
+ * Remove a listener for changes to the background throttle package allowlist.
*/
public abstract void removeOnGnssMeasurementsFullTrackingEnabledChangedListener(
GlobalSettingChangedListener listener);
@@ -166,14 +166,14 @@ public abstract class SettingsHelper {
public abstract PackageTagsList getIgnoreSettingsAllowlist();
/**
- * Add a listener for changes to the ignore settings package whitelist. Callbacks occur on an
+ * Add a listener for changes to the ignore settings package allowlist. Callbacks occur on an
* unspecified thread.
*/
public abstract void addIgnoreSettingsAllowlistChangedListener(
GlobalSettingChangedListener listener);
/**
- * Remove a listener for changes to the ignore settings package whitelist.
+ * Remove a listener for changes to the ignore settings package allowlist.
*/
public abstract void removeIgnoreSettingsAllowlistChangedListener(
GlobalSettingChangedListener listener);
diff --git a/services/core/java/com/android/server/location/injector/SystemSettingsHelper.java b/services/core/java/com/android/server/location/injector/SystemSettingsHelper.java
index 777683ef59cf..8bb184c43ebb 100644
--- a/services/core/java/com/android/server/location/injector/SystemSettingsHelper.java
+++ b/services/core/java/com/android/server/location/injector/SystemSettingsHelper.java
@@ -65,8 +65,8 @@ import java.util.function.Supplier;
*/
public class SystemSettingsHelper extends SettingsHelper {
- private static final String LOCATION_PACKAGE_BLACKLIST = "locationPackagePrefixBlacklist";
- private static final String LOCATION_PACKAGE_WHITELIST = "locationPackagePrefixWhitelist";
+ private static final String LOCATION_PACKAGE_DENYLIST = "locationPackagePrefixBlacklist";
+ private static final String LOCATION_PACKAGE_ALLOWLIST = "locationPackagePrefixWhitelist";
private static final long DEFAULT_BACKGROUND_THROTTLE_INTERVAL_MS = 30 * 60 * 1000;
private static final long DEFAULT_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS =
@@ -93,9 +93,9 @@ public class SystemSettingsHelper extends SettingsHelper {
mGnssMeasurementFullTracking = new BooleanGlobalSetting(context,
ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, FgThread.getHandler());
mLocationPackageBlacklist = new StringListCachedSecureSetting(context,
- LOCATION_PACKAGE_BLACKLIST, FgThread.getHandler());
+ LOCATION_PACKAGE_DENYLIST, FgThread.getHandler());
mLocationPackageWhitelist = new StringListCachedSecureSetting(context,
- LOCATION_PACKAGE_WHITELIST, FgThread.getHandler());
+ LOCATION_PACKAGE_ALLOWLIST, FgThread.getHandler());
mBackgroundThrottlePackageWhitelist = new StringSetCachedGlobalSetting(context,
LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
() -> SystemConfig.getInstance().getAllowUnthrottledLocation(),
diff --git a/services/core/java/com/android/server/net/NetworkPolicyLogger.java b/services/core/java/com/android/server/net/NetworkPolicyLogger.java
index dc8fcb077f61..85731651dd59 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyLogger.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyLogger.java
@@ -338,8 +338,8 @@ public class NetworkPolicyLogger {
return "App idle state of uid " + uid + ": " + idle;
}
- private static String getAppIdleWlChangedLog(int uid, boolean isWhitelisted) {
- return "App idle whitelist state of uid " + uid + ": " + isWhitelisted;
+ private static String getAppIdleWlChangedLog(int uid, boolean isAllowlisted) {
+ return "App idle whitelist state of uid " + uid + ": " + isAllowlisted;
}
private static String getParoleStateChanged(boolean paroleOn) {
@@ -519,14 +519,14 @@ public class NetworkPolicyLogger {
data.timeStamp = System.currentTimeMillis();
}
- public void appIdleWlChanged(int uid, boolean isWhitelisted) {
+ public void appIdleWlChanged(int uid, boolean isAllowlisted) {
final Data data = getNextSlot();
if (data == null) return;
data.reset();
data.type = EVENT_APP_IDLE_WL_CHANGED;
data.ifield1 = uid;
- data.bfield1 = isWhitelisted;
+ data.bfield1 = isAllowlisted;
data.timeStamp = System.currentTimeMillis();
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index d2853370fa69..6eaf24abba7e 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -362,7 +362,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private static final String TAG_NETWORK_POLICY = "network-policy";
private static final String TAG_UID_POLICY = "uid-policy";
private static final String TAG_APP_POLICY = "app-policy";
- private static final String TAG_WHITELIST = "whitelist";
+ private static final String TAG_ALLOWLIST = "whitelist";
private static final String TAG_RESTRICT_BACKGROUND = "restrict-background";
private static final String TAG_REVOKED_RESTRICT_BACKGROUND = "revoked-restrict-background";
private static final String TAG_XML_UTILS_INT_ARRAY = "int-array";
@@ -856,7 +856,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
@GuardedBy("mUidRulesFirstLock")
- private void updatePowerSaveWhitelistUL() {
+ private void updatePowerSaveAllowlistUL() {
int[] whitelist = mPowerWhitelistManager.getWhitelistedAppIds(/* includingIdle */ false);
mPowerSaveWhitelistExceptIdleAppIds.clear();
for (int uid : whitelist) {
@@ -947,7 +947,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
synchronized (mUidRulesFirstLock) {
synchronized (mNetworkPoliciesSecondLock) {
- updatePowerSaveWhitelistUL();
+ updatePowerSaveAllowlistUL();
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
mPowerManagerInternal.registerLowPowerModeObserver(
new PowerManagerInternal.LowPowerModeListener() {
@@ -1189,7 +1189,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
public void onReceive(Context context, Intent intent) {
// on background handler thread, and POWER_SAVE_WHITELIST_CHANGED is protected
synchronized (mUidRulesFirstLock) {
- updatePowerSaveWhitelistUL();
+ updatePowerSaveAllowlistUL();
updateRulesForRestrictPowerUL();
updateRulesForAppIdleUL();
}
@@ -2679,7 +2679,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
} else {
Slog.w(TAG, "unable to apply policy to UID " + uid + "; ignoring");
}
- } else if (TAG_WHITELIST.equals(tag)) {
+ } else if (TAG_ALLOWLIST.equals(tag)) {
insideAllowlist = true;
} else if (TAG_RESTRICT_BACKGROUND.equals(tag) && insideAllowlist) {
final int uid = readIntAttribute(in, ATTR_UID);
@@ -2689,7 +2689,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
mRestrictBackgroundAllowlistRevokedUids.put(uid, true);
}
} else if (type == END_TAG) {
- if (TAG_WHITELIST.equals(tag)) {
+ if (TAG_ALLOWLIST.equals(tag)) {
insideAllowlist = false;
}
@@ -2865,7 +2865,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
out.endTag(null, TAG_POLICY_LIST);
// write all allowlists
- out.startTag(null, TAG_WHITELIST);
+ out.startTag(null, TAG_ALLOWLIST);
// revoked restrict background allowlist
int size = mRestrictBackgroundAllowlistRevokedUids.size();
@@ -2876,7 +2876,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
out.endTag(null, TAG_REVOKED_RESTRICT_BACKGROUND);
}
- out.endTag(null, TAG_WHITELIST);
+ out.endTag(null, TAG_ALLOWLIST);
out.endDocument();
@@ -4356,7 +4356,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
void updateRulesForPowerSaveUL() {
Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForPowerSaveUL");
try {
- updateRulesForWhitelistedPowerSaveUL(mRestrictPower, FIREWALL_CHAIN_POWERSAVE,
+ updateRulesForAllowlistedPowerSaveUL(mRestrictPower, FIREWALL_CHAIN_POWERSAVE,
mUidFirewallPowerSaveRules);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_NETWORK);
@@ -4365,14 +4365,14 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
@GuardedBy("mUidRulesFirstLock")
void updateRuleForRestrictPowerUL(int uid) {
- updateRulesForWhitelistedPowerSaveUL(uid, mRestrictPower, FIREWALL_CHAIN_POWERSAVE);
+ updateRulesForAllowlistedPowerSaveUL(uid, mRestrictPower, FIREWALL_CHAIN_POWERSAVE);
}
@GuardedBy("mUidRulesFirstLock")
void updateRulesForDeviceIdleUL() {
Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForDeviceIdleUL");
try {
- updateRulesForWhitelistedPowerSaveUL(mDeviceIdleMode, FIREWALL_CHAIN_DOZABLE,
+ updateRulesForAllowlistedPowerSaveUL(mDeviceIdleMode, FIREWALL_CHAIN_DOZABLE,
mUidFirewallDozableRules);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_NETWORK);
@@ -4381,26 +4381,26 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
@GuardedBy("mUidRulesFirstLock")
void updateRuleForDeviceIdleUL(int uid) {
- updateRulesForWhitelistedPowerSaveUL(uid, mDeviceIdleMode, FIREWALL_CHAIN_DOZABLE);
+ updateRulesForAllowlistedPowerSaveUL(uid, mDeviceIdleMode, FIREWALL_CHAIN_DOZABLE);
}
// NOTE: since both fw_dozable and fw_powersave uses the same map
// (mPowerSaveTempWhitelistAppIds) for allowlisting, we can reuse their logic in this method.
@GuardedBy("mUidRulesFirstLock")
- private void updateRulesForWhitelistedPowerSaveUL(boolean enabled, int chain,
+ private void updateRulesForAllowlistedPowerSaveUL(boolean enabled, int chain,
SparseIntArray rules) {
if (enabled) {
- // Sync the whitelists before enabling the chain. We don't care about the rules if
+ // Sync the allowlists before enabling the chain. We don't care about the rules if
// we are disabling the chain.
final SparseIntArray uidRules = rules;
uidRules.clear();
final List<UserInfo> users = mUserManager.getUsers();
for (int ui = users.size() - 1; ui >= 0; ui--) {
UserInfo user = users.get(ui);
- updateRulesForWhitelistedAppIds(uidRules, mPowerSaveTempWhitelistAppIds, user.id);
- updateRulesForWhitelistedAppIds(uidRules, mPowerSaveWhitelistAppIds, user.id);
+ updateRulesForAllowlistedAppIds(uidRules, mPowerSaveTempWhitelistAppIds, user.id);
+ updateRulesForAllowlistedAppIds(uidRules, mPowerSaveWhitelistAppIds, user.id);
if (chain == FIREWALL_CHAIN_POWERSAVE) {
- updateRulesForWhitelistedAppIds(uidRules,
+ updateRulesForAllowlistedAppIds(uidRules,
mPowerSaveWhitelistExceptIdleAppIds, user.id);
}
}
@@ -4415,7 +4415,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
}
- private void updateRulesForWhitelistedAppIds(final SparseIntArray uidRules,
+ private void updateRulesForAllowlistedAppIds(final SparseIntArray uidRules,
final SparseBooleanArray whitelistedAppIds, int userId) {
for (int i = whitelistedAppIds.size() - 1; i >= 0; --i) {
if (whitelistedAppIds.valueAt(i)) {
@@ -4476,12 +4476,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
* allowlisted.
*/
@GuardedBy("mUidRulesFirstLock")
- private boolean isWhitelistedFromPowerSaveUL(int uid, boolean deviceIdleMode) {
+ private boolean isAllowlistedFromPowerSaveUL(int uid, boolean deviceIdleMode) {
final int appId = UserHandle.getAppId(uid);
boolean isWhitelisted = mPowerSaveTempWhitelistAppIds.get(appId)
|| mPowerSaveWhitelistAppIds.get(appId);
if (!deviceIdleMode) {
- isWhitelisted = isWhitelisted || isWhitelistedFromPowerSaveExceptIdleUL(uid);
+ isWhitelisted = isWhitelisted || isAllowlistedFromPowerSaveExceptIdleUL(uid);
}
return isWhitelisted;
}
@@ -4491,7 +4491,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
* (eg: Battery Saver and app idle).
*/
@GuardedBy("mUidRulesFirstLock")
- private boolean isWhitelistedFromPowerSaveExceptIdleUL(int uid) {
+ private boolean isAllowlistedFromPowerSaveExceptIdleUL(int uid) {
final int appId = UserHandle.getAppId(uid);
return mPowerSaveWhitelistExceptIdleAppIds.get(appId);
}
@@ -4507,9 +4507,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
// NOTE: since both fw_dozable and fw_powersave uses the same map
// (mPowerSaveTempWhitelistAppIds) for allowlisting, we can reuse their logic in this method.
@GuardedBy("mUidRulesFirstLock")
- private void updateRulesForWhitelistedPowerSaveUL(int uid, boolean enabled, int chain) {
+ private void updateRulesForAllowlistedPowerSaveUL(int uid, boolean enabled, int chain) {
if (enabled) {
- final boolean isWhitelisted = isWhitelistedFromPowerSaveUL(uid,
+ final boolean isWhitelisted = isAllowlistedFromPowerSaveUL(uid,
chain == FIREWALL_CHAIN_DOZABLE);
if (isWhitelisted || isUidForegroundOnRestrictPowerUL(uid)) {
setUidFirewallRuleUL(chain, uid, FIREWALL_RULE_ALLOW);
@@ -4767,7 +4767,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
@GuardedBy("mUidRulesFirstLock")
- private void updateRulesForTempWhitelistChangeUL(int appId) {
+ private void updateRulesForTempAllowlistChangeUL(int appId) {
final List<UserInfo> users = mUserManager.getUsers();
final int numUsers = users.size();
for (int i = 0; i < numUsers; i++) {
@@ -5158,7 +5158,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final boolean isForeground = isUidForegroundOnRestrictPowerUL(uid);
final boolean isTop = isUidTop(uid);
- final boolean isWhitelisted = isWhitelistedFromPowerSaveUL(uid, mDeviceIdleMode);
+ final boolean isWhitelisted = isAllowlistedFromPowerSaveUL(uid, mDeviceIdleMode);
final int oldEffectiveBlockedReasons;
final int newEffectiveBlockedReasons;
@@ -5181,9 +5181,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
newAllowedReasons |= (isSystem(uid) ? ALLOWED_REASON_SYSTEM : 0);
newAllowedReasons |= (isForeground ? ALLOWED_REASON_FOREGROUND : 0);
newAllowedReasons |= (isTop ? ALLOWED_REASON_TOP : 0);
- newAllowedReasons |= (isWhitelistedFromPowerSaveUL(uid, true)
+ newAllowedReasons |= (isAllowlistedFromPowerSaveUL(uid, true)
? ALLOWED_REASON_POWER_SAVE_ALLOWLIST : 0);
- newAllowedReasons |= (isWhitelistedFromPowerSaveExceptIdleUL(uid)
+ newAllowedReasons |= (isAllowlistedFromPowerSaveExceptIdleUL(uid)
? ALLOWED_REASON_POWER_SAVE_EXCEPT_IDLE_ALLOWLIST : 0);
newAllowedReasons |= (uidBlockedState.allowedReasons
& ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS);
@@ -6095,7 +6095,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
} else {
mPowerSaveTempWhitelistAppIds.delete(appId);
}
- updateRulesForTempWhitelistChangeUL(appId);
+ updateRulesForTempAllowlistChangeUL(appId);
}
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java b/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java
index 47bb8f009920..34c8a0d19e23 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java
@@ -154,13 +154,13 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
}
switch(type) {
case "app-idle-whitelist":
- return listAppIdleWhitelist();
+ return listAppIdleAllowlist();
case "wifi-networks":
return listWifiNetworks();
case "restrict-background-whitelist":
- return listRestrictBackgroundWhitelist();
+ return listRestrictBackgroundAllowlist();
case "restrict-background-blacklist":
- return listRestrictBackgroundBlacklist();
+ return listRestrictBackgroundDenylist();
}
pw.println("Error: unknown list type '" + type + "'");
return -1;
@@ -175,11 +175,11 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
}
switch(type) {
case "restrict-background-whitelist":
- return addRestrictBackgroundWhitelist();
+ return addRestrictBackgroundAllowlist();
case "restrict-background-blacklist":
- return addRestrictBackgroundBlacklist();
+ return addRestrictBackgroundDenylist();
case "app-idle-whitelist":
- return addAppIdleWhitelist();
+ return addAppIdleAllowlist();
}
pw.println("Error: unknown add type '" + type + "'");
return -1;
@@ -194,11 +194,11 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
}
switch(type) {
case "restrict-background-whitelist":
- return removeRestrictBackgroundWhitelist();
+ return removeRestrictBackgroundAllowlist();
case "restrict-background-blacklist":
- return removeRestrictBackgroundBlacklist();
+ return removeRestrictBackgroundDenylist();
case "app-idle-whitelist":
- return removeAppIdleWhitelist();
+ return removeAppIdleAllowlist();
}
pw.println("Error: unknown remove type '" + type + "'");
return -1;
@@ -241,17 +241,17 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
return 0;
}
- private int listRestrictBackgroundWhitelist() throws RemoteException {
+ private int listRestrictBackgroundAllowlist() throws RemoteException {
return listUidPolicies("Restrict background whitelisted UIDs",
POLICY_ALLOW_METERED_BACKGROUND);
}
- private int listRestrictBackgroundBlacklist() throws RemoteException {
+ private int listRestrictBackgroundDenylist() throws RemoteException {
return listUidPolicies("Restrict background blacklisted UIDs",
POLICY_REJECT_METERED_BACKGROUND);
}
- private int listAppIdleWhitelist() throws RemoteException {
+ private int listAppIdleAllowlist() throws RemoteException {
final PrintWriter pw = getOutPrintWriter();
final int[] uids = mInterface.getAppIdleWhitelist();
return listUidList("App Idle whitelisted UIDs", uids);
@@ -311,23 +311,23 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
return 0;
}
- private int addRestrictBackgroundWhitelist() throws RemoteException {
+ private int addRestrictBackgroundAllowlist() throws RemoteException {
return setUidPolicy(POLICY_ALLOW_METERED_BACKGROUND);
}
- private int removeRestrictBackgroundWhitelist() throws RemoteException {
+ private int removeRestrictBackgroundAllowlist() throws RemoteException {
return resetUidPolicy("not whitelisted", POLICY_ALLOW_METERED_BACKGROUND);
}
- private int addRestrictBackgroundBlacklist() throws RemoteException {
+ private int addRestrictBackgroundDenylist() throws RemoteException {
return setUidPolicy(POLICY_REJECT_METERED_BACKGROUND);
}
- private int removeRestrictBackgroundBlacklist() throws RemoteException {
+ private int removeRestrictBackgroundDenylist() throws RemoteException {
return resetUidPolicy("not blacklisted", POLICY_REJECT_METERED_BACKGROUND);
}
- private int setAppIdleWhitelist(boolean isWhitelisted) {
+ private int setAppIdleAllowlist(boolean isWhitelisted) {
final int uid = getUidFromNextArg();
if (uid < 0) {
return uid;
@@ -336,12 +336,12 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
return 0;
}
- private int addAppIdleWhitelist() throws RemoteException {
- return setAppIdleWhitelist(true);
+ private int addAppIdleAllowlist() throws RemoteException {
+ return setAppIdleAllowlist(true);
}
- private int removeAppIdleWhitelist() throws RemoteException {
- return setAppIdleWhitelist(false);
+ private int removeAppIdleAllowlist() throws RemoteException {
+ return setAppIdleAllowlist(false);
}
private int listWifiNetworks() {
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index 4849e0f0958b..3562ab5388e2 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -149,7 +149,8 @@ public class UserRestrictionsUtils {
UserManager.DISALLOW_WIFI_DIRECT,
UserManager.DISALLOW_ADD_WIFI_CONFIG,
UserManager.DISALLOW_CELLULAR_2G,
- UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO
+ UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO,
+ UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO
});
public static final Set<String> DEPRECATED_USER_RESTRICTIONS = Sets.newArraySet(
@@ -199,7 +200,8 @@ public class UserRestrictionsUtils {
UserManager.DISALLOW_WIFI_DIRECT,
UserManager.DISALLOW_ADD_WIFI_CONFIG,
UserManager.DISALLOW_CELLULAR_2G,
- UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO
+ UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO,
+ UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO
);
/**
@@ -240,7 +242,8 @@ public class UserRestrictionsUtils {
UserManager.DISALLOW_WIFI_DIRECT,
UserManager.DISALLOW_ADD_WIFI_CONFIG,
UserManager.DISALLOW_CELLULAR_2G,
- UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO
+ UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO,
+ UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO
);
/**
diff --git a/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java b/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
index ab7135526746..ed8cf4fc3481 100644
--- a/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
+++ b/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
@@ -215,7 +215,7 @@ public abstract class SoftRestrictedPermissionPolicy {
return true;
}
- // The package is now a part of the forced scoped storage whitelist
+ // The package is now a part of the forced scoped storage allowlist
if (isForcedScopedStorage) {
return true;
}
diff --git a/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java b/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java
index 65325c297719..7c4d7875b76f 100644
--- a/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java
+++ b/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java
@@ -22,6 +22,8 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Slog;
+import java.util.NoSuchElementException;
+
public class BootControlHIDL implements IBootControl {
private static final String TAG = "BootControlHIDL";
@@ -32,7 +34,7 @@ public class BootControlHIDL implements IBootControl {
public static boolean isServicePresent() {
try {
android.hardware.boot.V1_0.IBootControl.getService(true);
- } catch (RemoteException e) {
+ } catch (RemoteException | NoSuchElementException e) {
return false;
}
return true;
@@ -41,7 +43,7 @@ public class BootControlHIDL implements IBootControl {
public static boolean isV1_2ServicePresent() {
try {
android.hardware.boot.V1_2.IBootControl.getService(true);
- } catch (RemoteException e) {
+ } catch (RemoteException | NoSuchElementException e) {
return false;
}
return true;
diff --git a/services/core/java/com/android/server/security/KeyChainSystemService.java b/services/core/java/com/android/server/security/KeyChainSystemService.java
index edd4a3d7be93..1eb2839dc1c6 100644
--- a/services/core/java/com/android/server/security/KeyChainSystemService.java
+++ b/services/core/java/com/android/server/security/KeyChainSystemService.java
@@ -53,7 +53,7 @@ public class KeyChainSystemService extends SystemService {
/**
* Maximum time limit for the KeyChain app to deal with packages being removed.
*/
- private static final int KEYCHAIN_IDLE_WHITELIST_DURATION_MS = 30 * 1000;
+ private static final int KEYCHAIN_IDLE_ALLOWLIST_DURATION_MS = 30 * 1000;
public KeyChainSystemService(final Context context) {
super(context);
@@ -104,7 +104,7 @@ public class KeyChainSystemService extends SystemService {
final DeviceIdleInternal idleController =
LocalServices.getService(DeviceIdleInternal.class);
idleController.addPowerSaveTempWhitelistApp(Process.myUid(), packageName,
- KEYCHAIN_IDLE_WHITELIST_DURATION_MS, user.getIdentifier(), false,
+ KEYCHAIN_IDLE_ALLOWLIST_DURATION_MS, user.getIdentifier(), false,
REASON_KEY_CHAIN, "keychain");
getContext().startServiceAsUser(intent, user);
diff --git a/services/core/java/com/android/server/security/OWNERS b/services/core/java/com/android/server/security/OWNERS
index 5bcc98b600fc..f408d7c2efac 100644
--- a/services/core/java/com/android/server/security/OWNERS
+++ b/services/core/java/com/android/server/security/OWNERS
@@ -1,4 +1,6 @@
# Bug component: 36824
+include /core/java/android/security/OWNERS
+
per-file *AttestationVerification* = file:/core/java/android/security/attestationverification/OWNERS
per-file FileIntegrity*.java = victorhsieh@google.com
diff --git a/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java b/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java
index 2bd7383ddde0..1c5838c165a4 100644
--- a/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java
+++ b/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java
@@ -105,14 +105,27 @@ public class RemoteProvisioningService extends SystemService {
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) return;
- new RemoteProvisioningShellCommand().dump(pw);
+ final int callerUid = Binder.getCallingUidOrThrow();
+ final long callingIdentity = Binder.clearCallingIdentity();
+ try {
+ new RemoteProvisioningShellCommand(getContext(), callerUid).dump(pw);
+ } finally {
+ Binder.restoreCallingIdentity(callingIdentity);
+ }
}
@Override
public int handleShellCommand(ParcelFileDescriptor in, ParcelFileDescriptor out,
ParcelFileDescriptor err, String[] args) {
- return new RemoteProvisioningShellCommand().exec(this, in.getFileDescriptor(),
- out.getFileDescriptor(), err.getFileDescriptor(), args);
+ final int callerUid = Binder.getCallingUidOrThrow();
+ final long callingIdentity = Binder.clearCallingIdentity();
+ try {
+ return new RemoteProvisioningShellCommand(getContext(), callerUid).exec(this,
+ in.getFileDescriptor(), out.getFileDescriptor(), err.getFileDescriptor(),
+ args);
+ } finally {
+ Binder.restoreCallingIdentity(callingIdentity);
+ }
}
}
}
diff --git a/services/core/java/com/android/server/security/rkp/RemoteProvisioningShellCommand.java b/services/core/java/com/android/server/security/rkp/RemoteProvisioningShellCommand.java
index 187b93931f0b..4a6d74658754 100644
--- a/services/core/java/com/android/server/security/rkp/RemoteProvisioningShellCommand.java
+++ b/services/core/java/com/android/server/security/rkp/RemoteProvisioningShellCommand.java
@@ -16,22 +16,30 @@
package com.android.server.security.rkp;
+import android.content.Context;
import android.hardware.security.keymint.DeviceInfo;
import android.hardware.security.keymint.IRemotelyProvisionedComponent;
import android.hardware.security.keymint.MacedPublicKey;
import android.hardware.security.keymint.ProtectedData;
import android.hardware.security.keymint.RpcHardwareInfo;
+import android.os.CancellationSignal;
+import android.os.OutcomeReceiver;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ShellCommand;
+import android.security.rkp.service.RegistrationProxy;
+import android.security.rkp.service.RemotelyProvisionedKey;
import android.util.IndentingPrintWriter;
-import com.android.internal.annotations.VisibleForTesting;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.time.Duration;
import java.util.Base64;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
import co.nstant.in.cbor.CborDecoder;
import co.nstant.in.cbor.CborEncoder;
@@ -54,16 +62,17 @@ class RemoteProvisioningShellCommand extends ShellCommand {
+ "csr [--challenge CHALLENGE] NAME\n"
+ " Generate and print a base64-encoded CSR from the named\n"
+ " IRemotelyProvisionedComponent. A base64-encoded challenge can be provided,\n"
- + " or else it defaults to an empty challenge.\n";
+ + " or else it defaults to an empty challenge.\n"
+ + "certify NAME\n"
+ + " Output the PEM-encoded certificate chain provisioned for the named\n"
+ + " IRemotelyProvisionedComponent.\n";
- @VisibleForTesting
static final String EEK_ED25519_BASE64 = "goRDoQEnoFgqpAEBAycgBiFYIJm57t1e5FL2hcZMYtw+YatXSH11N"
+ "ymtdoAy0rPLY1jZWEAeIghLpLekyNdOAw7+uK8UTKc7b6XN3Np5xitk/pk5r3bngPpmAIUNB5gqrJFcpyUUS"
+ "QY0dcqKJ3rZ41pJ6wIDhEOhASegWE6lAQECWCDQrsEVyirPc65rzMvRlh1l6LHd10oaN7lDOpfVmd+YCAM4G"
+ "CAEIVggvoXnRsSjQlpA2TY6phXQLFh+PdwzAjLS/F4ehyVfcmBYQJvPkOIuS6vRGLEOjl0gJ0uEWP78MpB+c"
+ "gWDvNeCvvpkeC1UEEvAMb9r6B414vAtzmwvT/L1T6XUg62WovGHWAQ=";
- @VisibleForTesting
static final String EEK_P256_BASE64 = "goRDoQEmoFhNpQECAyYgASFYIPcUituX9MxT79JkEcTjdR9mH6RxDGzP"
+ "+glGgHSHVPKtIlggXn9b9uzk9hnM/xM3/Q+hyJPbGAZ2xF3m12p3hsMtr49YQC+XjkL7vgctlUeFR5NAsB/U"
+ "m0ekxESp8qEHhxDHn8sR9L+f6Dvg5zRMFfx7w34zBfTRNDztAgRgehXgedOK/ySEQ6EBJqBYcaYBAgJYIDVz"
@@ -74,14 +83,20 @@ class RemoteProvisioningShellCommand extends ShellCommand {
private static final int ERROR = -1;
private static final int SUCCESS = 0;
+ private static final Duration BIND_TIMEOUT = Duration.ofSeconds(10);
+ private static final int KEY_ID = 452436;
+
+ private final Context mContext;
+ private final int mCallerUid;
private final Injector mInjector;
- RemoteProvisioningShellCommand() {
- this(new Injector());
+ RemoteProvisioningShellCommand(Context context, int callerUid) {
+ this(context, callerUid, new Injector());
}
- @VisibleForTesting
- RemoteProvisioningShellCommand(Injector injector) {
+ RemoteProvisioningShellCommand(Context context, int callerUid, Injector injector) {
+ mContext = context;
+ mCallerUid = callerUid;
mInjector = injector;
}
@@ -102,6 +117,8 @@ class RemoteProvisioningShellCommand extends ShellCommand {
return list();
case "csr":
return csr();
+ case "certify":
+ return certify();
default:
return handleDefaultCommands(cmd);
}
@@ -232,7 +249,45 @@ class RemoteProvisioningShellCommand extends ShellCommand {
return new CborDecoder(bais).decodeNext();
}
- @VisibleForTesting
+ private int certify() throws Exception {
+ String name = getNextArgRequired();
+
+ Executor executor = mContext.getMainExecutor();
+ CancellationSignal cancellationSignal = new CancellationSignal();
+ OutcomeFuture<RemotelyProvisionedKey> key = new OutcomeFuture<>();
+ mInjector.getRegistrationProxy(mContext, mCallerUid, name, executor)
+ .getKeyAsync(KEY_ID, cancellationSignal, executor, key);
+ byte[] encodedCertChain = key.join().getEncodedCertChain();
+ ByteArrayInputStream is = new ByteArrayInputStream(encodedCertChain);
+ PrintWriter pw = getOutPrintWriter();
+ for (Certificate cert : CertificateFactory.getInstance("X.509").generateCertificates(is)) {
+ String encoded = Base64.getEncoder().encodeToString(cert.getEncoded());
+ pw.println("-----BEGIN CERTIFICATE-----");
+ pw.println(encoded.replaceAll("(.{64})", "$1\n").stripTrailing());
+ pw.println("-----END CERTIFICATE-----");
+ }
+ return SUCCESS;
+ }
+
+ /** Treat an OutcomeReceiver as a future for use in synchronous code. */
+ private static class OutcomeFuture<T> implements OutcomeReceiver<T, Exception> {
+ private CompletableFuture<T> mFuture = new CompletableFuture<>();
+
+ @Override
+ public void onResult(T result) {
+ mFuture.complete(result);
+ }
+
+ @Override
+ public void onError(Exception e) {
+ mFuture.completeExceptionally(e);
+ }
+
+ public T join() {
+ return mFuture.join();
+ }
+ }
+
static class Injector {
String[] getIrpcNames() {
return ServiceManager.getDeclaredInstances(IRemotelyProvisionedComponent.DESCRIPTOR);
@@ -248,5 +303,14 @@ class RemoteProvisioningShellCommand extends ShellCommand {
}
return binder;
}
+
+ RegistrationProxy getRegistrationProxy(
+ Context context, int callerUid, String name, Executor executor) {
+ String irpc = IRemotelyProvisionedComponent.DESCRIPTOR + "/" + name;
+ OutcomeFuture<RegistrationProxy> registration = new OutcomeFuture<>();
+ RegistrationProxy.createAsync(
+ context, callerUid, irpc, BIND_TIMEOUT, executor, registration);
+ return registration.join();
+ }
}
}
diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
index 36293d518f51..86eb36c93195 100644
--- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java
+++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
@@ -120,9 +120,6 @@ public class TrustAgentWrapper {
private final BroadcastReceiver mTrustableDowngradeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (!TrustManagerService.ENABLE_ACTIVE_UNLOCK_FLAG) {
- return;
- }
// are these the broadcasts we want to listen to
if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
downgradeToTrustable();
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index afe8d3eb2c54..04cd7f72acc9 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -57,7 +57,6 @@ import android.os.Message;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -158,13 +157,6 @@ public class TrustManagerService extends SystemService {
private final ActivityManager mActivityManager;
private VirtualDeviceManagerInternal mVirtualDeviceManager;
- @GuardedBy("mUserIsTrusted")
- private final SparseBooleanArray mUserIsTrusted = new SparseBooleanArray();
-
- //TODO(b/215724686): remove flag
- public static final boolean ENABLE_ACTIVE_UNLOCK_FLAG = SystemProperties.getBoolean(
- "fw.enable_active_unlock_flag", true);
-
private enum TrustState {
UNTRUSTED, // the phone is not unlocked by any trustagents
TRUSTABLE, // the phone is in a semi-locked state that can be unlocked if
@@ -393,6 +385,23 @@ public class TrustManagerService extends SystemService {
true /* overrideHardTimeout */);
}
+ private void cancelBothTrustableAlarms(int userId) {
+ TrustableTimeoutAlarmListener idleTimeout =
+ mIdleTrustableTimeoutAlarmListenerForUser.get(
+ userId);
+ TrustableTimeoutAlarmListener trustableTimeout =
+ mTrustableTimeoutAlarmListenerForUser.get(
+ userId);
+ if (idleTimeout != null && idleTimeout.isQueued()) {
+ idleTimeout.setQueued(false);
+ mAlarmManager.cancel(idleTimeout);
+ }
+ if (trustableTimeout != null && trustableTimeout.isQueued()) {
+ trustableTimeout.setQueued(false);
+ mAlarmManager.cancel(trustableTimeout);
+ }
+ }
+
private void handleScheduleTrustedTimeout(int userId, boolean shouldOverride) {
long when = SystemClock.elapsedRealtime() + TRUST_TIMEOUT_IN_MILLIS;
TrustedTimeoutAlarmListener alarm = mTrustTimeoutAlarmListenerForUser.get(userId);
@@ -521,69 +530,6 @@ public class TrustManagerService extends SystemService {
int flags,
boolean isFromUnlock,
@Nullable AndroidFuture<GrantTrustResult> resultCallback) {
- if (ENABLE_ACTIVE_UNLOCK_FLAG) {
- updateTrustWithRenewableUnlock(userId, flags, isFromUnlock, resultCallback);
- } else {
- updateTrustWithNonrenewableTrust(userId, flags, isFromUnlock);
- }
- }
-
- private void updateTrustWithNonrenewableTrust(int userId, int flags, boolean isFromUnlock) {
- boolean managed = aggregateIsTrustManaged(userId);
- dispatchOnTrustManagedChanged(managed, userId);
- if (mStrongAuthTracker.isTrustAllowedForUser(userId)
- && isTrustUsuallyManagedInternal(userId) != managed) {
- updateTrustUsuallyManaged(userId, managed);
- }
-
- boolean trusted = aggregateIsTrusted(userId);
- IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
- boolean showingKeyguard = true;
- try {
- showingKeyguard = wm.isKeyguardLocked();
- } catch (RemoteException e) {
- }
-
- boolean changed;
- synchronized (mUserIsTrusted) {
- if (mSettingsObserver.getTrustAgentsNonrenewableTrust()) {
- // For non-renewable trust agents can only set the device to trusted if it already
- // trusted or the device is unlocked. Attempting to set the device as trusted
- // when the device is locked will be ignored.
- changed = mUserIsTrusted.get(userId) != trusted;
- trusted = trusted
- && (!showingKeyguard || isFromUnlock || !changed)
- && userId == mCurrentUser;
- if (DEBUG) {
- Slog.d(TAG, "Extend unlock setting trusted as " + Boolean.toString(trusted)
- + " && " + Boolean.toString(!showingKeyguard)
- + " && " + Boolean.toString(userId == mCurrentUser));
- }
- }
- changed = mUserIsTrusted.get(userId) != trusted;
- mUserIsTrusted.put(userId, trusted);
- }
- dispatchOnTrustChanged(
- trusted,
- false /* newlyUnlocked */,
- userId,
- flags,
- getTrustGrantedMessages(userId));
- if (changed) {
- refreshDeviceLockedForUser(userId);
- if (!trusted) {
- maybeLockScreen(userId);
- } else {
- scheduleTrustTimeout(false /* override */, false /* isTrustableTimeout*/);
- }
- }
- }
-
- private void updateTrustWithRenewableUnlock(
- int userId,
- int flags,
- boolean isFromUnlock,
- @Nullable AndroidFuture<GrantTrustResult> resultCallback) {
boolean managed = aggregateIsTrustManaged(userId);
dispatchOnTrustManagedChanged(managed, userId);
if (mStrongAuthTracker.isTrustAllowedForUser(userId)
@@ -657,6 +603,11 @@ public class TrustManagerService extends SystemService {
resultCallback.complete(new GrantTrustResult(STATUS_UNLOCKED_BY_GRANT));
}
}
+
+ if ((wasTrusted || wasTrustable) && pendingTrustState == TrustState.UNTRUSTED) {
+ if (DEBUG) Slog.d(TAG, "Trust was revoked, destroy trustable alarms");
+ cancelBothTrustableAlarms(userId);
+ }
}
private void updateTrustUsuallyManaged(int userId, boolean managed) {
@@ -1903,7 +1854,11 @@ public class TrustManagerService extends SystemService {
handleScheduleTrustTimeout(shouldOverride, timeoutType);
break;
case MSG_REFRESH_TRUSTABLE_TIMERS_AFTER_AUTH:
- refreshTrustableTimers(msg.arg1);
+ TrustableTimeoutAlarmListener trustableAlarm =
+ mTrustableTimeoutAlarmListenerForUser.get(msg.arg1);
+ if (trustableAlarm != null && trustableAlarm.isQueued()) {
+ refreshTrustableTimers(msg.arg1);
+ }
break;
}
}
@@ -1962,9 +1917,6 @@ public class TrustManagerService extends SystemService {
} else if (Intent.ACTION_USER_REMOVED.equals(action)) {
int userId = getUserId(intent);
if (userId > 0) {
- synchronized (mUserIsTrusted) {
- mUserIsTrusted.delete(userId);
- }
synchronized (mDeviceLockedForUser) {
mDeviceLockedForUser.delete(userId);
}
@@ -2118,16 +2070,11 @@ public class TrustManagerService extends SystemService {
@Override
public void handleAlarm() {
- TrustableTimeoutAlarmListener otherAlarm;
- boolean otherAlarmPresent;
- if (ENABLE_ACTIVE_UNLOCK_FLAG) {
- otherAlarm = mTrustableTimeoutAlarmListenerForUser.get(mUserId);
- otherAlarmPresent = (otherAlarm != null) && otherAlarm.isQueued();
- if (otherAlarmPresent) {
- synchronized (mAlarmLock) {
- disableNonrenewableTrustWhileRenewableTrustIsPresent();
- }
- return;
+ TrustableTimeoutAlarmListener otherAlarm =
+ mTrustableTimeoutAlarmListenerForUser.get(mUserId);
+ if (otherAlarm != null && otherAlarm.isQueued()) {
+ synchronized (mAlarmLock) {
+ disableNonrenewableTrustWhileRenewableTrustIsPresent();
}
}
}
@@ -2152,38 +2099,15 @@ public class TrustManagerService extends SystemService {
@Override
public void handleAlarm() {
- TrustedTimeoutAlarmListener otherAlarm;
- boolean otherAlarmPresent;
- if (ENABLE_ACTIVE_UNLOCK_FLAG) {
- cancelBothTrustableAlarms();
- otherAlarm = mTrustTimeoutAlarmListenerForUser.get(mUserId);
- otherAlarmPresent = (otherAlarm != null) && otherAlarm.isQueued();
- if (otherAlarmPresent) {
- synchronized (mAlarmLock) {
- disableRenewableTrustWhileNonrenewableTrustIsPresent();
- }
- return;
+ cancelBothTrustableAlarms(mUserId);
+ TrustedTimeoutAlarmListener otherAlarm = mTrustTimeoutAlarmListenerForUser.get(mUserId);
+ if (otherAlarm != null && otherAlarm.isQueued()) {
+ synchronized (mAlarmLock) {
+ disableRenewableTrustWhileNonrenewableTrustIsPresent();
}
}
}
- private void cancelBothTrustableAlarms() {
- TrustableTimeoutAlarmListener idleTimeout =
- mIdleTrustableTimeoutAlarmListenerForUser.get(
- mUserId);
- TrustableTimeoutAlarmListener trustableTimeout =
- mTrustableTimeoutAlarmListenerForUser.get(
- mUserId);
- if (idleTimeout != null && idleTimeout.isQueued()) {
- idleTimeout.setQueued(false);
- mAlarmManager.cancel(idleTimeout);
- }
- if (trustableTimeout != null && trustableTimeout.isQueued()) {
- trustableTimeout.setQueued(false);
- mAlarmManager.cancel(trustableTimeout);
- }
- }
-
private void disableRenewableTrustWhileNonrenewableTrustIsPresent() {
// if non-renewable trust is running, we need to temporarily prevent
// renewable trust from being used
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 075991e758f1..10f1db1d79be 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -160,7 +160,6 @@ cc_defaults {
"android.hardware.graphics.bufferqueue@1.0",
"android.hardware.graphics.bufferqueue@2.0",
"android.hardware.graphics.common@1.2",
- "android.hardware.graphics.mapper@4.0",
"android.hardware.input.processor-V1-ndk",
"android.hardware.ir@1.0",
"android.hardware.light@2.0",
diff --git a/services/core/jni/gnss/GnssVisibilityControlCallback.cpp b/services/core/jni/gnss/GnssVisibilityControlCallback.cpp
index ec215f106650..bc57c1d95b02 100644
--- a/services/core/jni/gnss/GnssVisibilityControlCallback.cpp
+++ b/services/core/jni/gnss/GnssVisibilityControlCallback.cpp
@@ -73,7 +73,7 @@ bool GnssVisibilityControlCallbackUtil::isInEmergencySession() {
template <>
jstring ToJstring(JNIEnv* env, const String16& value) {
- const char16_t* str = value.string();
+ const char16_t* str = value.c_str();
size_t len = value.size();
return env->NewString(reinterpret_cast<const jchar*>(str), len);
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/PolicyVersionUpgrader.java b/services/devicepolicy/java/com/android/server/devicepolicy/PolicyVersionUpgrader.java
index 253851cdbf68..29b80e68dc34 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/PolicyVersionUpgrader.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/PolicyVersionUpgrader.java
@@ -29,6 +29,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
import java.util.ArrayList;
import java.util.List;
@@ -251,6 +252,8 @@ public class PolicyVersionUpgrader {
String versionString = Files.readAllLines(
file.toPath(), Charset.defaultCharset()).get(0);
return Integer.parseInt(versionString);
+ } catch (NoSuchFileException e) {
+ return 0; // expected on first boot
} catch (IOException | NumberFormatException | IndexOutOfBoundsException e) {
Slog.e(LOG_TAG, "Error reading version", e);
return 0;
diff --git a/services/net/java/android/net/util/NetworkConstants.java b/services/net/java/android/net/util/NetworkConstants.java
index ea5ce65f6f79..49962eabbff3 100644
--- a/services/net/java/android/net/util/NetworkConstants.java
+++ b/services/net/java/android/net/util/NetworkConstants.java
@@ -52,7 +52,6 @@ public final class NetworkConstants {
public static final int IPV6_ADDR_BITS = 128;
public static final int IPV6_ADDR_LEN = 16;
public static final int IPV6_MIN_MTU = 1280;
- public static final int RFC7421_PREFIX_LENGTH = 64;
/**
* ICMP common (v4/v6) constants.
diff --git a/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java b/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java
index 2d93120681ec..007c0db1b731 100644
--- a/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java
+++ b/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java
@@ -21,12 +21,14 @@ import static com.google.common.truth.Truth8.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
+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.verify;
import static org.mockito.Mockito.when;
+import android.content.Context;
import android.hardware.security.keymint.DeviceInfo;
import android.hardware.security.keymint.IRemotelyProvisionedComponent;
import android.hardware.security.keymint.MacedPublicKey;
@@ -34,28 +36,35 @@ import android.hardware.security.keymint.ProtectedData;
import android.hardware.security.keymint.RpcHardwareInfo;
import android.os.Binder;
import android.os.FileUtils;
+import android.os.OutcomeReceiver;
+import android.os.Process;
+import android.security.rkp.service.RegistrationProxy;
+import android.security.rkp.service.RemotelyProvisionedKey;
+import androidx.test.core.app.ApplicationProvider;
import androidx.test.runner.AndroidJUnit4;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.util.Arrays;
import java.util.Base64;
import java.util.Map;
+import java.util.concurrent.Executor;
@RunWith(AndroidJUnit4.class)
public class RemoteProvisioningShellCommandTest {
- private static class Injector extends RemoteProvisioningShellCommand.Injector {
+ private Context mContext;
- private final Map<String, IRemotelyProvisionedComponent> mIrpcs;
+ private static class Injector extends RemoteProvisioningShellCommand.Injector {
- Injector(Map irpcs) {
- mIrpcs = irpcs;
- }
+ Map<String, IRemotelyProvisionedComponent> mIrpcs;
+ Map<String, RegistrationProxy> mRegistrationProxies;
@Override
String[] getIrpcNames() {
@@ -70,6 +79,12 @@ public class RemoteProvisioningShellCommandTest {
}
return irpc;
}
+
+ @Override
+ RegistrationProxy getRegistrationProxy(
+ Context context, int callerUid, String name, Executor executor) {
+ return mRegistrationProxies.get(name);
+ }
}
private static class CommandResult {
@@ -111,10 +126,17 @@ public class RemoteProvisioningShellCommandTest {
code, FileUtils.readTextFile(out, 0, null), FileUtils.readTextFile(err, 0, null));
}
+ @Before
+ public void setUp() {
+ mContext = ApplicationProvider.getApplicationContext();
+ }
+
@Test
public void list_zeroInstances() throws Exception {
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of();
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of()));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0);
@@ -124,8 +146,10 @@ public class RemoteProvisioningShellCommandTest {
@Test
public void list_oneInstances() throws Exception {
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of("default", mock(IRemotelyProvisionedComponent.class));
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of("default", mock(IRemotelyProvisionedComponent.class))));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0);
@@ -134,10 +158,12 @@ public class RemoteProvisioningShellCommandTest {
@Test
public void list_twoInstances() throws Exception {
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of(
+ "default", mock(IRemotelyProvisionedComponent.class),
+ "strongbox", mock(IRemotelyProvisionedComponent.class));
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of(
- "default", mock(IRemotelyProvisionedComponent.class),
- "strongbox", mock(IRemotelyProvisionedComponent.class))));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0);
@@ -158,8 +184,10 @@ public class RemoteProvisioningShellCommandTest {
}).when(defaultMock).generateCertificateRequest(
anyBoolean(), any(), any(), any(), any(), any());
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of("default", defaultMock);
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of("default", defaultMock)));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {
"csr", "--challenge", "dGVzdHRlc3R0ZXN0dGVzdA==", "default"});
verify(defaultMock).generateCertificateRequest(
@@ -189,8 +217,10 @@ public class RemoteProvisioningShellCommandTest {
}).when(defaultMock).generateCertificateRequest(
anyBoolean(), any(), any(), any(), any(), any());
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of("default", defaultMock);
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of("default", defaultMock)));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {
"csr", "--challenge", "dGVzdHRlc3R0ZXN0dGVzdA==", "default"});
verify(defaultMock).generateCertificateRequest(
@@ -215,8 +245,10 @@ public class RemoteProvisioningShellCommandTest {
when(defaultMock.generateCertificateRequestV2(any(), any()))
.thenReturn(new byte[] {0x68, 0x65, 0x6c, 0x6c, 0x6f});
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of("default", defaultMock);
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of("default", defaultMock)));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {"csr", "default"});
verify(defaultMock).generateCertificateRequestV2(new MacedPublicKey[0], new byte[0]);
assertThat(res.getErr()).isEmpty();
@@ -233,8 +265,10 @@ public class RemoteProvisioningShellCommandTest {
when(defaultMock.generateCertificateRequestV2(any(), any()))
.thenReturn(new byte[] {0x68, 0x69});
+ Injector injector = new Injector();
+ injector.mIrpcs = Map.of("default", defaultMock);
RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
- new Injector(Map.of("default", defaultMock)));
+ mContext, Process.SHELL_UID, injector);
CommandResult res = exec(cmd, new String[] {"csr", "--challenge", "dHJpYWw=", "default"});
verify(defaultMock).generateCertificateRequestV2(
new MacedPublicKey[0], new byte[] {0x74, 0x72, 0x69, 0x61, 0x6c});
@@ -242,4 +276,82 @@ public class RemoteProvisioningShellCommandTest {
assertThat(res.getCode()).isEqualTo(0);
assertThat(res.getOut()).isEqualTo("aGk=\n");
}
+
+ @Test
+ public void certify_sameOrderAsReceived() throws Exception {
+ String cert1 = "MIIBqDCCAU2gAwIBAgIUI3FFU7xZno/2Xf/wZzKKquP0ov0wCgYIKoZIzj0EAwIw\n"
+ + "KTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQKDARUZXN0MB4XDTIz\n"
+ + "MDgyMjE5MzgxMFoXDTMzMDgxOTE5MzgxMFowKTELMAkGA1UEBhMCVVMxCzAJBgNV\n"
+ + "BAgMAkNBMQ0wCwYDVQQKDARUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE\n"
+ + "czOpG6NKOdDjV/yrKjuy0q0jEJvsVLGgTeY+vyKRBJS59OhyRWG6n3aza21bNg5d\n"
+ + "WE9ruz+bcT0IP4kDbiS0y6NTMFEwHQYDVR0OBBYEFHYfJxCUipNI7qRqvczcWsOb\n"
+ + "FIDPMB8GA1UdIwQYMBaAFHYfJxCUipNI7qRqvczcWsObFIDPMA8GA1UdEwEB/wQF\n"
+ + "MAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhAKm/kpJwlnWkjoLCAddBiSnxbT4EfJIK\n"
+ + "H0j58tg5VazHAiEAnS/kRzU9AbstOZyD7el/ws3gLXkbUNey3pLFutBWsSU=\n";
+ String cert2 = "MIIBpjCCAU2gAwIBAgIUdSzfZzeGr+h70JPO7Sxwdkw99iMwCgYIKoZIzj0EAwIw\n"
+ + "KTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQKDARUZXN0MB4XDTIz\n"
+ + "MDgyMjIwMTcyMFoXDTMzMDgxOTIwMTcyMFowKTELMAkGA1UEBhMCVVMxCzAJBgNV\n"
+ + "BAgMAkNBMQ0wCwYDVQQKDARUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE\n"
+ + "voGJi4DxuqH8rzPV6Eq0OVULc0xFzaM0500VBqiQEB7Qt0Ktk2d+3bUrFAb3SZV4\n"
+ + "6TIdb7SkynvaDtr0x45Ng6NTMFEwHQYDVR0OBBYEFMeGjvGV0ADPBJk5/FPoW9HQ\n"
+ + "uTc6MB8GA1UdIwQYMBaAFMeGjvGV0ADPBJk5/FPoW9HQuTc6MA8GA1UdEwEB/wQF\n"
+ + "MAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgd1gu7iiNOQXaQUn5BT3WwWR0Yk78ndWt\n"
+ + "ew7tRiTOhFcCIFURi6WcNH0oWa6IbwBSMC9aZlo98Fbg+dTwhLAAw+PW\n";
+ byte[] cert1Bytes = Base64.getDecoder().decode(cert1.replaceAll("\\s+", ""));
+ byte[] cert2Bytes = Base64.getDecoder().decode(cert2.replaceAll("\\s+", ""));
+ byte[] certChain = Arrays.copyOf(cert1Bytes, cert1Bytes.length + cert2Bytes.length);
+ System.arraycopy(cert2Bytes, 0, certChain, cert1Bytes.length, cert2Bytes.length);
+ RemotelyProvisionedKey keyMock = mock(RemotelyProvisionedKey.class);
+ when(keyMock.getEncodedCertChain()).thenReturn(certChain);
+ RegistrationProxy defaultMock = mock(RegistrationProxy.class);
+ doAnswer(invocation -> {
+ ((OutcomeReceiver<RemotelyProvisionedKey, Exception>) invocation.getArgument(3))
+ .onResult(keyMock);
+ return null;
+ }).when(defaultMock).getKeyAsync(anyInt(), any(), any(), any());
+
+ Injector injector = new Injector();
+ injector.mRegistrationProxies = Map.of("default", defaultMock);
+ RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
+ mContext, Process.SHELL_UID, injector);
+ CommandResult res = exec(cmd, new String[] {"certify", "default"});
+ assertThat(res.getErr()).isEmpty();
+ assertThat(res.getCode()).isEqualTo(0);
+ assertThat(res.getOut()).isEqualTo(
+ "-----BEGIN CERTIFICATE-----\n" + cert1 + "-----END CERTIFICATE-----\n"
+ + "-----BEGIN CERTIFICATE-----\n" + cert2 + "-----END CERTIFICATE-----\n");
+ }
+
+ @Test
+ public void certify_noBlankLineBeforeTrailer() throws Exception {
+ String cert = "MIIB2zCCAYGgAwIBAgIRAOpN7Em1k7gaqLAB2dzXUTYwCgYIKoZIzj0EAwIwKTET\n"
+ + "MBEGA1UEChMKR29vZ2xlIExMQzESMBAGA1UEAxMJRHJvaWQgQ0EzMB4XDTIzMDgx\n"
+ + "ODIzMzI1MloXDTIzMDkyMTIzMzI1MlowOTEMMAoGA1UEChMDVEVFMSkwJwYDVQQD\n"
+ + "EyBlYTRkZWM0OWI1OTNiODFhYThiMDAxZDlkY2Q3NTEzNjBZMBMGByqGSM49AgEG\n"
+ + "CCqGSM49AwEHA0IABHM/cKZblmlw8bdGbDXnX+ZiLiGjSjaLHXYOoHDrVArAMXUi\n"
+ + "L6brhcUPaqSGcVLcfFZbaFMOxXW6TsGdQiwJ0iyjejB4MB0GA1UdDgQWBBTYzft+\n"
+ + "X32TH/Hh+ngwQF6aPhnfXDAfBgNVHSMEGDAWgBQT4JObI9mzNNW2FRsHRcw4zVn2\n"
+ + "8jAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwICBDAVBgorBgEEAdZ5AgEe\n"
+ + "BAehARoABAAAMAoGCCqGSM49BAMCA0gAMEUCIDc0OR7CzIYw0myTr0y/Brl1nZyk\n"
+ + "eGSQp615WpTwYhwxAiEApM10gSIKBIo7Z4/FNzkuiz1zZwW9+Dcqisqxkfe6icQ=\n";
+ byte[] certBytes = Base64.getDecoder().decode(cert.replaceAll("\\s+", ""));
+ RemotelyProvisionedKey keyMock = mock(RemotelyProvisionedKey.class);
+ when(keyMock.getEncodedCertChain()).thenReturn(certBytes);
+ RegistrationProxy defaultMock = mock(RegistrationProxy.class);
+ doAnswer(invocation -> {
+ ((OutcomeReceiver<RemotelyProvisionedKey, Exception>) invocation.getArgument(3))
+ .onResult(keyMock);
+ return null;
+ }).when(defaultMock).getKeyAsync(anyInt(), any(), any(), any());
+
+ Injector injector = new Injector();
+ injector.mRegistrationProxies = Map.of("strongbox", defaultMock);
+ RemoteProvisioningShellCommand cmd = new RemoteProvisioningShellCommand(
+ mContext, Process.SHELL_UID, injector);
+ CommandResult res = exec(cmd, new String[] {"certify", "strongbox"});
+ assertThat(res.getErr()).isEmpty();
+ assertThat(res.getCode()).isEqualTo(0);
+ assertThat(res.getOut()).isEqualTo(
+ "-----BEGIN CERTIFICATE-----\n" + cert + "-----END CERTIFICATE-----\n");
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java b/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java
index 90df786e5970..45e7f3512975 100644
--- a/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java
+++ b/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java
@@ -34,10 +34,10 @@ import libcore.io.IoUtils;
*/
public class CertBlacklisterTest extends AndroidTestCase {
- private static final String BLACKLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/";
+ private static final String DENYLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/";
- public static final String PUBKEY_PATH = BLACKLIST_ROOT + "pubkey_blacklist.txt";
- public static final String SERIAL_PATH = BLACKLIST_ROOT + "serial_blacklist.txt";
+ public static final String PUBKEY_PATH = DENYLIST_ROOT + "pubkey_blacklist.txt";
+ public static final String SERIAL_PATH = DENYLIST_ROOT + "serial_blacklist.txt";
public static final String PUBKEY_KEY = "pubkey_blacklist";
public static final String SERIAL_KEY = "serial_blacklist";
diff --git a/services/tests/servicestests/src/com/android/server/integrity/AppIntegrityManagerServiceImplTest.java b/services/tests/servicestests/src/com/android/server/integrity/AppIntegrityManagerServiceImplTest.java
index 9ca84d33998c..ce15c6d30531 100644
--- a/services/tests/servicestests/src/com/android/server/integrity/AppIntegrityManagerServiceImplTest.java
+++ b/services/tests/servicestests/src/com/android/server/integrity/AppIntegrityManagerServiceImplTest.java
@@ -218,7 +218,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void updateRuleSet_notSystemApp() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp(false);
Rule rule =
new Rule(
@@ -237,7 +237,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void updateRuleSet_authorized() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
Rule rule =
new Rule(
@@ -251,7 +251,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void updateRuleSet_correctMethodCall() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
IntentSender mockReceiver = mock(IntentSender.class);
List<Rule> rules =
@@ -271,7 +271,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void updateRuleSet_fail() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
doThrow(new IOException()).when(mIntegrityFileManager).writeRules(any(), any(), any());
IntentSender mockReceiver = mock(IntentSender.class);
@@ -292,7 +292,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void broadcastReceiverRegistration() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
ArgumentCaptor<IntentFilter> intentFilterCaptor =
ArgumentCaptor.forClass(IntentFilter.class);
@@ -308,7 +308,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void handleBroadcast_correctArgs() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
ArgumentCaptor.forClass(BroadcastReceiver.class);
@@ -345,7 +345,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void handleBroadcast_correctArgs_multipleCerts() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
ArgumentCaptor.forClass(BroadcastReceiver.class);
@@ -368,7 +368,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void handleBroadcast_correctArgs_sourceStamp() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
ArgumentCaptor.forClass(BroadcastReceiver.class);
@@ -393,7 +393,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void handleBroadcast_allow() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
ArgumentCaptor.forClass(BroadcastReceiver.class);
@@ -412,7 +412,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void handleBroadcast_reject() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
ArgumentCaptor.forClass(BroadcastReceiver.class);
@@ -438,7 +438,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void handleBroadcast_notInitialized() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
when(mIntegrityFileManager.initialized()).thenReturn(false);
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
@@ -459,7 +459,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void verifierAsInstaller_skipIntegrityVerification() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
setIntegrityCheckIncludesRuleProvider(false);
ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor =
@@ -480,7 +480,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void getCurrentRules() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
Rule rule = new Rule(IntegrityFormula.Application.packageNameEquals("package"), Rule.DENY);
when(mIntegrityFileManager.readRules(any())).thenReturn(Arrays.asList(rule));
@@ -490,7 +490,7 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void getWhitelistedRuleProviders_returnsEmptyForNonSystemApps() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp(false);
assertThat(mService.getWhitelistedRuleProviders()).isEmpty();
@@ -498,13 +498,13 @@ public class AppIntegrityManagerServiceImplTest {
@Test
public void getWhitelistedRuleProviders() throws Exception {
- whitelistUsAsRuleProvider();
+ allowlistUsAsRuleProvider();
makeUsSystemApp();
assertThat(mService.getWhitelistedRuleProviders()).containsExactly(TEST_FRAMEWORK_PACKAGE);
}
- private void whitelistUsAsRuleProvider() {
+ private void allowlistUsAsRuleProvider() {
Resources mockResources = mock(Resources.class);
when(mockResources.getStringArray(R.array.config_integrityRuleProviderPackages))
.thenReturn(new String[] {TEST_FRAMEWORK_PACKAGE});
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 d9af51f819c3..0ac6ef3cb344 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
@@ -467,7 +467,7 @@ public class KeySyncTaskTest {
verify(mTestOnlyInsecureCertificateHelper, atLeast(1))
.isTestOnlyCertificateAlias(eq(TEST_ROOT_CERT_ALIAS));
- // no whitelists check
+ // no allowlists check
verify(mTestOnlyInsecureCertificateHelper, never())
.doesCredentialSupportInsecureMode(anyInt(), any());
verify(mTestOnlyInsecureCertificateHelper, never())
diff --git a/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java b/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java
index ba7a10350f0b..8ba43844a934 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserSystemPackageInstallerTest.java
@@ -117,7 +117,7 @@ public class UserSystemPackageInstallerTest {
for (int userId : mRemoveUsers) {
um.removeUser(userId);
}
- setUserTypePackageWhitelistMode(mOriginalWhitelistMode);
+ setUserTypePackageAllowlistMode(mOriginalWhitelistMode);
}
/**
@@ -184,7 +184,7 @@ public class UserSystemPackageInstallerTest {
}
}
- final ArrayMap<String, Long> expectedOutput = getNewPackageToWhitelistedBitSetMap();
+ final ArrayMap<String, Long> expectedOutput = getNewPackageToAllowlistedBitSetMap();
expectedOutput.put("com.android.package1", expectedUserTypeBitSet1);
expectedOutput.put("com.android.package2", expectedUserTypeBitSet2);
expectedOutput.put("com.android.package3", expectedUserTypeBitSet3);
@@ -227,7 +227,7 @@ public class UserSystemPackageInstallerTest {
}
};
- final ArrayMap<String, Long> expectedOutput = getNewPackageToWhitelistedBitSetMap();
+ final ArrayMap<String, Long> expectedOutput = getNewPackageToAllowlistedBitSetMap();
expectedOutput.put("com.android.package2", 0L);
expectedOutput.put("com.android.package3", 0L);
expectedOutput.put("com.android.package4", 0L);
@@ -340,7 +340,7 @@ public class UserSystemPackageInstallerTest {
public void testPackagesForCreateUser_full() {
final String userTypeToCreate = USER_TYPE_FULL_SECONDARY;
final long userTypeMask = mUserSystemPackageInstaller.getUserTypeMask(userTypeToCreate);
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
PackageManager pm = mContext.getPackageManager();
final SystemConfig sysConfig = new SystemConfigTestClass(true);
@@ -384,7 +384,7 @@ public class UserSystemPackageInstallerTest {
*/
@Test
public void testInstallOverlayPackagesExplicitMode() {
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
final String[] userTypes = new String[]{"type"};
final long maskOfType = 0b0001L;
@@ -453,49 +453,49 @@ public class UserSystemPackageInstallerTest {
*/
@Test
public void testSetWhitelistEnabledMode() {
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_DISABLE);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_DISABLE);
assertFalse(mUserSystemPackageInstaller.isLogMode());
assertFalse(mUserSystemPackageInstaller.isEnforceMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertFalse(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_LOG);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_LOG);
assertTrue(mUserSystemPackageInstaller.isLogMode());
assertFalse(mUserSystemPackageInstaller.isEnforceMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertFalse(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
assertFalse(mUserSystemPackageInstaller.isLogMode());
assertTrue(mUserSystemPackageInstaller.isEnforceMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertFalse(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST);
assertFalse(mUserSystemPackageInstaller.isLogMode());
assertFalse(mUserSystemPackageInstaller.isEnforceMode());
assertTrue(mUserSystemPackageInstaller.isImplicitWhitelistMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertFalse(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST_SYSTEM);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST_SYSTEM);
assertFalse(mUserSystemPackageInstaller.isLogMode());
assertFalse(mUserSystemPackageInstaller.isEnforceMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistMode());
assertTrue(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertFalse(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IGNORE_OTA);
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IGNORE_OTA);
assertFalse(mUserSystemPackageInstaller.isLogMode());
assertFalse(mUserSystemPackageInstaller.isEnforceMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistMode());
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertTrue(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(
+ setUserTypePackageAllowlistMode(
USER_TYPE_PACKAGE_WHITELIST_MODE_LOG | USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
assertTrue(mUserSystemPackageInstaller.isLogMode());
assertTrue(mUserSystemPackageInstaller.isEnforceMode());
@@ -503,7 +503,7 @@ public class UserSystemPackageInstallerTest {
assertFalse(mUserSystemPackageInstaller.isImplicitWhitelistSystemMode());
assertFalse(mUserSystemPackageInstaller.isIgnoreOtaMode());
- setUserTypePackageWhitelistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST
+ setUserTypePackageAllowlistMode(USER_TYPE_PACKAGE_WHITELIST_MODE_IMPLICIT_WHITELIST
| USER_TYPE_PACKAGE_WHITELIST_MODE_ENFORCE);
assertFalse(mUserSystemPackageInstaller.isLogMode());
assertTrue(mUserSystemPackageInstaller.isEnforceMode());
@@ -513,7 +513,7 @@ public class UserSystemPackageInstallerTest {
}
/** Sets the allowlist mode to the desired value via adb's setprop. */
- private void setUserTypePackageWhitelistMode(int mode) {
+ private void setUserTypePackageAllowlistMode(int mode) {
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
try {
String result = uiDevice.executeShellCommand(String.format("setprop %s %d",
@@ -526,7 +526,7 @@ public class UserSystemPackageInstallerTest {
}
/** @see UserSystemPackageInstaller#mWhitelistedPackagesForUserTypes */
- private ArrayMap<String, Long> getNewPackageToWhitelistedBitSetMap() {
+ private ArrayMap<String, Long> getNewPackageToAllowlistedBitSetMap() {
final ArrayMap<String, Long> pkgBitSetMap = new ArrayMap<>();
// "android" is always treated as allowlisted for all types, regardless of the xml file.
pkgBitSetMap.put("android", ~0L);
diff --git a/services/tests/servicestests/src/com/android/server/power/hint/OWNERS b/services/tests/servicestests/src/com/android/server/power/hint/OWNERS
new file mode 100644
index 000000000000..c28c07a234b3
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/power/hint/OWNERS
@@ -0,0 +1,2 @@
+include /ADPF_OWNERS
+
diff --git a/services/tests/servicestests/utils/com/android/server/testutils/TestHandler.java b/services/tests/servicestests/utils/com/android/server/testutils/TestHandler.java
index 22d383a84177..fc5213cba2e2 100644
--- a/services/tests/servicestests/utils/com/android/server/testutils/TestHandler.java
+++ b/services/tests/servicestests/utils/com/android/server/testutils/TestHandler.java
@@ -82,7 +82,7 @@ public class TestHandler extends Handler {
uptimeMillis = uptimeMillis - SystemClock.uptimeMillis() + mClock.getAsLong();
}
- // post a dummy queue entry to keep track of message removal
+ // post a sentinel queue entry to keep track of message removal
return super.sendMessageAtTime(msg, Long.MAX_VALUE)
&& mMessages.add(new MsgInfo(Message.obtain(msg), uptimeMillis, mMessageCount));
}
diff --git a/startop/apps/ColorChanging/app/build.gradle b/startop/apps/ColorChanging/app/build.gradle
index ab955aaf90ee..11b14c04f1b9 100644
--- a/startop/apps/ColorChanging/app/build.gradle
+++ b/startop/apps/ColorChanging/app/build.gradle
@@ -14,7 +14,7 @@ android {
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
}
diff --git a/startop/apps/ColorChanging/app/proguard-rules.pro b/startop/apps/ColorChanging/app/proguard-rules.pro
deleted file mode 100644
index f1b424510da5..000000000000
--- a/startop/apps/ColorChanging/app/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/telephony/common/com/android/internal/telephony/SmsApplication.java b/telephony/common/com/android/internal/telephony/SmsApplication.java
index 423022599de6..dc75fb579dbe 100644
--- a/telephony/common/com/android/internal/telephony/SmsApplication.java
+++ b/telephony/common/com/android/internal/telephony/SmsApplication.java
@@ -783,7 +783,7 @@ public final class SmsApplication {
AppOpsManager.MODE_ALLOWED);
}
} catch (NameNotFoundException e) {
- // No whitelisted system app on this device
+ // No allowlisted system app on this device
Log.e(LOG_TAG, "Package not found: " + packageName);
}
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 1cf2969ea9b5..1a28ad89a2c3 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -340,7 +340,7 @@ public final class SmsManager {
}
/**
- * Get {@link Context#getOpPackageName()} if this manager has a context, otherwise a dummy
+ * Get {@link Context#getOpPackageName()} if this manager has a context, otherwise a placeholder
* value.
*
* @return The package name to be used for app-ops checks
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index fa60031f2a66..692ac706b3f2 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -7713,7 +7713,7 @@ public class TelephonyManager {
}
/**
- * Rollback modem configurations to factory default except some config which are in whitelist.
+ * Rollback modem configurations to factory default except some config which are in allowlist.
* Used for device configuration by some carriers.
*
* <p>Requires Permission:
@@ -14785,7 +14785,7 @@ public class TelephonyManager {
*
* 1) User data is turned on, or
* 2) APN is un-metered for this subscription, or
- * 3) APN type is whitelisted. E.g. MMS is whitelisted if
+ * 3) APN type is allowlisted. E.g. MMS is allowlisted if
* {@link #MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED} is enabled.
*
* @param apnType Value indicating the apn type. Apn types are defined in {@link ApnSetting}.
diff --git a/telephony/java/android/telephony/ims/ImsReasonInfo.java b/telephony/java/android/telephony/ims/ImsReasonInfo.java
index dda021e6172f..67acda05382b 100644
--- a/telephony/java/android/telephony/ims/ImsReasonInfo.java
+++ b/telephony/java/android/telephony/ims/ImsReasonInfo.java
@@ -460,7 +460,7 @@ public final class ImsReasonInfo implements Parcelable {
*/
public static final int CODE_LOW_BATTERY = 505;
/**
- * Device declined a call due to a blacklisted caller ID.
+ * Device declined a call due to a denylisted caller ID.
*/
public static final int CODE_BLACKLISTED_CALL_ID = 506;
// IMS -> Telephony
diff --git a/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java b/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java
index 0f694c293330..fe9126003967 100644
--- a/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java
+++ b/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java
@@ -18,5 +18,5 @@ package com.android.apkverity.feature_x;
import android.app.Activity;
-/** Dummy class just to generate some dex */
+/** Placeholder class just to generate some dex */
public class DummyActivity extends Activity {}
diff --git a/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java b/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java
index 837c7be37504..a7bd771400c0 100644
--- a/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java
+++ b/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java
@@ -18,5 +18,5 @@ package com.android.apkverity;
import android.app.Activity;
-/** Dummy class just to generate some dex */
+/** Placeholder class just to generate some dex */
public class DummyActivity extends Activity {}
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index 1a58f17ef6a0..fa452dd78873 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -674,7 +674,7 @@ public class AppLaunch extends InstrumentationTestCase {
return true;
}
- // iorap compiler filters specified: the compilerFilter must be in the whitelist.
+ // iorap compiler filters specified: the compilerFilter must be in the allowlist.
if (mIorapCompilerFilters.indexOf(compilerFilter) != -1) {
return true;
}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java
index 216e743938ca..df140b976768 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java
@@ -14,17 +14,10 @@
package androidx.media.filterfw;
-import android.annotation.TargetApi;
import android.graphics.Bitmap;
-import android.os.Build;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
import android.util.Log;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Vector;
@@ -42,14 +35,11 @@ final class BackingStore {
static final int ACCESS_OBJECT = 0x08;
/** Access mode Bitmap: Frame data will be accessed as a Bitmap. */
static final int ACCESS_BITMAP = 0x10;
- /** Access mode Allocation: Frame data will be accessed as a RenderScript Allocation. */
- static final int ACCESS_ALLOCATION = 0x20;
private static final int BACKING_BYTEBUFFER = 1;
private static final int BACKING_TEXTURE = 2;
private static final int BACKING_OBJECT = 3;
private static final int BACKING_BITMAP = 4;
- private static final int BACKING_ALLOCATION = 5;
private final FrameType mType;
private int[] mDimensions;
@@ -243,14 +233,6 @@ final class BackingStore {
case ACCESS_BITMAP:
backing = new BitmapBacking();
break;
- case ACCESS_ALLOCATION:
- if (!AllocationBacking.isSupported()) {
- throw new RuntimeException(
- "Attempted to create an AllocationBacking in context that does " +
- "not support RenderScript!");
- }
- backing = new AllocationBacking(mFrameManager.getContext().getRenderScript());
- break;
}
if (backing == null) {
throw new RuntimeException(
@@ -518,9 +500,6 @@ final class BackingStore {
RenderTarget renderTarget = (RenderTarget) backing.lock(ACCESS_RENDERTARGET);
mBitmap.copyPixelsFromBuffer(
renderTarget.getPixelData(mDimensions[0], mDimensions[1]));
- } else if ((access & ACCESS_ALLOCATION) != 0 && AllocationBacking.isSupported()) {
- createBitmap();
- syncToAllocationBacking(backing);
} else {
throw new RuntimeException("Cannot sync bytebuffer backing!");
}
@@ -528,12 +507,6 @@ final class BackingStore {
mIsDirty = false;
}
- @TargetApi(11)
- private void syncToAllocationBacking(Backing backing) {
- Allocation allocation = (Allocation) backing.lock(ACCESS_ALLOCATION);
- allocation.copyTo(mBitmap);
- }
-
@Override
public Object lock(int accessType) {
return mBitmap;
@@ -612,8 +585,6 @@ final class BackingStore {
int w = mDimensions[0];
int h = mDimensions[1];
ImageShader.renderTextureToTarget(texture, getRenderTarget(), w, h);
- } else if ((access & ACCESS_ALLOCATION) != 0 && AllocationBacking.isSupported()) {
- syncToAllocationBacking(backing);
} else {
throw new RuntimeException("Cannot sync bytebuffer backing!");
}
@@ -621,14 +592,6 @@ final class BackingStore {
mIsDirty = false;
}
- @TargetApi(11)
- private void syncToAllocationBacking(Backing backing) {
- Allocation allocation = (Allocation) backing.lock(ACCESS_ALLOCATION);
- ByteBuffer pixels = ByteBuffer.allocateDirect(getSize());
- allocation.copyTo(pixels.array());
- mTexture.allocateWithPixels(pixels, mDimensions[0], mDimensions[1]);
- }
-
@Override
public Object lock(int accessType) {
switch (accessType) {
@@ -733,8 +696,6 @@ final class BackingStore {
ByteBuffer otherBuffer = (ByteBuffer) backing.lock(ACCESS_BYTES);
mBuffer.put(otherBuffer);
otherBuffer.rewind();
- } else if ((access & ACCESS_ALLOCATION) != 0 && AllocationBacking.isSupported()) {
- syncToAllocationBacking(backing);
} else {
throw new RuntimeException("Cannot sync bytebuffer backing!");
}
@@ -743,23 +704,6 @@ final class BackingStore {
mIsDirty = false;
}
- @TargetApi(11)
- private void syncToAllocationBacking(Backing backing) {
- Allocation allocation = (Allocation) backing.lock(ACCESS_ALLOCATION);
- if (getElementId() == FrameType.ELEMENT_RGBA8888) {
- byte[] bytes = mBuffer.array();
- allocation.copyTo(bytes);
- } else if (getElementId() == FrameType.ELEMENT_FLOAT32) {
- float[] floats = new float[getSize() / 4];
- allocation.copyTo(floats);
- mBuffer.asFloatBuffer().put(floats);
- } else {
- throw new RuntimeException(
- "Trying to sync to an allocation with an unsupported element id: "
- + getElementId());
- }
- }
-
@Override
public Object lock(int accessType) {
return mBuffer.rewind();
@@ -791,139 +735,4 @@ final class BackingStore {
}
}
-
- @TargetApi(11)
- static class AllocationBacking extends Backing {
-
- private final RenderScript mRenderScript;
- private Allocation mAllocation = null;
-
- public AllocationBacking(RenderScript renderScript) {
- mRenderScript = renderScript;
- }
-
- @Override
- public void allocate(FrameType frameType) {
- assertCompatible(frameType);
-
- Element element = null;
- switch (frameType.getElementId()) {
- case FrameType.ELEMENT_RGBA8888:
- element = Element.RGBA_8888(mRenderScript);
- break;
- case FrameType.ELEMENT_FLOAT32:
- element = Element.F32(mRenderScript);
- break;
- }
- Type.Builder imageTypeBuilder = new Type.Builder(mRenderScript, element);
- imageTypeBuilder.setX(mDimensions.length >= 1 ? mDimensions[0] : 1);
- imageTypeBuilder.setY(mDimensions.length == 2 ? mDimensions[1] : 1);
- Type imageType = imageTypeBuilder.create();
-
- mAllocation = Allocation.createTyped(mRenderScript, imageType);
- }
-
- @Override
- public int readAccess() {
- return ACCESS_ALLOCATION;
- }
-
- @Override
- public int writeAccess() {
- return ACCESS_ALLOCATION;
- }
-
- @Override
- public boolean requiresGpu() {
- return false;
- }
-
- @Override
- public void syncTo(Backing backing) {
- int access = backing.readAccess();
- if ((access & ACCESS_TEXTURE) != 0) {
- RenderTarget target = (RenderTarget) backing.lock(ACCESS_RENDERTARGET);
- ByteBuffer pixels = ByteBuffer.allocateDirect(getSize());
- GLToolbox.readTarget(target, pixels, mDimensions[0], mDimensions[1]);
- mAllocation.copyFrom(pixels.array());
- } else if ((access & ACCESS_BITMAP) != 0) {
- Bitmap bitmap = (Bitmap) backing.lock(ACCESS_BITMAP);
- mAllocation.copyFrom(bitmap);
- } else if ((access & ACCESS_BYTES) != 0) {
- ByteBuffer buffer = (ByteBuffer) backing.lock(ACCESS_BYTES);
- if (buffer.order() != ByteOrder.nativeOrder()) {
- throw new RuntimeException(
- "Trying to sync to the ByteBufferBacking with non-native byte order!");
- }
- byte[] bytes;
- if (buffer.hasArray()) {
- bytes = buffer.array();
- } else {
- bytes = new byte[getSize()];
- buffer.get(bytes);
- buffer.rewind();
- }
- mAllocation.copyFromUnchecked(bytes);
- } else {
- throw new RuntimeException("Cannot sync allocation backing!");
- }
- backing.unlock();
- mIsDirty = false;
- }
-
- @Override
- public Object lock(int accessType) {
- return mAllocation;
- }
-
- @Override
- public void unlock() {
- }
-
- @Override
- public int getType() {
- return BACKING_ALLOCATION;
- }
-
- @Override
- public boolean shouldCache() {
- return true;
- }
-
- @Override
- public void destroy() {
- if (mAllocation != null) {
- mAllocation.destroy();
- mAllocation = null;
- }
- }
-
- @Override
- public int getSize() {
- int elementCount = 1;
- for (int dim : mDimensions) {
- elementCount *= dim;
- }
- return getElementSize() * elementCount;
- }
-
- public static boolean isSupported() {
- return Build.VERSION.SDK_INT >= 11;
- }
-
- private void assertCompatible(FrameType type) {
- // TODO: consider adding support for other data types.
- if (type.getElementId() != FrameType.ELEMENT_RGBA8888
- && type.getElementId() != FrameType.ELEMENT_FLOAT32) {
- throw new RuntimeException(
- "Cannot allocate allocation with a non-RGBA or non-float data type!");
- }
- if (mDimensions == null || mDimensions.length > 2) {
- throw new RuntimeException(
- "Cannot create an allocation with more than 2 dimensions!");
- }
- }
-
- }
-
}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java
index 0e24f5be954a..20cc1bf3cb80 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java
@@ -16,9 +16,6 @@
package androidx.media.filterfw;
-import android.annotation.TargetApi;
-import android.renderscript.Allocation;
-
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -40,19 +37,6 @@ public class FrameBuffer1D extends Frame {
return (ByteBuffer)mBackingStore.lockData(mode, BackingStore.ACCESS_BYTES);
}
- /**
- * Access frame's data using a RenderScript {@link Allocation}.
- * This is a convenience method and is equivalent to calling {@code lockData} with an
- * {@code accessFormat} of {@code ACCESS_ALLOCATION}.
- *
- * @return The Allocation instance holding the Frame's data.
- */
- @TargetApi(11)
- public Allocation lockAllocation(int mode) {
- assertAccessible(mode);
- return (Allocation) mBackingStore.lockData(mode, BackingStore.ACCESS_ALLOCATION);
- }
-
public int getLength() {
return mLength;
}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java
index 001396527267..4b7ca5306bfb 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java
@@ -113,7 +113,7 @@ public class GraphExporter {
getDotName(target.getFilter().getName()) + ":" +
getDotName(target.getName()) + "_IN;\n" );
} else {
- // Found a unconnected output port, add dummy node
+ // Found a unconnected output port, add placeholder node
String color = filter.getSignature().getOutputPortInfo(portName).isRequired()
? "red" : "blue"; // red for unconnected, required ports
dotFile.write(" " +
@@ -131,7 +131,7 @@ public class GraphExporter {
if(target != null) {
// Found a connection -- nothing to do, connections have been written out above
} else {
- // Found a unconnected input port, add dummy node
+ // Found a unconnected input port, add placeholder node
String color = filter.getSignature().getInputPortInfo(portName).isRequired()
? "red" : "blue"; // red for unconnected, required ports
dotFile.write(" " +
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java
index b7212f982bce..8fd44d2df975 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java
@@ -16,15 +16,12 @@
package androidx.media.filterfw;
-import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
-import android.os.Build;
import android.os.Handler;
import android.os.Looper;
-import android.renderscript.RenderScript;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@@ -66,9 +63,9 @@ public class MffContext {
/**
* On older Android versions the Camera may need a SurfaceView to render into in order to
- * function. You may specify a dummy SurfaceView here if you do not want the context to
+ * function. You may specify a placeholder SurfaceView here if you do not want the context to
* create its own view. Note, that your view may or may not be used. You cannot rely on
- * your dummy view to be used by the Camera. If you pass null, no dummy view will be used.
+ * your placeholder view to be used by the Camera. If you pass null, no placeholder view will be used.
* In this case your application may not run correctly on older devices if you use the
* camera. This flag has no effect if you do not require the camera.
*/
@@ -104,7 +101,7 @@ public class MffContext {
/** The current context state. */
private State mState = new State();
- /** A dummy SurfaceView that is required for Camera operation on older devices. */
+ /** A placeholder SurfaceView that is required for Camera operation on older devices. */
private SurfaceView mDummySurfaceView = null;
/** Handler to execute code in the context's thread, such as issuing callbacks. */
@@ -116,9 +113,6 @@ public class MffContext {
/** Flag whether camera streaming is supported in this context. */
private boolean mCameraStreamingSupport;
- /** RenderScript base master class. */
- private RenderScript mRenderScript;
-
/**
* Creates a new MffContext with the default configuration.
*
@@ -126,7 +120,7 @@ public class MffContext {
* multiple MffContexts, however data between them cannot be shared. The context must be
* created in a thread with a Looper (such as the main/UI thread).
*
- * On older versions of Android, the MffContext may create a visible dummy view for the
+ * On older versions of Android, the MffContext may create a visible placeholder view for the
* camera to render into. This is a 1x1 SurfaceView that is placed into the top-left corner.
*
* @param context The application context to attach the MffContext to.
@@ -142,7 +136,7 @@ public class MffContext {
* multiple MffContexts, however data between them cannot be shared. The context must be
* created in a thread with a Looper (such as the main/UI thread).
*
- * On older versions of Android, the MffContext may create a visible dummy view for the
+ * On older versions of Android, the MffContext may create a visible placeholder view for the
* camera to render into. This is a 1x1 SurfaceView that is placed into the top-left corner.
* You may alternatively specify your own SurfaceView in the configuration.
*
@@ -200,9 +194,7 @@ public class MffContext {
mCameraStreamer.stop();
mCameraStreamer.tearDown();
}
- if (Build.VERSION.SDK_INT >= 11) {
- maybeDestroyRenderScript();
- }
+
stopRunners(false);
waitUntilStopped();
tearDown();
@@ -301,14 +293,6 @@ public class MffContext {
return mCameraStreamingSupport;
}
- @TargetApi(11)
- public final RenderScript getRenderScript() {
- if (mRenderScript == null) {
- mRenderScript = RenderScript.create(mApplicationContext);
- }
- return mRenderScript;
- }
-
final void assertOpenGLSupported() {
if (!isOpenGLSupported()) {
throw new RuntimeException("Attempting to use OpenGL ES 2 in a context that does not "
@@ -459,12 +443,4 @@ public class MffContext {
return (context instanceof Activity) ? (Activity) context : null;
}
- @TargetApi(11)
- private void maybeDestroyRenderScript() {
- if (mRenderScript != null) {
- mRenderScript.destroy();
- mRenderScript = null;
- }
- }
-
}
diff --git a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java
index e995a26ea5c9..2ca91fbc1d3d 100644
--- a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java
+++ b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java
@@ -16,7 +16,7 @@
package com.android.dcl;
-/** Dummy class which is built into a jar purely so we can pass it to DexClassLoader. */
+/** Placeholder class which is built into a jar purely so we can pass it to DexClassLoader. */
public final class Simple {
public Simple() {}
}
diff --git a/tests/Internal/src/stub/DummyWallpaperService.java b/tests/Internal/src/stub/DummyWallpaperService.java
index 084c036bea26..db1b7805a316 100644
--- a/tests/Internal/src/stub/DummyWallpaperService.java
+++ b/tests/Internal/src/stub/DummyWallpaperService.java
@@ -19,7 +19,7 @@ package stub;
import android.service.wallpaper.WallpaperService;
/**
- * Dummy wallpaper service only for test purposes, won't draw anything.
+ * Placeholder wallpaper service only for test purposes, won't draw anything.
*/
public class DummyWallpaperService extends WallpaperService {
@Override
diff --git a/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java b/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java
index 731be8e3d9f0..a77950fe4a2d 100644
--- a/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java
+++ b/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java
@@ -24,7 +24,7 @@ import android.os.ServiceManager;
import com.android.internal.compat.IPlatformCompat;
/**
- * This is a dummy API to test gating
+ * This is a placeholder API to test gating
*
* @hide
*/
@@ -36,7 +36,7 @@ public class DummyApi {
public static final long CHANGE_SYSTEM_SERVER = 666016;
/**
- * Dummy method
+ * Placeholder method
* @return "A" if change is enabled, "B" otherwise.
*/
public static String dummyFunc() {
@@ -47,7 +47,7 @@ public class DummyApi {
}
/**
- * Dummy combined method
+ * Placeholder combined method
* @return "0" if {@link CHANGE_ID_1} is disabled and {@link CHANGE_ID_2} is disabled,
"1" if {@link CHANGE_ID_1} is disabled and {@link CHANGE_ID_2} is enabled,
"2" if {@link CHANGE_ID_1} is enabled and {@link CHANGE_ID_2} is disabled,
@@ -68,7 +68,7 @@ public class DummyApi {
}
/**
- * Dummy api using system server API.
+ * Placeholder api using system server API.
*/
public static boolean dummySystemServer(Context context) {
IPlatformCompat platformCompat = IPlatformCompat.Stub
diff --git a/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java b/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
index 6d4ffcff7d45..f9e920518688 100644
--- a/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
+++ b/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
@@ -469,7 +469,7 @@ public class SoundTriggerTestService extends Service {
}
}
- // Create a few dummy models if we didn't load anything.
+ // Create a few placeholder models if we didn't load anything.
if (!loadedModel) {
Properties dummyModelProperties = new Properties();
for (String name : new String[]{"1", "2", "3"}) {
diff --git a/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java b/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
index 9999aba37d8d..673c73aa2aac 100644
--- a/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
+++ b/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
@@ -22,7 +22,7 @@ package com.android.test.libs.system_ext;
public class LibsSystemExtTest {
/**
- * Dummy method for testing.
+ * Placeholder method for testing.
*/
public static void test() {
}
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index b94d14fd4b75..0fc2617bb9f2 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1540,7 +1540,7 @@ status_t AaptAssets::buildIncludedResources(Bundle* bundle)
}
const String8& featureOfBase = bundle->getFeatureOfPackage();
- if (!featureOfBase.isEmpty()) {
+ if (!featureOfBase.empty()) {
if (bundle->getVerbose()) {
printf("Including base feature resources from package: %s\n",
featureOfBase.c_str());
diff --git a/tools/aapt/Android.bp b/tools/aapt/Android.bp
index cc10db9e1523..cecd95a5e616 100644
--- a/tools/aapt/Android.bp
+++ b/tools/aapt/Android.bp
@@ -97,6 +97,7 @@ cc_library_host_static {
"ResourceTable.cpp",
"SourcePos.cpp",
"StringPool.cpp",
+ "Utils.cpp",
"WorkQueue.cpp",
"XMLNode.cpp",
"ZipEntry.cpp",
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 5a06b102592a..60f3f2715395 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -1133,7 +1133,7 @@ int doDump(Bundle* bundle)
if (code == ResXMLTree::END_TAG) {
depth--;
if (depth < 2) {
- if (withinSupportsInput && !supportedInput.isEmpty()) {
+ if (withinSupportsInput && !supportedInput.empty()) {
printf("supports-input: '");
const size_t N = supportedInput.size();
for (size_t i=0; i<N; i++) {
@@ -1300,7 +1300,7 @@ int doDump(Bundle* bundle)
ResTable::normalizeForOutput(versionName.c_str()).c_str());
String8 splitName = AaptXml::getAttribute(tree, NULL, "split");
- if (!splitName.isEmpty()) {
+ if (!splitName.empty()) {
printf(" split='%s'", ResTable::normalizeForOutput(
splitName.c_str()).c_str());
}
diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp
index 965655b59a94..a7ff5fabf495 100644
--- a/tools/aapt/Package.cpp
+++ b/tools/aapt/Package.cpp
@@ -8,6 +8,7 @@
#include "OutputSet.h"
#include "ResourceTable.h"
#include "ResourceFilter.h"
+#include "Utils.h"
#include <androidfw/misc.h>
@@ -226,7 +227,7 @@ ssize_t processAssets(Bundle* bundle, ZipFile* zip, const sp<const OutputSet>& o
fprintf(stderr, "warning: null file being processed.\n");
} else {
String8 storagePath(entry.getPath());
- storagePath.convertToResPath();
+ convertToResPath(storagePath);
if (!processFile(bundle, zip, storagePath, entry.getFile())) {
return UNKNOWN_ERROR;
}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 4ca3a68d02a6..4a360ed1c80e 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -15,6 +15,7 @@
#include "ResourceTable.h"
#include "StringPool.h"
#include "Symbol.h"
+#include "Utils.h"
#include "WorkQueue.h"
#include "XMLNode.h"
@@ -321,7 +322,7 @@ static status_t makeFileResources(Bundle* bundle, const sp<AaptAssets>& assets,
str++;
}
String8 resPath = it.getPath();
- resPath.convertToResPath();
+ convertToResPath(resPath);
status_t result = table->addEntry(SourcePos(it.getPath(), 0),
String16(assets->getPackage()),
type16,
@@ -1284,7 +1285,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
packageType = ResourceTable::SharedLibrary;
} else if (bundle->getExtending()) {
packageType = ResourceTable::System;
- } else if (!bundle->getFeatureOfPackage().isEmpty()) {
+ } else if (!bundle->getFeatureOfPackage().empty()) {
packageType = ResourceTable::AppFeature;
}
@@ -3143,7 +3144,7 @@ writeProguardForXml(ProguardKeepSet* keep, const sp<AaptFile>& layoutFile,
tree.restart();
- if (!startTags.isEmpty()) {
+ if (!startTags.empty()) {
bool haveStart = false;
while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
if (code != ResXMLTree::START_TAG) {
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 3abb89acd23b..bccf73e69c34 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -11,6 +11,7 @@
#include "ResourceFilter.h"
#include "ResourceIdCache.h"
#include "SdkConstants.h"
+#include "Utils.h"
#include <algorithm>
#include <androidfw/ResourceTypes.h>
@@ -1812,7 +1813,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
mTypeIdOffset = findLargestTypeIdForPackage(assets->getIncludedResources(), mAssetsPackage);
const String8& featureAfter = bundle->getFeatureAfterPackage();
- if (!featureAfter.isEmpty()) {
+ if (!featureAfter.empty()) {
AssetManager featureAssetManager;
if (!featureAssetManager.addAssetPath(featureAfter, NULL)) {
fprintf(stderr, "ERROR: Feature package '%s' not found.\n",
@@ -1822,7 +1823,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
const ResTable& featureTable = featureAssetManager.getResources(false);
mTypeIdOffset = std::max(mTypeIdOffset,
- findLargestTypeIdForPackage(featureTable, mAssetsPackage));
+ findLargestTypeIdForPackage(featureTable, mAssetsPackage));
}
return NO_ERROR;
@@ -3251,7 +3252,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>&
// If we're building splits, then each invocation of the flattening
// step will have 'missing' entries. Don't warn/error for this case.
- if (bundle->getSplitConfigurations().isEmpty()) {
+ if (bundle->getSplitConfigurations().empty()) {
bool missing_entry = false;
const char* log_prefix = bundle->getErrorOnMissingConfigEntry() ?
"error" : "warning";
@@ -4803,7 +4804,7 @@ bool ResourceTable::versionForCompat(const Bundle* bundle, const String16& resou
String8 resPath = String8::format("res/%s/%s.xml",
newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(),
String8(resourceName).c_str());
- resPath.convertToResPath();
+ convertToResPath(resPath);
// Add a resource table entry.
addEntry(SourcePos(),
@@ -4857,7 +4858,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
Vector<sp<XMLNode> > nodesToVisit;
nodesToVisit.push(root);
- while (!nodesToVisit.isEmpty()) {
+ while (!nodesToVisit.empty()) {
sp<XMLNode> node = nodesToVisit.top();
nodesToVisit.pop();
@@ -4927,7 +4928,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
String8 resPath = String8::format("res/%s/%s.xml",
newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(),
String8(resourceName).c_str());
- resPath.convertToResPath();
+ convertToResPath(resPath);
// Add a resource table entry.
if (bundle->getVerbose()) {
diff --git a/tools/aapt/SourcePos.cpp b/tools/aapt/SourcePos.cpp
index e13028684414..354a65c14772 100644
--- a/tools/aapt/SourcePos.cpp
+++ b/tools/aapt/SourcePos.cpp
@@ -78,7 +78,7 @@ ErrorPos::print(FILE* to) const
break;
}
- if (!this->file.isEmpty()) {
+ if (!this->file.empty()) {
if (this->line >= 0) {
fprintf(to, "%s:%d: %s%s\n", this->file.c_str(), this->line, type, this->error.c_str());
} else {
diff --git a/tools/aapt/Utils.cpp b/tools/aapt/Utils.cpp
new file mode 100644
index 000000000000..36b018e7dd2c
--- /dev/null
+++ b/tools/aapt/Utils.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005 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 "Utils.h"
+
+#include <utils/Compat.h>
+
+// Separator used by resource paths. This is not platform dependent contrary
+// to OS_PATH_SEPARATOR.
+#define RES_PATH_SEPARATOR '/'
+
+using android::String8;
+
+void convertToResPath([[maybe_unused]] String8& s) {
+#if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR
+ size_t len = s.length();
+ if (len > 0) {
+ char* buf = s.lockBuffer(len);
+ for (char* end = buf + len; buf < end; ++buf) {
+ if (*buf == OS_PATH_SEPARATOR) *buf = RES_PATH_SEPARATOR;
+ }
+ s.unlockBuffer(len);
+ }
+#endif
+}
diff --git a/tools/aapt/Utils.h b/tools/aapt/Utils.h
new file mode 100644
index 000000000000..8eb594138478
--- /dev/null
+++ b/tools/aapt/Utils.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005 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
+
+// This file contains cruft that used to be in libutils' String8, that's only
+// used for aapt.
+
+#include <utils/String8.h>
+
+// Converts all separators in this string to /, the default path
+// separator.
+// If the default OS separator is backslash, this converts all
+// backslashes to slashes, in-place. Otherwise it does nothing.
+void convertToResPath(android::String8&);
diff --git a/tools/aapt2/DominatorTree_test.cpp b/tools/aapt2/DominatorTree_test.cpp
index 52949da1b64f..a0679a65b9fd 100644
--- a/tools/aapt2/DominatorTree_test.cpp
+++ b/tools/aapt2/DominatorTree_test.cpp
@@ -50,8 +50,7 @@ class PrettyPrinter : public DominatorTree::Visitor {
private:
void VisitConfig(const DominatorTree::Node* node, const int indent) {
auto config_string = node->value()->config.toString();
- buffer_ << std::string(indent, ' ')
- << (config_string.isEmpty() ? "<default>" : config_string)
+ buffer_ << std::string(indent, ' ') << (config_string.empty() ? "<default>" : config_string)
<< std::endl;
}
diff --git a/tools/obbtool/Main.cpp b/tools/obbtool/Main.cpp
index 64808c0a755f..70140685e37e 100644
--- a/tools/obbtool/Main.cpp
+++ b/tools/obbtool/Main.cpp
@@ -135,7 +135,7 @@ void doInfo(const char* filename) {
}
printf("OBB info for '%s':\n", filename);
- printf("Package name: %s\n", obb->getPackageName().string());
+ printf("Package name: %s\n", obb->getPackageName().c_str());
printf(" Version: %d\n", obb->getVersion());
printf(" Flags: 0x%08x\n", obb->getFlags());
printf(" Overlay: %s\n", obb->isOverlay() ? "true" : "false");
diff --git a/tools/split-select/SplitDescription.cpp b/tools/split-select/SplitDescription.cpp
index 4e2b48e1f450..71500080193f 100644
--- a/tools/split-select/SplitDescription.cpp
+++ b/tools/split-select/SplitDescription.cpp
@@ -70,7 +70,7 @@ bool SplitDescription::match(const SplitDescription& o) const {
String8 SplitDescription::toString() const {
String8 extension;
if (abi != abi::Variant_none) {
- if (extension.isEmpty()) {
+ if (extension.empty()) {
extension.append(":");
} else {
extension.append("-");