diff options
24 files changed, 138 insertions, 270 deletions
diff --git a/AconfigFlags.bp b/AconfigFlags.bp index b753aab33dcd..34a62152487d 100644 --- a/AconfigFlags.bp +++ b/AconfigFlags.bp @@ -20,6 +20,7 @@ java_defaults { 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}", ], } @@ -56,3 +57,16 @@ java_aconfig_library { 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/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/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 8ceb9ec13d88..74ca41d0f9b4 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -691,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); } @@ -821,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 { 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/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/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/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_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index 1c597424f221..eb49f411159c 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -874,7 +874,7 @@ 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; } diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp index 5293c583cfd0..3e4c7c7f751e 100644 --- a/core/jni/android_hardware_camera2_CameraMetadata.cpp +++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp @@ -526,7 +526,7 @@ 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()) { + } else if (!logLine.empty()) { ALOGD("%s", logLine.string()); } 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/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/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/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/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/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/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/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/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/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/MffContext.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java index 6bd6c18f1c0a..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; @@ -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. * @@ -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; - } - } - } |