summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/accounts/AccountManager.java2
-rw-r--r--core/java/android/animation/FloatEvaluator.java2
-rw-r--r--core/java/android/app/ActivityManagerNative.java5
-rw-r--r--core/java/android/app/ActivityThread.java6
-rw-r--r--core/java/android/app/ContextImpl.java14
-rw-r--r--core/java/android/app/IActivityManager.aidl2
-rw-r--r--core/java/android/app/IUiModeManager.aidl1
-rw-r--r--core/java/android/app/PackageDeleteObserver.java5
-rw-r--r--core/java/android/app/PackageInstallObserver.java5
-rw-r--r--core/java/android/app/ResourcesManager.java7
-rw-r--r--core/java/android/app/SystemServiceRegistry.java17
-rw-r--r--core/java/android/app/TaskStackListener.java5
-rw-r--r--core/java/android/app/UiAutomationConnection.java6
-rw-r--r--core/java/android/app/UserSwitchObserver.java5
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java51
-rw-r--r--core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl2
-rw-r--r--core/java/android/content/Context.java53
-rw-r--r--core/java/android/content/ContextWrapper.java41
-rw-r--r--core/java/android/content/SyncStats.java2
-rw-r--r--core/java/android/content/UndoManager.java6
-rw-r--r--core/java/android/content/pm/PackageParser.java130
-rw-r--r--core/java/android/content/res/ConfigurationBoundResourceCache.java5
-rw-r--r--core/java/android/content/res/DrawableCache.java5
-rw-r--r--core/java/android/content/res/TypedArray.java5
-rw-r--r--core/java/android/database/IContentObserver.aidl1
-rw-r--r--core/java/android/net/ConnectivityManager.java4
-rw-r--r--core/java/android/net/IConnectivityManager.aidl2
-rw-r--r--core/java/android/net/InterfaceConfiguration.java4
-rw-r--r--core/java/android/net/LinkProperties.java2
-rw-r--r--core/java/android/net/MobileLinkQualityInfo.java4
-rw-r--r--core/java/android/net/NetworkAgent.java12
-rw-r--r--core/java/android/net/NetworkScore.java157
-rw-r--r--core/java/android/net/SntpClient.java4
-rw-r--r--core/java/android/net/nsd/NsdManager.java4
-rw-r--r--core/java/android/net/util/SocketUtils.java14
-rw-r--r--core/java/android/os/AsyncTask.java22
-rw-r--r--core/java/android/os/BatteryStats.java46
-rw-r--r--core/java/android/os/BinderProxy.java59
-rw-r--r--core/java/android/os/CancellationSignal.java7
-rw-r--r--core/java/android/os/Debug.java2
-rw-r--r--core/java/android/os/IDeviceIdleController.aidl2
-rw-r--r--core/java/android/os/INetworkManagementService.aidl1
-rw-r--r--core/java/android/os/IPowerManager.aidl1
-rw-r--r--core/java/android/os/Parcel.java6
-rw-r--r--core/java/android/os/PowerManager.java1
-rw-r--r--core/java/android/os/Process.java1
-rw-r--r--core/java/android/os/Registrant.java1
-rw-r--r--core/java/android/os/RegistrantList.java6
-rw-r--r--core/java/android/os/RemoteCallback.java3
-rw-r--r--core/java/android/os/ServiceManager.java4
-rw-r--r--core/java/android/os/ServiceManagerNative.java4
-rw-r--r--core/java/android/os/SystemProperties.java5
-rw-r--r--core/java/android/os/UserHandle.java1
-rw-r--r--core/java/android/os/UserManager.java2
-rw-r--r--core/java/android/os/WorkSource.java4
-rw-r--r--core/java/android/os/image/DynamicSystemManager.java9
-rw-r--r--core/java/android/os/image/IDynamicSystemService.aidl7
-rw-r--r--core/java/android/os/storage/StorageEventListener.java5
-rw-r--r--core/java/android/os/telephony/TelephonyRegistryManager.java548
-rw-r--r--core/java/android/provider/CallLog.java18
-rw-r--r--core/java/android/provider/Settings.java9
-rw-r--r--core/java/android/provider/SettingsStringUtil.java2
-rw-r--r--core/java/android/service/carrier/CarrierMessagingServiceWrapper.java389
-rw-r--r--core/java/android/service/carrier/CarrierService.java21
-rw-r--r--core/java/android/service/carrier/ICarrierMessagingService.aidl1
-rw-r--r--core/java/android/service/dreams/IDreamManager.aidl1
-rw-r--r--core/java/android/service/euicc/EuiccService.java42
-rw-r--r--core/java/android/service/euicc/IEuiccService.aidl2
-rw-r--r--core/java/android/service/notification/NotificationListenerService.java15
-rw-r--r--core/java/android/util/Singleton.java5
-rw-r--r--core/java/android/view/AccessibilityIterators.java4
-rw-r--r--core/java/android/view/IWindowManager.aidl2
-rw-r--r--core/java/android/view/View.java30
-rw-r--r--core/java/android/view/ViewDebug.java101
-rw-r--r--core/java/android/view/ViewTreeObserver.java5
-rw-r--r--core/java/android/view/animation/AnimationUtils.java8
-rw-r--r--core/java/android/webkit/CacheManager.java5
-rw-r--r--core/java/android/webkit/CookieManager.java5
-rw-r--r--core/java/android/webkit/WebChromeClient.java34
-rw-r--r--core/java/android/webkit/WebSettings.java7
-rw-r--r--core/java/android/widget/ListView.java4
-rw-r--r--core/java/android/widget/RelativeLayout.java8
-rw-r--r--core/java/android/widget/ScrollBarDrawable.java4
-rw-r--r--core/java/com/android/internal/app/AlertActivity.java4
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java4
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java4
-rw-r--r--core/java/com/android/internal/compat/CompatibilityChangeConfig.java12
-rw-r--r--core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl19
-rw-r--r--core/java/com/android/internal/compat/CompatibilityChangeInfo.java92
-rw-r--r--core/java/com/android/internal/compat/IPlatformCompat.aidl19
-rw-r--r--core/java/com/android/internal/content/PackageMonitor.java5
-rw-r--r--core/java/com/android/internal/logging/MetricsLogger.java4
-rw-r--r--core/java/com/android/internal/net/LegacyVpnInfo.java4
-rw-r--r--core/java/com/android/internal/net/VpnConfig.java4
-rw-r--r--core/java/com/android/internal/os/BaseCommand.java4
-rw-r--r--core/java/com/android/internal/os/BatterySipper.java2
-rw-r--r--core/java/com/android/internal/os/Zygote.java7
-rw-r--r--core/java/com/android/internal/os/ZygoteInit.java12
-rw-r--r--core/java/com/android/internal/preference/YesNoPreference.java3
-rw-r--r--core/java/com/android/internal/util/MemInfoReader.java4
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java6
-rw-r--r--core/java/com/android/internal/widget/PointerLocationView.java4
-rw-r--r--core/java/com/android/server/net/BaseNetworkObserver.java5
-rw-r--r--core/java/com/google/android/util/AbstractMessageParser.java8
-rw-r--r--core/jni/fd_utils.cpp26
-rw-r--r--core/proto/OWNERS2
-rw-r--r--core/proto/android/app/settings_enums.proto5
-rw-r--r--core/res/AndroidManifest.xml1
-rw-r--r--core/res/res/values-mcc208-mnc10-fr/strings.xml5
-rw-r--r--core/res/res/values/config.xml2
-rw-r--r--core/res/res/values/strings.xml4
-rw-r--r--core/tests/coretests/src/android/content/pm/PackageParserTest.java7
-rw-r--r--core/tests/coretests/src/android/provider/SettingsBackupTest.java1
113 files changed, 2114 insertions, 224 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index f4e465ab3adb..2d7adf3cfef2 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -2257,6 +2257,8 @@ public class AccountManager {
}
private abstract class AmsTask extends FutureTask<Bundle> implements AccountManagerFuture<Bundle> {
+
+
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
final IAccountManagerResponse mResponse;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
diff --git a/core/java/android/animation/FloatEvaluator.java b/core/java/android/animation/FloatEvaluator.java
index 9463aa12d116..ae90e37d4c71 100644
--- a/core/java/android/animation/FloatEvaluator.java
+++ b/core/java/android/animation/FloatEvaluator.java
@@ -24,7 +24,7 @@ public class FloatEvaluator implements TypeEvaluator<Number> {
/**
* This function returns the result of linearly interpolating the start and end values, with
* <code>fraction</code> representing the proportion between the start and end values. The
- * calculation is a simple parametric calculation: <code>result = x0 + t * (v1 - v0)</code>,
+ * calculation is a simple parametric calculation: <code>result = x0 + t * (x1 - x0)</code>,
* where <code>x0</code> is <code>startValue</code>, <code>x1</code> is <code>endValue</code>,
* and <code>t</code> is <code>fraction</code>.
*
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 37509e18ba6f..607ef185ae60 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -25,6 +25,11 @@ import android.os.IBinder;
*/
@Deprecated
public abstract class ActivityManagerNative {
+
+ @UnsupportedAppUsage
+ public ActivityManagerNative() {
+ }
+
/**
* Cast a Binder object into an activity manager interface, generating
* a proxy if needed.
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index f0dcc51c746a..4e8bee24052e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -714,6 +714,9 @@ public final class ActivityThread extends ClientTransactionHandler {
static final class CreateServiceData {
@UnsupportedAppUsage
+ CreateServiceData() {
+ }
+ @UnsupportedAppUsage
IBinder token;
@UnsupportedAppUsage
ServiceInfo info;
@@ -755,6 +758,9 @@ public final class ActivityThread extends ClientTransactionHandler {
static final class AppBindData {
@UnsupportedAppUsage
+ AppBindData() {
+ }
+ @UnsupportedAppUsage
LoadedApk info;
@UnsupportedAppUsage
String processName;
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index b915473cf34e..69be171ee46e 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -72,6 +72,7 @@ import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructStat;
+import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.ArrayMap;
import android.util.Log;
@@ -1330,6 +1331,19 @@ class ContextImpl extends Context {
}
@Override
+ public void sendOrderedBroadcast(Intent intent, String receiverPermission,
+ String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler,
+ int initialCode, String initialData, @Nullable Bundle initialExtras) {
+ int intAppOp = AppOpsManager.OP_NONE;
+ if (!TextUtils.isEmpty(receiverAppOp)) {
+ intAppOp = AppOpsManager.strOpToOp(receiverAppOp);
+ }
+ sendOrderedBroadcastAsUser(intent, getUser(),
+ receiverPermission, intAppOp, resultReceiver, scheduler, initialCode, initialData,
+ initialExtras);
+ }
+
+ @Override
@Deprecated
public void sendStickyBroadcast(Intent intent) {
warnIfCallingFromSystemProcess();
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index 48ca71690a1b..feaddda044c4 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -122,6 +122,7 @@ interface IActivityManager {
in String resultData, in Bundle map, in String[] requiredPermissions,
int appOp, in Bundle options, boolean serialized, boolean sticky, int userId);
void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId);
+ @UnsupportedAppUsage
oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map,
boolean abortBroadcast, int flags);
void attachApplication(in IApplicationThread app, long startSeq);
@@ -211,6 +212,7 @@ interface IActivityManager {
@UnsupportedAppUsage
ParceledListSlice getRecentTasks(int maxNum, int flags, int userId);
+ @UnsupportedAppUsage
oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res);
@UnsupportedAppUsage
IIntentSender getIntentSender(int type, in String packageName, in IBinder token,
diff --git a/core/java/android/app/IUiModeManager.aidl b/core/java/android/app/IUiModeManager.aidl
index cae54b6c0611..f2c9f615c03f 100644
--- a/core/java/android/app/IUiModeManager.aidl
+++ b/core/java/android/app/IUiModeManager.aidl
@@ -30,6 +30,7 @@ interface IUiModeManager {
/**
* Disables the car mode.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void disableCarMode(int flags);
/**
diff --git a/core/java/android/app/PackageDeleteObserver.java b/core/java/android/app/PackageDeleteObserver.java
index 20ae84ca8c39..b7b0b192e7ae 100644
--- a/core/java/android/app/PackageDeleteObserver.java
+++ b/core/java/android/app/PackageDeleteObserver.java
@@ -22,6 +22,11 @@ import android.content.pm.IPackageDeleteObserver2;
/** {@hide} */
public class PackageDeleteObserver {
+
+ @UnsupportedAppUsage
+ public PackageDeleteObserver() {
+ }
+
private final IPackageDeleteObserver2.Stub mBinder = new IPackageDeleteObserver2.Stub() {
@Override
public void onUserActionRequired(Intent intent) {
diff --git a/core/java/android/app/PackageInstallObserver.java b/core/java/android/app/PackageInstallObserver.java
index 507ebe566d46..50031e0e4d35 100644
--- a/core/java/android/app/PackageInstallObserver.java
+++ b/core/java/android/app/PackageInstallObserver.java
@@ -23,6 +23,11 @@ import android.os.Bundle;
/** {@hide} */
public class PackageInstallObserver {
+
+ @UnsupportedAppUsage
+ public PackageInstallObserver() {
+ }
+
private final IPackageInstallObserver2.Stub mBinder = new IPackageInstallObserver2.Stub() {
@Override
public void onUserActionRequired(Intent intent) {
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java
index 40cb29fc80ab..e9ae60f23cf2 100644
--- a/core/java/android/app/ResourcesManager.java
+++ b/core/java/android/app/ResourcesManager.java
@@ -145,6 +145,9 @@ public class ResourcesManager {
* Resources and base configuration override associated with an Activity.
*/
private static class ActivityResources {
+ @UnsupportedAppUsage
+ private ActivityResources() {
+ }
public final Configuration overrideConfig = new Configuration();
public final ArrayList<WeakReference<Resources>> activityResources = new ArrayList<>();
}
@@ -164,6 +167,10 @@ public class ResourcesManager {
mAdjustedDisplays = new ArrayMap<>();
@UnsupportedAppUsage
+ public ResourcesManager() {
+ }
+
+ @UnsupportedAppUsage
public static ResourcesManager getInstance() {
synchronized (ResourcesManager.class) {
if (sResourcesManager == null) {
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index d29cf80bd74e..2301b0e0b68f 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -157,6 +157,7 @@ import android.os.health.SystemHealthManager;
import android.os.image.DynamicSystemManager;
import android.os.image.IDynamicSystemService;
import android.os.storage.StorageManager;
+import android.os.telephony.TelephonyRegistryManager;
import android.permission.PermissionControllerManager;
import android.permission.PermissionManager;
import android.print.IPrintManager;
@@ -172,6 +173,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccCardManager;
import android.telephony.euicc.EuiccManager;
+import android.telephony.ims.ImsManager;
import android.telephony.ims.RcsMessageManager;
import android.util.ArrayMap;
import android.util.Log;
@@ -607,6 +609,13 @@ final class SystemServiceRegistry {
return new TelephonyManager(ctx.getOuterContext());
}});
+ registerService(Context.TELEPHONY_REGISTRY_SERVICE, TelephonyRegistryManager.class,
+ new CachedServiceFetcher<TelephonyRegistryManager>() {
+ @Override
+ public TelephonyRegistryManager createService(ContextImpl ctx) {
+ return new TelephonyRegistryManager();
+ }});
+
registerService(Context.TELEPHONY_SUBSCRIPTION_SERVICE, SubscriptionManager.class,
new CachedServiceFetcher<SubscriptionManager>() {
@Override
@@ -622,6 +631,14 @@ final class SystemServiceRegistry {
}
});
+ registerService(Context.TELEPHONY_IMS_SERVICE, ImsManager.class,
+ new CachedServiceFetcher<ImsManager>() {
+ @Override
+ public ImsManager createService(ContextImpl ctx) {
+ return new ImsManager(ctx.getOuterContext());
+ }
+ });
+
registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class,
new CachedServiceFetcher<CarrierConfigManager>() {
@Override
diff --git a/core/java/android/app/TaskStackListener.java b/core/java/android/app/TaskStackListener.java
index b4b7df970493..50130400deab 100644
--- a/core/java/android/app/TaskStackListener.java
+++ b/core/java/android/app/TaskStackListener.java
@@ -30,6 +30,11 @@ import android.os.RemoteException;
* @hide
*/
public abstract class TaskStackListener extends ITaskStackListener.Stub {
+
+ @UnsupportedAppUsage
+ public TaskStackListener() {
+ }
+
@Override
@UnsupportedAppUsage
public void onTaskStackChanged() throws RemoteException {
diff --git a/core/java/android/app/UiAutomationConnection.java b/core/java/android/app/UiAutomationConnection.java
index dc07df8d7a87..f251b3eb4a15 100644
--- a/core/java/android/app/UiAutomationConnection.java
+++ b/core/java/android/app/UiAutomationConnection.java
@@ -40,6 +40,8 @@ import android.view.WindowContentFrameStats;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManager;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import libcore.io.IoUtils;
import java.io.FileInputStream;
@@ -87,6 +89,10 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
private int mOwningUid;
+ @UnsupportedAppUsage
+ public UiAutomationConnection() {
+ }
+
@Override
public void connect(IAccessibilityServiceClient client, int flags) {
if (client == null) {
diff --git a/core/java/android/app/UserSwitchObserver.java b/core/java/android/app/UserSwitchObserver.java
index 25b243d95fa1..2f8ee744bfd6 100644
--- a/core/java/android/app/UserSwitchObserver.java
+++ b/core/java/android/app/UserSwitchObserver.java
@@ -24,6 +24,11 @@ import android.os.RemoteException;
* @hide
*/
public class UserSwitchObserver extends IUserSwitchObserver.Stub {
+
+ @UnsupportedAppUsage
+ public UserSwitchObserver() {
+ }
+
@Override
public void onUserSwitching(int newUserId, IRemoteCallback reply) throws RemoteException {
if (reply != null) {
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index e7ba85ad5d9e..566b38738dc1 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1189,13 +1189,11 @@ public final class BluetoothAdapter {
/**
* Factory reset bluetooth settings.
*
- * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}
- * permission
- *
* @return true to indicate that the config file was successfully cleared
* @hide
*/
- @UnsupportedAppUsage
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean factoryReset() {
try {
mServiceLock.readLock().lock();
@@ -1214,13 +1212,12 @@ public final class BluetoothAdapter {
/**
* Get the UUIDs supported by the local Bluetooth adapter.
*
- * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
- *
* @return the UUIDs supported by the local Bluetooth Adapter.
* @hide
*/
@UnsupportedAppUsage
- public ParcelUuid[] getUuids() {
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
+ public @NonNull ParcelUuid[] getUuids() {
if (getState() != STATE_ON) {
return null;
}
@@ -1476,7 +1473,6 @@ public final class BluetoothAdapter {
* will return false. After turning on Bluetooth,
* wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON}
* to get the updated value.
- * <p>Requires {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}
* <p>Applications cannot set the scan mode. They should use
* <code>startActivityForResult(
* BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE})
@@ -1488,8 +1484,8 @@ public final class BluetoothAdapter {
* @return true if the scan mode was set, false otherwise
* @hide
*/
- @UnsupportedAppUsage(publicAlternatives = "Use {@link #ACTION_REQUEST_DISCOVERABLE}, which "
- + "shows UI that confirms the user wants to go into discoverable mode.")
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean setScanMode(@ScanMode int mode, int duration) {
if (getState() != STATE_ON) {
return false;
@@ -1507,9 +1503,34 @@ public final class BluetoothAdapter {
return false;
}
- /** @hide */
- @UnsupportedAppUsage
- public boolean setScanMode(int mode) {
+ /**
+ * Set the Bluetooth scan mode of the local Bluetooth adapter.
+ * <p>The Bluetooth scan mode determines if the local adapter is
+ * connectable and/or discoverable from remote Bluetooth devices.
+ * <p>For privacy reasons, discoverable mode is automatically turned off
+ * after <code>duration</code> seconds. For example, 120 seconds should be
+ * enough for a remote device to initiate and complete its discovery
+ * process.
+ * <p>Valid scan mode values are:
+ * {@link #SCAN_MODE_NONE},
+ * {@link #SCAN_MODE_CONNECTABLE},
+ * {@link #SCAN_MODE_CONNECTABLE_DISCOVERABLE}.
+ * <p>If Bluetooth state is not {@link #STATE_ON}, this API
+ * will return false. After turning on Bluetooth,
+ * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON}
+ * to get the updated value.
+ * <p>Applications cannot set the scan mode. They should use
+ * <code>startActivityForResult(
+ * BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE})
+ * </code>instead.
+ *
+ * @param mode valid scan mode
+ * @return true if the scan mode was set, false otherwise
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
+ public boolean setScanMode(@ScanMode int mode) {
if (getState() != STATE_ON) {
return false;
}
@@ -1562,6 +1583,8 @@ public final class BluetoothAdapter {
* been called recently.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public long getDiscoveryEndMillis() {
try {
mServiceLock.readLock().lock();
@@ -2060,7 +2083,7 @@ public final class BluetoothAdapter {
* BluetoothProfile}.
* @hide
*/
- public List<Integer> getSupportedProfiles() {
+ public @NonNull List<Integer> getSupportedProfiles() {
final ArrayList<Integer> supportedProfiles = new ArrayList<Integer>();
try {
diff --git a/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl b/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
index 5f73e551d57c..c9dc019bd2f2 100644
--- a/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
+++ b/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
@@ -18,6 +18,8 @@ package android.companion;
/** @hide */
interface ICompanionDeviceDiscoveryServiceCallback {
+ @UnsupportedAppUsage
oneway void onDeviceSelected(String packageName, int userId, String deviceAddress);
+ @UnsupportedAppUsage
oneway void onDeviceSelectionCancel();
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 56d34e3d3ccf..d1cc0868b174 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2398,6 +2398,44 @@ public abstract class Context {
@Nullable String initialData, @Nullable Bundle initialExtras);
/**
+ * Version of
+ * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String,
+ * Bundle)} that allows you to specify the App Op to enforce restrictions on which receivers
+ * the broadcast will be sent to.
+ *
+ * <p>See {@link BroadcastReceiver} for more information on Intent broadcasts.
+ *
+ * @param intent The Intent to broadcast; all receivers matching this
+ * Intent will receive the broadcast.
+ * @param receiverPermission String naming a permissions that
+ * a receiver must hold in order to receive your broadcast.
+ * If null, no permission is required.
+ * @param receiverAppOp The app op associated with the broadcast. If null, no appOp is
+ * required. If both receiverAppOp and receiverPermission are non-null,
+ * a receiver must have both of them to
+ * receive the broadcast
+ * @param resultReceiver Your own BroadcastReceiver to treat as the final
+ * receiver of the broadcast.
+ * @param scheduler A custom Handler with which to schedule the
+ * resultReceiver callback; if null it will be
+ * scheduled in the Context's main thread.
+ * @param initialCode An initial value for the result code. Often
+ * Activity.RESULT_OK.
+ * @param initialData An initial value for the result data. Often
+ * null.
+ * @param initialExtras An initial value for the result extras. Often
+ * null.
+ *
+ * @see #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)
+ */
+ public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent,
+ @Nullable String receiverPermission, @Nullable String receiverAppOp,
+ @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler,
+ int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) {
+ throw new RuntimeException("Not implemented. Must override in a subclass.");
+ }
+
+ /**
* <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the
* Intent you are sending stays around after the broadcast is complete,
* so that others can quickly retrieve that data through the return
@@ -4696,6 +4734,13 @@ public abstract class Context {
/**
* Use with {@link #getSystemService(String)} to retrieve an
+ * {@link android.telephony.ims.ImsManager}.
+ * @hide
+ */
+ public static final String TELEPHONY_IMS_SERVICE = "telephony_ims";
+
+ /**
+ * Use with {@link #getSystemService(String)} to retrieve an
* {@link android.telephony.ims.RcsMessageManager}.
* @hide
*/
@@ -4709,6 +4754,14 @@ public abstract class Context {
public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system";
/**
+ * Use with {@link #getSystemService(String)} to retrieve an
+ * {@link android.os.telephony.TelephonyRegistryManager}.
+ * @hide
+ */
+ @SystemApi
+ public static final String TELEPHONY_REGISTRY_SERVICE = "telephony_registry";
+
+ /**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.
*
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 0859f97e81a1..6c33f6dfea98 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -16,6 +16,9 @@
package android.content;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
@@ -61,12 +64,12 @@ public class ContextWrapper extends Context {
public ContextWrapper(Context base) {
mBase = base;
}
-
+
/**
* Set the base context for this ContextWrapper. All calls will then be
* delegated to the base context. Throws
* IllegalStateException if a base context has already been set.
- *
+ *
* @param base The new base context for this wrapper.
*/
protected void attachBaseContext(Context base) {
@@ -117,7 +120,7 @@ public class ContextWrapper extends Context {
public Context getApplicationContext() {
return mBase.getApplicationContext();
}
-
+
@Override
public void setTheme(int resid) {
mBase.setTheme(resid);
@@ -162,7 +165,7 @@ public class ContextWrapper extends Context {
public ApplicationInfo getApplicationInfo() {
return mBase.getApplicationInfo();
}
-
+
@Override
public String getPackageResourcePath() {
return mBase.getPackageResourcePath();
@@ -202,13 +205,13 @@ public class ContextWrapper extends Context {
@Override
public FileInputStream openFileInput(String name)
- throws FileNotFoundException {
+ throws FileNotFoundException {
return mBase.openFileInput(name);
}
@Override
public FileOutputStream openFileOutput(String name, int mode)
- throws FileNotFoundException {
+ throws FileNotFoundException {
return mBase.openFileOutput(name, mode);
}
@@ -442,7 +445,7 @@ public class ContextWrapper extends Context {
mBase.startIntentSender(intent, fillInIntent, flagsMask,
flagsValues, extraFlags, options);
}
-
+
@Override
public void sendBroadcast(Intent intent) {
mBase.sendBroadcast(intent);
@@ -487,9 +490,9 @@ public class ContextWrapper extends Context {
@Override
public void sendOrderedBroadcast(
- Intent intent, String receiverPermission, BroadcastReceiver resultReceiver,
- Handler scheduler, int initialCode, String initialData,
- Bundle initialExtras) {
+ Intent intent, String receiverPermission, BroadcastReceiver resultReceiver,
+ Handler scheduler, int initialCode, String initialData,
+ Bundle initialExtras) {
mBase.sendOrderedBroadcast(intent, receiverPermission,
resultReceiver, scheduler, initialCode,
initialData, initialExtras);
@@ -499,7 +502,8 @@ public class ContextWrapper extends Context {
@SystemApi
@Override
public void sendOrderedBroadcast(
- Intent intent, String receiverPermission, Bundle options, BroadcastReceiver resultReceiver,
+ Intent intent, String receiverPermission, Bundle options,
+ BroadcastReceiver resultReceiver,
Handler scheduler, int initialCode, String initialData,
Bundle initialExtras) {
mBase.sendOrderedBroadcast(intent, receiverPermission,
@@ -510,9 +514,9 @@ public class ContextWrapper extends Context {
/** @hide */
@Override
public void sendOrderedBroadcast(
- Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver,
- Handler scheduler, int initialCode, String initialData,
- Bundle initialExtras) {
+ Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver,
+ Handler scheduler, int initialCode, String initialData,
+ Bundle initialExtras) {
mBase.sendOrderedBroadcast(intent, receiverPermission, appOp,
resultReceiver, scheduler, initialCode,
initialData, initialExtras);
@@ -570,6 +574,15 @@ public class ContextWrapper extends Context {
}
@Override
+ public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent,
+ @Nullable String receiverPermission, @Nullable String receiverAppOp,
+ @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler,
+ int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) {
+ mBase.sendOrderedBroadcast(intent, receiverPermission, receiverAppOp, resultReceiver,
+ scheduler, initialCode, initialData, initialExtras);
+ }
+
+ @Override
@Deprecated
public void sendStickyBroadcast(Intent intent) {
mBase.sendStickyBroadcast(intent);
diff --git a/core/java/android/content/SyncStats.java b/core/java/android/content/SyncStats.java
index 03b2250edee1..9596a6016c44 100644
--- a/core/java/android/content/SyncStats.java
+++ b/core/java/android/content/SyncStats.java
@@ -58,7 +58,7 @@ public class SyncStats implements Parcelable {
* attempted to update or delete a version of a resource on the server. This is expected
* to clear itself automatically once the new state is retrieved from the server,
* though it may remain until the user intervenes manually, perhaps by clearing the
- * local storage and starting over frmo scratch. This is considered a hard error.
+ * local storage and starting over from scratch. This is considered a hard error.
*/
public long numConflictDetectedExceptions;
diff --git a/core/java/android/content/UndoManager.java b/core/java/android/content/UndoManager.java
index f6a0d771bf4c..f9c58d624a2f 100644
--- a/core/java/android/content/UndoManager.java
+++ b/core/java/android/content/UndoManager.java
@@ -18,8 +18,6 @@ package android.content;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.ParcelableParcel;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -88,6 +86,10 @@ public class UndoManager {
public static final int MERGE_MODE_ANY = 2;
@UnsupportedAppUsage
+ public UndoManager() {
+ }
+
+ @UnsupportedAppUsage
public UndoOwner getOwner(String tag, Object data) {
if (tag == null) {
throw new NullPointerException("tag can't be null");
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 0aff881ad6db..a81d7ec915d4 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -620,21 +620,6 @@ public class PackageParser {
}
/**
- * Generate and return the {@link PackageInfo} for a parsed package.
- *
- * @param p the parsed package.
- * @param flags indicating which optional information is included.
- */
- @UnsupportedAppUsage
- public static PackageInfo generatePackageInfo(PackageParser.Package p,
- int gids[], int flags, long firstInstallTime, long lastUpdateTime,
- Set<String> grantedPermissions, PackageUserState state) {
-
- return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
- grantedPermissions, state, UserHandle.getCallingUserId());
- }
-
- /**
* Returns true if the package is installed and not hidden, or if the caller
* explicitly wanted all uninstalled and hidden packages as well.
* @param appInfo The applicationInfo of the app being checked.
@@ -660,8 +645,45 @@ public class PackageParser {
return checkUseInstalledOrHidden(0, state, null);
}
+ /**
+ * Generate and return the {@link PackageInfo} for a parsed package.
+ *
+ * @param p the parsed package.
+ * @param flags indicating which optional information is included.
+ */
+ @UnsupportedAppUsage
+ public static PackageInfo generatePackageInfo(PackageParser.Package p,
+ int[] gids, int flags, long firstInstallTime, long lastUpdateTime,
+ Set<String> grantedPermissions, PackageUserState state) {
+
+ return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
+ grantedPermissions, state, UserHandle.getCallingUserId());
+ }
+
@UnsupportedAppUsage
public static PackageInfo generatePackageInfo(PackageParser.Package p,
+ int[] gids, int flags, long firstInstallTime, long lastUpdateTime,
+ Set<String> grantedPermissions, PackageUserState state, int userId) {
+
+ return generatePackageInfo(p, null, gids, flags, firstInstallTime, lastUpdateTime,
+ grantedPermissions, state, userId);
+ }
+
+ /**
+ * PackageInfo generator specifically for apex files.
+ *
+ * @param pkg Package to generate info from. Should be derived from an apex.
+ * @param apexInfo Apex info relating to the package.
+ * @return PackageInfo
+ * @throws PackageParserException
+ */
+ public static PackageInfo generatePackageInfo(
+ PackageParser.Package pkg, ApexInfo apexInfo, int flags) {
+ return generatePackageInfo(pkg, apexInfo, EmptyArray.INT, flags, 0, 0,
+ Collections.emptySet(), new PackageUserState(), UserHandle.getCallingUserId());
+ }
+
+ private static PackageInfo generatePackageInfo(PackageParser.Package p, ApexInfo apexInfo,
int gids[], int flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, PackageUserState state, int userId) {
if (!checkUseInstalledOrHidden(flags, state, p.applicationInfo) || !p.isMatch(flags)) {
@@ -808,8 +830,27 @@ public class PackageParser {
}
}
}
+
+ if (apexInfo != null) {
+ File apexFile = new File(apexInfo.modulePath);
+
+ pi.applicationInfo.sourceDir = apexFile.getPath();
+ pi.applicationInfo.publicSourceDir = apexFile.getPath();
+ if (apexInfo.isFactory) {
+ pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
+ } else {
+ pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM;
+ }
+ if (apexInfo.isActive) {
+ pi.applicationInfo.flags |= ApplicationInfo.FLAG_INSTALLED;
+ } else {
+ pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_INSTALLED;
+ }
+ pi.isApex = true;
+ }
+
// deprecated method of getting signing certificates
- if ((flags&PackageManager.GET_SIGNATURES) != 0) {
+ if ((flags & PackageManager.GET_SIGNATURES) != 0) {
if (p.mSigningDetails.hasPastSigningCertificates()) {
// Package has included signing certificate rotation information. Return the oldest
// cert so that programmatic checks keep working even if unaware of key rotation.
@@ -8397,61 +8438,4 @@ public class PackageParser {
}
}
- // TODO(b/129261524): Clean up API
- /**
- * PackageInfo parser specifically for apex files.
- * NOTE: It will collect certificates
- *
- * @param apexInfo
- * @return PackageInfo
- * @throws PackageParserException
- */
- public static PackageInfo generatePackageInfoFromApex(ApexInfo apexInfo, int flags)
- throws PackageParserException {
- PackageParser pp = new PackageParser();
- File apexFile = new File(apexInfo.modulePath);
- final Package p = pp.parsePackage(apexFile, flags, false);
- PackageUserState state = new PackageUserState();
- PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0,
- Collections.emptySet(), state);
- pi.applicationInfo.sourceDir = apexFile.getPath();
- pi.applicationInfo.publicSourceDir = apexFile.getPath();
- if (apexInfo.isFactory) {
- pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
- } else {
- pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM;
- }
- if (apexInfo.isActive) {
- pi.applicationInfo.flags |= ApplicationInfo.FLAG_INSTALLED;
- } else {
- pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_INSTALLED;
- }
- pi.isApex = true;
-
- // Collect certificates
- if ((flags & PackageManager.GET_SIGNING_CERTIFICATES) != 0) {
- collectCertificates(p, apexFile, false);
- // Keep legacy mechanism for handling signatures. While this is deprecated, it's
- // still part of the public API and needs to be maintained
- if (p.mSigningDetails.hasPastSigningCertificates()) {
- // Package has included signing certificate rotation information. Return
- // the oldest cert so that programmatic checks keep working even if unaware
- // of key rotation.
- pi.signatures = new Signature[1];
- pi.signatures[0] = p.mSigningDetails.pastSigningCertificates[0];
- } else if (p.mSigningDetails.hasSignatures()) {
- // otherwise keep old behavior
- int numberOfSigs = p.mSigningDetails.signatures.length;
- pi.signatures = new Signature[numberOfSigs];
- System.arraycopy(p.mSigningDetails.signatures, 0, pi.signatures, 0, numberOfSigs);
- }
- if (p.mSigningDetails != SigningDetails.UNKNOWN) {
- // only return a valid SigningInfo if there is signing information to report
- pi.signingInfo = new SigningInfo(p.mSigningDetails);
- } else {
- pi.signingInfo = null;
- }
- }
- return pi;
- }
}
diff --git a/core/java/android/content/res/ConfigurationBoundResourceCache.java b/core/java/android/content/res/ConfigurationBoundResourceCache.java
index 3af395a4fc19..848790f46734 100644
--- a/core/java/android/content/res/ConfigurationBoundResourceCache.java
+++ b/core/java/android/content/res/ConfigurationBoundResourceCache.java
@@ -26,6 +26,11 @@ import android.content.pm.ActivityInfo.Config;
* @hide For internal use only.
*/
public class ConfigurationBoundResourceCache<T> extends ThemedResourceCache<ConstantState<T>> {
+
+ @UnsupportedAppUsage
+ public ConfigurationBoundResourceCache() {
+ }
+
/**
* If the resource is cached, creates and returns a new instance of it.
*
diff --git a/core/java/android/content/res/DrawableCache.java b/core/java/android/content/res/DrawableCache.java
index d4f0ca5f8ebf..90604b8d536a 100644
--- a/core/java/android/content/res/DrawableCache.java
+++ b/core/java/android/content/res/DrawableCache.java
@@ -23,6 +23,11 @@ import android.graphics.drawable.Drawable;
* Class which can be used to cache Drawable resources against a theme.
*/
class DrawableCache extends ThemedResourceCache<Drawable.ConstantState> {
+
+ @UnsupportedAppUsage
+ DrawableCache() {
+ }
+
/**
* If the resource is cached, creates and returns a new instance of it.
*
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index b79cf6566987..38df317575d7 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -360,8 +360,9 @@ public class TypedArray {
/**
* Retrieve the boolean value for the attribute at <var>index</var>.
* <p>
- * If the attribute is an integer value, this method will return whether
- * it is equal to zero. If the attribute is not a boolean or integer value,
+ * If the attribute is an integer value, this method returns false if the
+ * attribute is equal to zero, and true otherwise.
+ * If the attribute is not a boolean or integer value,
* this method will attempt to coerce it to an integer using
* {@link Integer#decode(String)} and return whether it is equal to zero.
*
diff --git a/core/java/android/database/IContentObserver.aidl b/core/java/android/database/IContentObserver.aidl
index 22dc9fed59c4..623556695341 100644
--- a/core/java/android/database/IContentObserver.aidl
+++ b/core/java/android/database/IContentObserver.aidl
@@ -29,5 +29,6 @@ interface IContentObserver
* observed. selfUpdate is true if the update was caused by a call to
* commit on the cursor that is being observed.
*/
+ @UnsupportedAppUsage
oneway void onChange(boolean selfUpdate, in Uri uri, int userId);
}
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index cfa3934b0cae..75af41cb2b54 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -1763,6 +1763,10 @@ public class ConnectivityManager {
/** @hide */
public static class PacketKeepaliveCallback {
+ @UnsupportedAppUsage
+ public PacketKeepaliveCallback() {
+ }
+
/** The requested keepalive was successfully started. */
@UnsupportedAppUsage
public void onStarted() {}
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 61648dc7f1d8..5f662f914919 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -52,6 +52,7 @@ interface IConnectivityManager
@UnsupportedAppUsage
NetworkInfo getActiveNetworkInfo();
NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
NetworkInfo getNetworkInfo(int networkType);
NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked);
@UnsupportedAppUsage
@@ -112,6 +113,7 @@ interface IConnectivityManager
int setUsbTethering(boolean enable, String callerPkg);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void reportInetCondition(int networkType, int percentage);
void reportNetworkConnectivity(in Network network, boolean hasConnectivity);
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index c97b37b55c78..c9a999cfdf17 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -40,6 +40,10 @@ public class InterfaceConfiguration implements Parcelable {
private static final String[] EMPTY_STRING_ARRAY = new String[0];
+ @UnsupportedAppUsage
+ public InterfaceConfiguration() {
+ }
+
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 3ec0aeac472b..0706e755d133 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -111,6 +111,8 @@ public final class LinkProperties implements Parcelable {
/**
* @hide
*/
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Landroid/net/LinkProperties$ProvisioningChange;")
public enum ProvisioningChange {
@UnsupportedAppUsage
STILL_NOT_PROVISIONED,
diff --git a/core/java/android/net/MobileLinkQualityInfo.java b/core/java/android/net/MobileLinkQualityInfo.java
index 06c739d6cf95..a10a14d750d8 100644
--- a/core/java/android/net/MobileLinkQualityInfo.java
+++ b/core/java/android/net/MobileLinkQualityInfo.java
@@ -40,6 +40,10 @@ public class MobileLinkQualityInfo extends LinkQualityInfo {
private int mLteRssnr = UNKNOWN_INT;
private int mLteCqi = UNKNOWN_INT;
+ @UnsupportedAppUsage
+ public MobileLinkQualityInfo() {
+ }
+
/**
* Implement the Parcelable interface.
* @hide
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index 43ea5891d7f7..ff4bf2d3474c 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Build;
@@ -418,7 +419,16 @@ public abstract class NetworkAgent extends Handler {
if (score < 0) {
throw new IllegalArgumentException("Score must be >= 0");
}
- queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, score, 0);
+ final NetworkScore ns = new NetworkScore();
+ ns.putIntExtension(NetworkScore.LEGACY_SCORE, score);
+ updateScore(ns);
+ }
+
+ /**
+ * Called by the bearer code when it has a new NetworkScore for this network.
+ */
+ public void updateScore(@NonNull NetworkScore ns) {
+ queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, new NetworkScore(ns));
}
/**
diff --git a/core/java/android/net/NetworkScore.java b/core/java/android/net/NetworkScore.java
new file mode 100644
index 000000000000..1ab63352401c
--- /dev/null
+++ b/core/java/android/net/NetworkScore.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.net;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Objects;
+
+/**
+ * Object representing the quality of a network as perceived by the user.
+ *
+ * A NetworkScore object represents the characteristics of a network that affects how good the
+ * network is considered for a particular use.
+ * @hide
+ */
+public final class NetworkScore implements Parcelable {
+
+ // The key of bundle which is used to get the legacy network score of NetworkAgentInfo.
+ // TODO: Remove this when the transition to NetworkScore is over.
+ public static final String LEGACY_SCORE = "LEGACY_SCORE";
+ @NonNull
+ private final Bundle mExtensions;
+
+ public NetworkScore() {
+ mExtensions = new Bundle();
+ }
+
+ public NetworkScore(@NonNull NetworkScore source) {
+ mExtensions = new Bundle(source.mExtensions);
+ }
+
+ /**
+ * Put the value of parcelable inside the bundle by key.
+ */
+ public void putExtension(@Nullable String key, @Nullable Parcelable value) {
+ mExtensions.putParcelable(key, value);
+ }
+
+ /**
+ * Put the value of int inside the bundle by key.
+ */
+ public void putIntExtension(@Nullable String key, int value) {
+ mExtensions.putInt(key, value);
+ }
+
+ /**
+ * Get the value of non primitive type by key.
+ */
+ public <T extends Parcelable> T getExtension(@Nullable String key) {
+ return mExtensions.getParcelable(key);
+ }
+
+ /**
+ * Get the value of int by key.
+ */
+ public int getIntExtension(@Nullable String key) {
+ return mExtensions.getInt(key);
+ }
+
+ /**
+ * Remove the entry by given key.
+ */
+ public void removeExtension(@Nullable String key) {
+ mExtensions.remove(key);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ synchronized (this) {
+ dest.writeBundle(mExtensions);
+ }
+ }
+
+ public static final @NonNull Creator<NetworkScore> CREATOR = new Creator<NetworkScore>() {
+ @Override
+ public NetworkScore createFromParcel(@NonNull Parcel in) {
+ return new NetworkScore(in);
+ }
+
+ @Override
+ public NetworkScore[] newArray(int size) {
+ return new NetworkScore[size];
+ }
+ };
+
+ private NetworkScore(@NonNull Parcel in) {
+ mExtensions = in.readBundle();
+ }
+
+ // TODO: Modify this method once new fields are added into this class.
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (!(obj instanceof NetworkScore)) {
+ return false;
+ }
+ final NetworkScore other = (NetworkScore) obj;
+ return bundlesEqual(mExtensions, other.mExtensions);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 29;
+ for (String key : mExtensions.keySet()) {
+ final Object value = mExtensions.get(key);
+ // The key may be null, so call Objects.hash() is safer.
+ result += 31 * value.hashCode() + 37 * Objects.hash(key);
+ }
+ return result;
+ }
+
+ // mExtensions won't be null since the constructor will create it.
+ private boolean bundlesEqual(@NonNull Bundle bundle1, @NonNull Bundle bundle2) {
+ if (bundle1 == bundle2) {
+ return true;
+ }
+
+ // This is unlikely but it's fine to add this clause here.
+ if (null == bundle1 || null == bundle2) {
+ return false;
+ }
+
+ if (bundle1.size() != bundle2.size()) {
+ return false;
+ }
+
+ for (String key : bundle1.keySet()) {
+ final Object value1 = bundle1.get(key);
+ final Object value2 = bundle2.get(key);
+ if (!Objects.equals(value1, value2)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/core/java/android/net/SntpClient.java b/core/java/android/net/SntpClient.java
index a55d9d00414f..f9c2defc0377 100644
--- a/core/java/android/net/SntpClient.java
+++ b/core/java/android/net/SntpClient.java
@@ -78,6 +78,10 @@ public class SntpClient {
}
}
+ @UnsupportedAppUsage
+ public SntpClient() {
+ }
+
/**
* Sends an SNTP request to the given host and processes the response.
*
diff --git a/core/java/android/net/nsd/NsdManager.java b/core/java/android/net/nsd/NsdManager.java
index 535bf675cd0e..64f20b839a63 100644
--- a/core/java/android/net/nsd/NsdManager.java
+++ b/core/java/android/net/nsd/NsdManager.java
@@ -49,8 +49,8 @@ import java.util.concurrent.CountDownLatch;
* limited to a local network over Multicast DNS. DNS service discovery is described at
* http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt
*
- * <p> The API is asynchronous and responses to requests from an application are on listener
- * callbacks on a seperate internal thread.
+ * <p> The API is asynchronous, and responses to requests from an application are on listener
+ * callbacks on a separate internal thread.
*
* <p> There are three main operations the API supports - registration, discovery and resolution.
* <pre>
diff --git a/core/java/android/net/util/SocketUtils.java b/core/java/android/net/util/SocketUtils.java
index 489a2922f70e..e9ea99f84f90 100644
--- a/core/java/android/net/util/SocketUtils.java
+++ b/core/java/android/net/util/SocketUtils.java
@@ -77,7 +77,9 @@ public final class SocketUtils {
/**
* Make a socket address that packet socket can send packets to.
+ * @deprecated Use {@link #makePacketSocketAddress(int, int, byte[])} instead.
*/
+ @Deprecated
@NonNull
public static SocketAddress makePacketSocketAddress(int ifIndex, @NonNull byte[] hwAddr) {
return new PacketSocketAddress(
@@ -87,6 +89,18 @@ public final class SocketUtils {
}
/**
+ * Make a socket address that packet socket can send packets to.
+ */
+ @NonNull
+ public static SocketAddress makePacketSocketAddress(int protocol, int ifIndex,
+ @NonNull byte[] hwAddr) {
+ return new PacketSocketAddress(
+ protocol /* sll_protocol */,
+ ifIndex /* sll_ifindex */,
+ hwAddr /* sll_addr */);
+ }
+
+ /**
* @see IoBridge#closeAndSignalBlockedThreads(FileDescriptor)
*/
public static void closeSocket(@Nullable FileDescriptor fd) throws IOException {
diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java
index d259f386ea77..b37e176ddb6e 100644
--- a/core/java/android/os/AsyncTask.java
+++ b/core/java/android/os/AsyncTask.java
@@ -38,9 +38,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * <p>AsyncTask enables proper and easy use of the UI thread. This class allows you
- * to perform background operations and publish results on the UI thread without
- * having to manipulate threads and/or handlers.</p>
+ * <p>AsyncTask was intended to enable proper and easy use of the UI thread. However, the most
+ * common use case was for integrating into UI, and that would cause Context leaks, missed
+ * callbacks, or crashes on configuration changes. It also has inconsistent behavior on different
+ * versions of the platform, swallows exceptions from {@code doInBackground}, and does not provide
+ * much utility over using {@link Executor}s directly.</p>
*
* <p>AsyncTask is designed to be a helper class around {@link Thread} and {@link Handler}
* and does not constitute a generic threading framework. AsyncTasks should ideally be
@@ -188,7 +190,12 @@ import java.util.concurrent.atomic.AtomicInteger;
* <p>If you truly want parallel execution, you can invoke
* {@link #executeOnExecutor(java.util.concurrent.Executor, Object[])} with
* {@link #THREAD_POOL_EXECUTOR}.</p>
+ *
+ * @deprecated Use the standard <code>java.util.concurrent</code> or
+ * <a href="https://developer.android.com/topic/libraries/architecture/coroutines">
+ * Kotlin concurrency utilities</a> instead.
*/
+@Deprecated
public abstract class AsyncTask<Params, Progress, Result> {
private static final String LOG_TAG = "AsyncTask";
@@ -240,7 +247,13 @@ public abstract class AsyncTask<Params, Progress, Result> {
/**
* An {@link Executor} that can be used to execute tasks in parallel.
+ *
+ * @deprecated Using a single thread pool for a general purpose results in suboptimal behavior
+ * for different tasks. Small, CPU-bound tasks benefit from a bounded pool and queueing, and
+ * long-running blocking tasks, such as network operations, benefit from many threads. Use or
+ * create an {@link Executor} configured for your use case.
*/
+ @Deprecated
public static final Executor THREAD_POOL_EXECUTOR;
static {
@@ -254,7 +267,10 @@ public abstract class AsyncTask<Params, Progress, Result> {
/**
* An {@link Executor} that executes tasks one at a time in serial
* order. This serialization is global to a particular process.
+ *
+ * @deprecated Globally serializing tasks results in excessive queuing for unrelated operations.
*/
+ @Deprecated
public static final Executor SERIAL_EXECUTOR = new SerialExecutor();
private static final int MESSAGE_POST_RESULT = 0x1;
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index ecd16dd1f612..387775b7ccdc 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -66,6 +66,10 @@ import java.util.Map;
public abstract class BatteryStats implements Parcelable {
private static final String TAG = "BatteryStats";
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public BatteryStats() {
+ }
+
private static final boolean LOCAL_LOGV = false;
/** Fetching RPM stats is too slow to do each time screen changes, so disable it. */
protected static final boolean SCREEN_OFF_RPM_STATS_ENABLED = false;
@@ -407,6 +411,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Counter {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Counter() {
+ }
+
/**
* Returns the count associated with this Counter for the
* selected type of statistics.
@@ -516,6 +524,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Timer {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Timer() {
+ }
+
/**
* Returns the count associated with this Timer for the
* selected type of statistics.
@@ -631,6 +643,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Uid {
+ @UnsupportedAppUsage
+ public Uid() {
+ }
+
/**
* Returns a mapping containing wakelock statistics.
*
@@ -671,6 +687,11 @@ public abstract class BatteryStats implements Parcelable {
* The statistics associated with a particular wake lock.
*/
public static abstract class Wakelock {
+
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Wakelock(){
+ }
+
@UnsupportedAppUsage
public abstract Timer getWakeTime(int type);
}
@@ -948,6 +969,11 @@ public abstract class BatteryStats implements Parcelable {
public abstract void getDeferredJobsLineLocked(StringBuilder sb, int which);
public static abstract class Sensor {
+
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Sensor() {
+ }
+
/*
* FIXME: it's not correct to use this magic value because it
* could clash with a sensor handle (which are defined by
@@ -978,7 +1004,16 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Proc {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Proc() {
+ }
+
public static class ExcessivePower {
+
+ @UnsupportedAppUsage
+ public ExcessivePower() {
+ }
+
public static final int TYPE_WAKE = 1;
public static final int TYPE_CPU = 2;
@@ -1053,6 +1088,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Pkg {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Pkg() {
+ }
+
/**
* Returns information about all wakeup alarms that have been triggered for this
* package. The mapping keys are tag names for the alarms, the counter contains
@@ -1555,6 +1594,7 @@ public abstract class BatteryStats implements Parcelable {
}
public final static class HistoryItem implements Parcelable {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public HistoryItem next;
// The time of this event in milliseconds, as per SystemClock.elapsedRealtime().
@@ -1877,6 +1917,7 @@ public abstract class BatteryStats implements Parcelable {
numReadInts += (src.dataPosition()-start)/4;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void clear() {
time = 0;
cmd = CMD_NULL;
@@ -1897,12 +1938,14 @@ public abstract class BatteryStats implements Parcelable {
eventTag = null;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void setTo(HistoryItem o) {
time = o.time;
cmd = o.cmd;
setToCommon(o);
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void setTo(long time, byte cmd, HistoryItem o) {
this.time = time;
this.cmd = cmd;
@@ -1958,6 +2001,7 @@ public abstract class BatteryStats implements Parcelable {
&& currentTime == o.currentTime;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public boolean same(HistoryItem o) {
if (!sameNonEvent(o) || eventCode != o.eventCode) {
return false;
@@ -2340,6 +2384,7 @@ public abstract class BatteryStats implements Parcelable {
*
* {@hide}
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public abstract long getMobileRadioActiveTime(long elapsedRealtimeUs, int which);
/**
@@ -2700,6 +2745,7 @@ public abstract class BatteryStats implements Parcelable {
public static final int NETWORK_WIFI_BG_TX_DATA = 9;
public static final int NUM_NETWORK_ACTIVITY_TYPES = NETWORK_WIFI_BG_TX_DATA + 1;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public abstract long getNetworkActivityBytes(int type, int which);
public abstract long getNetworkActivityPackets(int type, int which);
diff --git a/core/java/android/os/BinderProxy.java b/core/java/android/os/BinderProxy.java
index 97c0a13e7a2b..c35b05f10498 100644
--- a/core/java/android/os/BinderProxy.java
+++ b/core/java/android/os/BinderProxy.java
@@ -241,31 +241,36 @@ public final class BinderProxy implements IBinder {
}
Map<String, Integer> counts = new HashMap<>();
- for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
- if (a != null) {
- for (WeakReference<BinderProxy> weakRef : a) {
- BinderProxy bp = weakRef.get();
- String key;
- if (bp == null) {
- key = "<cleared weak-ref>";
- } else {
- try {
- key = bp.getInterfaceDescriptor();
- if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
- key = "<proxy to dead node>";
- }
- } catch (Throwable t) {
- key = "<exception during getDescriptor>";
- }
- }
- Integer i = counts.get(key);
- if (i == null) {
- counts.put(key, 1);
- } else {
- counts.put(key, i + 1);
+ final ArrayList<WeakReference<BinderProxy>> proxiesToQuery =
+ new ArrayList<WeakReference<BinderProxy>>();
+ synchronized (sProxyMap) {
+ for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
+ if (a != null) {
+ proxiesToQuery.addAll(a);
+ }
+ }
+ }
+ for (WeakReference<BinderProxy> weakRef : proxiesToQuery) {
+ BinderProxy bp = weakRef.get();
+ String key;
+ if (bp == null) {
+ key = "<cleared weak-ref>";
+ } else {
+ try {
+ key = bp.getInterfaceDescriptor();
+ if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
+ key = "<proxy to dead node>";
}
+ } catch (Throwable t) {
+ key = "<exception during getDescriptor>";
}
}
+ Integer i = counts.get(key);
+ if (i == null) {
+ counts.put(key, 1);
+ } else {
+ counts.put(key, i + 1);
+ }
}
Map.Entry<String, Integer>[] sorted = counts.entrySet().toArray(
new Map.Entry[counts.size()]);
@@ -354,9 +359,7 @@ public final class BinderProxy implements IBinder {
* @hide
*/
public static InterfaceCount[] getSortedInterfaceCounts(int num) {
- synchronized (sProxyMap) {
- return sProxyMap.getSortedInterfaceCounts(num);
- }
+ return sProxyMap.getSortedInterfaceCounts(num);
}
/**
@@ -376,10 +379,8 @@ public final class BinderProxy implements IBinder {
*/
public static void dumpProxyDebugInfo() {
if (Build.IS_DEBUGGABLE) {
- synchronized (sProxyMap) {
- sProxyMap.dumpProxyInterfaceCounts();
- sProxyMap.dumpPerUidProxyCounts();
- }
+ sProxyMap.dumpProxyInterfaceCounts();
+ sProxyMap.dumpPerUidProxyCounts();
}
}
diff --git a/core/java/android/os/CancellationSignal.java b/core/java/android/os/CancellationSignal.java
index e8053d5d275d..99fb9982e706 100644
--- a/core/java/android/os/CancellationSignal.java
+++ b/core/java/android/os/CancellationSignal.java
@@ -18,13 +18,19 @@ package android.os;
import android.os.ICancellationSignal;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* Provides the ability to cancel an operation in progress.
*/
public final class CancellationSignal {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean mIsCanceled;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private OnCancelListener mOnCancelListener;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private ICancellationSignal mRemote;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean mCancelInProgress;
/**
@@ -152,6 +158,7 @@ public final class CancellationSignal {
}
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private void waitForCancelFinishedLocked() {
while (mCancelInProgress) {
try {
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 154e8cd5a2d5..4ed7b17d1549 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -1690,6 +1690,8 @@ public final class Debug
* such runtime statistic exists.
*
* <p>The following table lists the runtime statistics that the runtime supports.
+ * All statistics are approximate. Individual allocations may not be immediately reflected
+ * in the results.
* Note runtime statistics may be added or removed in a future API level.</p>
*
* <table>
diff --git a/core/java/android/os/IDeviceIdleController.aidl b/core/java/android/os/IDeviceIdleController.aidl
index aa255bf660d5..8a7a594f0b80 100644
--- a/core/java/android/os/IDeviceIdleController.aidl
+++ b/core/java/android/os/IDeviceIdleController.aidl
@@ -31,11 +31,13 @@ interface IDeviceIdleController {
String[] getSystemPowerWhitelistExceptIdle();
String[] getSystemPowerWhitelist();
String[] getUserPowerWhitelist();
+ @UnsupportedAppUsage
String[] getFullPowerWhitelistExceptIdle();
String[] getFullPowerWhitelist();
int[] getAppIdWhitelistExceptIdle();
int[] getAppIdWhitelist();
int[] getAppIdUserWhitelist();
+ @UnsupportedAppUsage
int[] getAppIdTempWhitelist();
boolean isPowerSaveWhitelistExceptIdleApp(String name);
boolean isPowerSaveWhitelistApp(String name);
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index 9b8a40a6cab0..0cce19222d27 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -184,6 +184,7 @@ interface INetworkManagementService
/**
* Returns a list of currently tethered interfaces
*/
+ @UnsupportedAppUsage
String[] listTetheredInterfaces();
/**
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index e1d605e1c99d..185693e8e6e0 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -47,6 +47,7 @@ interface IPowerManager
void wakeUp(long time, int reason, String details, String opPackageName);
@UnsupportedAppUsage
void goToSleep(long time, int reason, int flags);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void nap(long time);
@UnsupportedAppUsage
boolean isInteractive();
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index dbe3c93738b8..041f31d67a3e 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -364,6 +364,11 @@ public final class Parcel {
* @hide
*/
public static class ReadWriteHelper {
+
+ @UnsupportedAppUsage
+ public ReadWriteHelper() {
+ }
+
public static final ReadWriteHelper DEFAULT = new ReadWriteHelper();
/**
@@ -3148,6 +3153,7 @@ public final class Parcel {
// Cache of previously looked up CREATOR.createFromParcel() methods for
// particular classes. Keys are the names of the classes, values are
// Method objects.
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static final HashMap<ClassLoader,HashMap<String,Parcelable.Creator<?>>>
mCreators = new HashMap<>();
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 2fff595d7150..ab4d424ac053 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -824,6 +824,7 @@ public final class PowerManager {
final Context mContext;
@UnsupportedAppUsage
final IPowerManager mService;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
final Handler mHandler;
IThermalService mThermalService;
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index f85297627d76..8d74fc5d962c 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -1003,6 +1003,7 @@ public class Process {
* your own log, or the Android Illuminati will find you some night and
* beat you up.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static final native void sendSignalQuiet(int pid, int signal);
/** @hide */
diff --git a/core/java/android/os/Registrant.java b/core/java/android/os/Registrant.java
index 8fb123aa3da4..572b975fbafd 100644
--- a/core/java/android/os/Registrant.java
+++ b/core/java/android/os/Registrant.java
@@ -114,6 +114,7 @@ public class Registrant
}
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public Handler
getHandler()
{
diff --git a/core/java/android/os/RegistrantList.java b/core/java/android/os/RegistrantList.java
index 6e562ffc88ea..9c017dfff967 100644
--- a/core/java/android/os/RegistrantList.java
+++ b/core/java/android/os/RegistrantList.java
@@ -17,7 +17,6 @@
package android.os;
import android.annotation.UnsupportedAppUsage;
-import android.os.Handler;
import java.util.ArrayList;
@@ -27,6 +26,10 @@ public class RegistrantList
ArrayList registrants = new ArrayList(); // of Registrant
@UnsupportedAppUsage
+ public RegistrantList() {
+ }
+
+ @UnsupportedAppUsage
public synchronized void
add(Handler h, int what, Object obj)
{
@@ -70,6 +73,7 @@ public class RegistrantList
return registrants.size();
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public synchronized Object
get(int index)
{
diff --git a/core/java/android/os/RemoteCallback.java b/core/java/android/os/RemoteCallback.java
index 047ba1d20056..da58d0fac160 100644
--- a/core/java/android/os/RemoteCallback.java
+++ b/core/java/android/os/RemoteCallback.java
@@ -21,6 +21,8 @@ import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* @hide
*/
@@ -33,6 +35,7 @@ public final class RemoteCallback implements Parcelable {
}
private final OnResultListener mListener;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private final Handler mHandler;
private final IRemoteCallback mCallback;
diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java
index 9a9b0306063b..bf9225a2780a 100644
--- a/core/java/android/os/ServiceManager.java
+++ b/core/java/android/os/ServiceManager.java
@@ -102,6 +102,10 @@ public final class ServiceManager {
});
@UnsupportedAppUsage
+ public ServiceManager() {
+ }
+
+ @UnsupportedAppUsage
private static IServiceManager getIServiceManager() {
if (sServiceManager != null) {
return sServiceManager;
diff --git a/core/java/android/os/ServiceManagerNative.java b/core/java/android/os/ServiceManagerNative.java
index f641731fa08f..124b6c6f7377 100644
--- a/core/java/android/os/ServiceManagerNative.java
+++ b/core/java/android/os/ServiceManagerNative.java
@@ -86,6 +86,10 @@ class ServiceManagerProxy implements IServiceManager {
throw new RemoteException();
}
+ public boolean isDeclared(String name) throws RemoteException {
+ throw new RemoteException();
+ }
+
/**
* Same as mServiceManager but used by apps.
*
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index a6e5972faa55..8b0ffe155fc3 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -95,12 +95,17 @@ public class SystemProperties {
@UnsupportedAppUsage
private static native String native_get(String key);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native String native_get(String key, String def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native int native_get_int(String key, int def);
@UnsupportedAppUsage
private static native long native_get_long(String key, long def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native boolean native_get_boolean(String key, boolean def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native void native_set(String key, String def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native void native_add_change_callback();
private static native void native_report_sysprop_change();
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index d70ba9921bfd..4e17f7e92013 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -354,6 +354,7 @@ public final class UserHandle implements Parcelable {
* components -- user, app, isolated, etc.
* @hide
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static void formatUid(PrintWriter pw, int uid) {
if (uid < Process.FIRST_APPLICATION_UID) {
pw.print(uid);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index af9e592f9036..e92e435fa733 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -2370,6 +2370,8 @@ public class UserManager {
/**
* Return the number of users currently created on the device.
+ * <p>This API is not for use by third-party apps. It requires the {@code MANAGE_USERS}
+ * permission.</p>
*/
public int getUserCount() {
List<UserInfo> users = getUsers();
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 634b2baf098a..9cc9aac490c7 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -40,14 +40,17 @@ public class WorkSource implements Parcelable {
* The WorkSource object itself is not thread safe, but we need to
* hold sTmpWorkSource lock while working with these statics.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static final WorkSource sTmpWorkSource = new WorkSource(0);
/**
* For returning newbie work from a modification operation.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static WorkSource sNewbWork;
/**
* For returning gone work form a modification operation.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static WorkSource sGoneWork;
/**
@@ -620,6 +623,7 @@ public class WorkSource implements Parcelable {
return changed;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean updateLocked(WorkSource other, boolean set, boolean returnNewbs) {
if (mNames == null && other.mNames == null) {
return updateUidsLocked(other, set, returnNewbs);
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 77fd946f7ccb..0e00d5e9b7bf 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -104,16 +104,17 @@ public class DynamicSystemManager {
* Start DynamicSystem installation. This call may take an unbounded amount of time. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if the partition is read only, e.g. system.
* @return {@code true} if the call succeeds. {@code false} either the device does not contain
* enough space or a DynamicSystem is currently in use where the {@link #isInUse} would be
* true.
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public Session startInstallation(long systemSize, long userdataSize) {
+ public Session startInstallation(String name, long size, boolean readOnly) {
try {
- if (mService.startInstallation(systemSize, userdataSize)) {
+ if (mService.startInstallation(name, size, readOnly)) {
return new Session();
} else {
return null;
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index a6de170b5ce5..75f67854743f 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -24,11 +24,12 @@ interface IDynamicSystemService
* Start DynamicSystem installation. This call may take 60~90 seconds. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if this partition is readOnly
* @return true if the call succeeds
*/
- boolean startInstallation(long systemSize, long userdataSize);
+ boolean startInstallation(@utf8InCpp String name, long size, boolean readOnly);
/**
* Query the progress of the current installation operation. This can be called while
diff --git a/core/java/android/os/storage/StorageEventListener.java b/core/java/android/os/storage/StorageEventListener.java
index 4aa0b08ae358..39d5b4529745 100644
--- a/core/java/android/os/storage/StorageEventListener.java
+++ b/core/java/android/os/storage/StorageEventListener.java
@@ -24,6 +24,11 @@ import android.annotation.UnsupportedAppUsage;
* @hide
*/
public class StorageEventListener {
+
+ @UnsupportedAppUsage
+ public StorageEventListener() {
+ }
+
/**
* Called when the detection state of a USB Mass Storage host has changed.
* @param connected true if the USB mass storage is connected.
diff --git a/core/java/android/os/telephony/TelephonyRegistryManager.java b/core/java/android/os/telephony/TelephonyRegistryManager.java
new file mode 100644
index 000000000000..b67409988da0
--- /dev/null
+++ b/core/java/android/os/telephony/TelephonyRegistryManager.java
@@ -0,0 +1,548 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.os.telephony;
+
+import android.annotation.SystemApi;
+import android.net.LinkProperties;
+import android.net.NetworkCapabilities;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.telephony.Annotation;
+import android.telephony.Annotation.ApnType;
+import android.telephony.Annotation.CallState;
+import android.telephony.Annotation.DataActivityType;
+import android.telephony.Annotation.DataFailureCause;
+import android.telephony.Annotation.DataState;
+import android.telephony.Annotation.NetworkType;
+import android.telephony.Annotation.RadioPowerState;
+import android.telephony.Annotation.SimActivationState;
+import android.telephony.Annotation.SrvccState;
+import android.telephony.CallQuality;
+import android.telephony.CellInfo;
+import android.telephony.DisconnectCause;
+import android.telephony.PhoneCapability;
+import android.telephony.PreciseCallState.State;
+import android.telephony.ServiceState;
+import android.telephony.SignalStrength;
+import android.telephony.TelephonyManager;
+import android.telephony.data.ApnSetting;
+import android.telephony.ims.ImsReasonInfo;
+import com.android.internal.telephony.ITelephonyRegistry;
+import java.util.List;
+
+/**
+ * A centralized place to notify telephony related status changes, e.g, {@link ServiceState} update
+ * or {@link PhoneCapability} changed. This might trigger callback from applications side through
+ * {@link android.telephony.PhoneStateListener}
+ *
+ * TODO: limit API access to only carrier apps with certain permissions or apps running on
+ * privileged UID.
+ *
+ * @hide
+ */
+@SystemApi
+public class TelephonyRegistryManager {
+
+ private static final String TAG = "TelephonyRegistryManager";
+ private static ITelephonyRegistry sRegistry;
+
+ /** @hide **/
+ public TelephonyRegistryManager() {
+ if (sRegistry == null) {
+ sRegistry = ITelephonyRegistry.Stub.asInterface(
+ ServiceManager.getService("telephony.registry"));
+ }
+ }
+
+ /**
+ * Informs the system of an intentional upcoming carrier network change by a carrier app.
+ * This call only used to allow the system to provide alternative UI while telephony is
+ * performing an action that may result in intentional, temporary network lack of connectivity.
+ * <p>
+ * Based on the active parameter passed in, this method will either show or hide the alternative
+ * UI. There is no timeout associated with showing this UX, so a carrier app must be sure to
+ * call with active set to false sometime after calling with it set to {@code true}.
+ * <p>
+ * Requires Permission: calling app has carrier privileges.
+ *
+ * @param active Whether the carrier network change is or shortly will be
+ * active. Set this value to true to begin showing alternative UI and false to stop.
+ * @see TelephonyManager#hasCarrierPrivileges
+ */
+ public void notifyCarrierNetworkChange(boolean active) {
+ try {
+ sRegistry.notifyCarrierNetworkChange(active);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify call state changed on certain subscription.
+ *
+ * @param subId for which call state changed.
+ * @param slotIndex for which call state changed. Can be derived from subId except when subId is
+ * invalid.
+ * @param state latest call state. e.g, offhook, ringing
+ * @param incomingNumer incoming phone number.
+ *
+ * @hide
+ */
+ public void notifyCallStateChanged(int subId, int slotIndex, @CallState int state,
+ String incomingNumer) {
+ try {
+ sRegistry.notifyCallState(slotIndex, subId, state, incomingNumer);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify {@link ServiceState} update on certain subscription.
+ *
+ * @param subId for which the service state changed.
+ * @param slotIndex for which the service state changed. Can be derived from subId except
+ * subId is invalid.
+ * @param state service state e.g, in service, out of service or roaming status.
+ *
+ * @hide
+ */
+ public void notifyServiceStateChanged(int subId, int slotIndex, ServiceState state) {
+ try {
+ sRegistry.notifyServiceStateForPhoneId(slotIndex, subId, state);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify {@link SignalStrength} update on certain subscription.
+ *
+ * @param subId for which the signalstrength changed.
+ * @param slotIndex for which the signalstrength changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param signalStrength e.g, signalstrength level {@see SignalStrength#getLevel()}
+ *
+ * @hide
+ */
+ public void notifySignalStrengthChanged(int subId, int slotIndex,
+ SignalStrength signalStrength) {
+ try {
+ sRegistry.notifySignalStrengthForPhoneId(slotIndex, subId, signalStrength);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify changes to the message-waiting indicator on certain subscription. e.g, The status bar
+ * uses message waiting indicator to determine when to display the voicemail icon.
+ *
+ * @param subId for which message waiting indicator changed.
+ * @param slotIndex for which message waiting indicator changed. Can be derived from subId
+ * except when subId is invalid.
+ * @param msgWaitingInd {@code true} indicates there is message-waiting indicator, {@code false}
+ * otherwise.
+ *
+ * @hide
+ */
+ public void notifyMessageWaitingChanged(int subId, int slotIndex, boolean msgWaitingInd) {
+ try {
+ sRegistry.notifyMessageWaitingChangedForPhoneId(slotIndex, subId, msgWaitingInd);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to the call-forwarding status on certain subscription.
+ *
+ * @param subId for which call forwarding status changed.
+ * @param callForwardInd {@code true} indicates there is call forwarding, {@code false}
+ * otherwise.
+ *
+ * @hide
+ */
+ public void notifyCallForwardingChanged(int subId, boolean callForwardInd) {
+ try {
+ sRegistry.notifyCallForwardingChangedForSubscriber(subId, callForwardInd);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to activity state changes on certain subscription.
+ *
+ * @param subId for which data activity state changed.
+ * @param dataActivityType indicates the latest data activity type e.g, {@link
+ * TelephonyManager#DATA_ACTIVITY_IN}
+ *
+ * @hide
+ */
+ public void notifyDataActivityChanged(int subId, @DataActivityType int dataActivityType) {
+ try {
+ sRegistry.notifyDataActivityForSubscriber(subId, dataActivityType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to default (Internet) data connection state on certain subscription.
+ *
+ * @param subId for which data connection state changed.
+ * @param slotIndex for which data connections state changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param state latest data connection state, e.g,
+ * @param isDataConnectivityPossible indicates if data is allowed
+ * @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
+ * @param linkProperties {@link LinkProperties} associated with this data connection.
+ * @param networkCapabilities {@link NetworkCapabilities} associated with this data connection.
+ * @param networkType associated with this data connection.
+ * @param roaming {@code true} indicates in roaming, {@false} otherwise.
+ * @see TelephonyManager#DATA_DISCONNECTED
+ * @see TelephonyManager#isDataConnectivityPossible()
+ *
+ * @hide
+ */
+ public void notifyDataConnectionForSubscriber(int slotIndex, int subId, @DataState int state,
+ boolean isDataConnectivityPossible,
+ @ApnType String apn, String apnType, LinkProperties linkProperties,
+ NetworkCapabilities networkCapabilities, int networkType, boolean roaming) {
+ try {
+ sRegistry.notifyDataConnectionForSubscriber(slotIndex, subId, state,
+ isDataConnectivityPossible,
+ apn, apnType, linkProperties, networkCapabilities, networkType, roaming);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link CallQuality} change on certain subscription.
+ *
+ * @param subId for which call quality state changed.
+ * @param slotIndex for which call quality state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param callQuality Information about call quality e.g, call quality level
+ * @param networkType associated with this data connection. e.g, LTE
+ *
+ * @hide
+ */
+ public void notifyCallQualityChanged(int subId, int slotIndex, CallQuality callQuality,
+ @NetworkType int networkType) {
+ try {
+ sRegistry.notifyCallQualityChanged(callQuality, slotIndex, subId, networkType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify emergency number list changed on certain subscription.
+ *
+ * @param subId for which emergency number list changed.
+ * @param slotIndex for which emergency number list changed. Can be derived from subId except
+ * when subId is invalid.
+ *
+ * @hide
+ */
+ public void notifyEmergencyNumberList(int subId, int slotIndex) {
+ try {
+ sRegistry.notifyEmergencyNumberList(slotIndex, subId);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify radio power state changed on certain subscription.
+ *
+ * @param subId for which radio power state changed.
+ * @param slotIndex for which radio power state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param radioPowerState the current modem radio state.
+ *
+ * @hide
+ */
+ public void notifyRadioPowerStateChanged(int subId, int slotIndex,
+ @RadioPowerState int radioPowerState) {
+ try {
+ sRegistry.notifyRadioPowerStateChanged(slotIndex, subId, radioPowerState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link PhoneCapability} changed.
+ *
+ * @param phoneCapability the capability of the modem group.
+ *
+ * @hide
+ */
+ public void notifyPhoneCapabilityChanged(PhoneCapability phoneCapability) {
+ try {
+ sRegistry.notifyPhoneCapabilityChanged(phoneCapability);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify data activation state changed on certain subscription.
+ * @see TelephonyManager#getDataActivationState()
+ *
+ * @param subId for which data activation state changed.
+ * @param slotIndex for which data activation state changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param activationState sim activation state e.g, activated.
+ *
+ * @hide
+ */
+ public void notifyDataActivationStateChanged(int subId, int slotIndex,
+ @SimActivationState int activationState) {
+ try {
+ sRegistry.notifySimActivationStateChangedForPhoneId(slotIndex, subId,
+ TelephonyManager.SIM_ACTIVATION_TYPE_DATA, activationState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify voice activation state changed on certain subscription.
+ * @see TelephonyManager#getVoiceActivationState()
+ *
+ * @param subId for which voice activation state changed.
+ * @param slotIndex for which voice activation state changed. Can be derived from subId except
+ * subId is invalid.
+ * @param activationState sim activation state e.g, activated.
+ *
+ * @hide
+ */
+ public void notifyVoiceActivationStateChanged(int subId, int slotIndex,
+ @SimActivationState int activationState) {
+ try {
+ sRegistry.notifySimActivationStateChangedForPhoneId(slotIndex, subId,
+ TelephonyManager.SIM_ACTIVATION_TYPE_VOICE, activationState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify User mobile data state changed on certain subscription. e.g, mobile data is enabled
+ * or disabled.
+ *
+ * @param subId for which mobile data state has changed.
+ * @param slotIndex for which mobile data state has changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param state {@code true} indicates mobile data is enabled/on. {@code false} otherwise.
+ *
+ * @hide
+ */
+ public void notifyUserMobileDataStateChanged(int slotIndex, int subId, boolean state) {
+ try {
+ sRegistry.notifyUserMobileDataStateChangedForPhoneId(slotIndex, subId, state);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * TODO: this is marked as deprecated, can we move this one safely?
+ *
+ * @param subId
+ * @param slotIndex
+ * @param rawData
+ *
+ * @hide
+ */
+ public void notifyOemHookRawEventForSubscriber(int subId, int slotIndex, byte[] rawData) {
+ try {
+ sRegistry.notifyOemHookRawEventForSubscriber(slotIndex, subId, rawData);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}.
+ *
+ * @param subId for which ims call disconnect.
+ * @param imsReasonInfo the reason for ims call disconnect.
+ *
+ * @hide
+ */
+ public void notifyImsDisconnectCause(int subId, ImsReasonInfo imsReasonInfo) {
+ try {
+ sRegistry.notifyImsDisconnectCause(subId, imsReasonInfo);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify precise data connection failed cause on certain subscription.
+ *
+ * @param subId for which data connection failed.
+ * @param slotIndex for which data conenction failed. Can be derived from subId except when
+ * subId is invalid.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
+ * @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
+ * @param failCause data fail cause.
+ *
+ * @hide
+ */
+ public void notifyPreciseDataConnectionFailed(int subId, int slotIndex, String apnType,
+ String apn, @DataFailureCause int failCause) {
+ try {
+ sRegistry.notifyPreciseDataConnectionFailed(slotIndex, subId, apnType, apn, failCause);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify single Radio Voice Call Continuity (SRVCC) state change for the currently active call
+ * on certain subscription.
+ *
+ * @param subId for which srvcc state changed.
+ * @param state srvcc state
+ *
+ * @hide
+ */
+ public void notifySrvccStateChanged(int subId, @SrvccState int state) {
+ try {
+ sRegistry.notifySrvccStateChanged(subId, state);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify over the air sim provisioning(OTASP) mode changed on certain subscription.
+ *
+ * @param subId for which otasp mode changed.
+ * @param otaspMode latest mode for OTASP e.g, OTASP needed.
+ *
+ * @hide
+ */
+ public void notifyOtaspChanged(int subId, int otaspMode) {
+ try {
+ sRegistry.notifyOtaspChanged(subId, otaspMode);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify precise call state changed on certain subscription, including foreground, background
+ * and ringcall states.
+ *
+ * @param subId for which precise call state changed.
+ * @param slotIndex for which precise call state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param ringCallPreciseState ringCall state.
+ * @param foregroundCallPreciseState foreground call state.
+ * @param backgroundCallPreciseState background call state.
+ *
+ * @hide
+ */
+ public void notifyPreciseCallState(int subId, int slotIndex, @State int ringCallPreciseState,
+ @State int foregroundCallPreciseState, @State int backgroundCallPreciseState) {
+ try {
+ sRegistry.notifyPreciseCallState(slotIndex, subId, ringCallPreciseState,
+ foregroundCallPreciseState, backgroundCallPreciseState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify call disconnect causes which contains {@link DisconnectCause} and {@link
+ * android.telephony.PreciseDisconnectCause}.
+ *
+ * @param subId for which call disconnected.
+ * @param slotIndex for which call disconnected. Can be derived from subId except when subId is
+ * invalid.
+ * @param cause {@link DisconnectCause} for the disconnected call.
+ * @param preciseCause {@link android.telephony.PreciseDisconnectCause} for the disconnected
+ * call.
+ *
+ * @hide
+ */
+ public void notifyDisconnectCause(int slotIndex, int subId, int cause, int preciseCause) {
+ try {
+ sRegistry.notifyDisconnectCause(slotIndex, subId, cause, preciseCause);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify data connection failed on certain subscription.
+ *
+ * @param subId for which data connection failed.
+ * @param slotIndex for which data conenction faled. Can be derived from subId except when subId
+ * is invalid.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN. Note each data
+ * connection can support multiple anyTypes.
+ *
+ * @hide
+ */
+ public void notifyDataConnectionFailed(int subId, int slotIndex, String apnType) {
+ try {
+ sRegistry.notifyDataConnectionFailedForSubscriber(slotIndex, subId, apnType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * TODO change from bundle to CellLocation?
+ * @hide
+ */
+ public void notifyCellLocation(int subId, Bundle cellLocation) {
+ try {
+ sRegistry.notifyCellLocationForSubscriber(subId, cellLocation);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link CellInfo} changed on certain subscription. e.g, when an observed cell info has
+ * changed or new cells have been added or removed on the given subscription.
+ *
+ * @param subId for which cellinfo changed.
+ * @param cellInfo A list of cellInfo associated with the given subscription.
+ *
+ * @hide
+ */
+ public void notifyCellInfoChanged(int subId, List<CellInfo> cellInfo) {
+ try {
+ sRegistry.notifyCellInfoForSubscriber(subId, cellInfo);
+ } catch (RemoteException ex) {
+
+ }
+ }
+
+}
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 0827fd6e725e..3d54ba10ef0c 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -35,6 +35,7 @@ import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.DataUsageFeedback;
+import android.telecom.CallerInfo;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -42,7 +43,6 @@ import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
-import com.android.internal.telephony.CallerInfo;
import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -728,10 +728,11 @@ public class CallLog {
String accountAddress = getLogAccountAddress(context, accountHandle);
int numberPresentation = getLogNumberPresentation(number, presentation);
+ String name = (ci != null) ? ci.getName() : "";
if (numberPresentation != PRESENTATION_ALLOWED) {
number = "";
if (ci != null) {
- ci.name = "";
+ name = "";
}
}
@@ -760,9 +761,7 @@ public class CallLog {
values.put(PHONE_ACCOUNT_ID, accountId);
values.put(PHONE_ACCOUNT_ADDRESS, accountAddress);
values.put(NEW, Integer.valueOf(1));
- if ((ci != null) && (ci.name != null)) {
- values.put(CACHED_NAME, ci.name);
- }
+ values.put(CACHED_NAME, name);
values.put(ADD_FOR_ALL_USERS, addForAllUsers ? 1 : 0);
if (callType == MISSED_TYPE) {
@@ -773,7 +772,7 @@ public class CallLog {
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);
- if ((ci != null) && (ci.contactIdOrZero > 0)) {
+ if ((ci != null) && (ci.getContactId() > 0)) {
// Update usage information for the number associated with the contact ID.
// We need to use both the number and the ID for obtaining a data ID since other
// contacts may have the same number.
@@ -787,17 +786,18 @@ public class CallLog {
cursor = resolver.query(Phone.CONTENT_URI,
new String[] { Phone._ID },
Phone.CONTACT_ID + " =? AND " + Phone.NORMALIZED_NUMBER + " =?",
- new String[] { String.valueOf(ci.contactIdOrZero),
+ new String[] { String.valueOf(ci.getContactId()),
normalizedPhoneNumber},
null);
} else {
- final String phoneNumber = ci.phoneNumber != null ? ci.phoneNumber : number;
+ final String phoneNumber = ci.getPhoneNumber() != null
+ ? ci.getPhoneNumber() : number;
cursor = resolver.query(
Uri.withAppendedPath(Callable.CONTENT_FILTER_URI,
Uri.encode(phoneNumber)),
new String[] { Phone._ID },
Phone.CONTACT_ID + " =?",
- new String[] { String.valueOf(ci.contactIdOrZero) },
+ new String[] { String.valueOf(ci.getContactId()) },
null);
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index ee36dfe56fc4..eb2c61cbac84 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8962,6 +8962,14 @@ public final class Settings {
private static final Validator AWARE_LOCK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
/**
+ * Controls whether tap gesture is enabled.
+ * @hide
+ */
+ public static final String TAP_GESTURE = "tap_gesture";
+
+ private static final Validator TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
+
+ /**
* This are the settings to be backed up.
*
* NOTE: Settings are backed up and restored in the order they appear
@@ -9294,6 +9302,7 @@ public final class Settings {
VALIDATORS.put(AWARE_LOCK_ENABLED, AWARE_LOCK_ENABLED_VALIDATOR);
VALIDATORS.put(AWARE_TAP_PAUSE_GESTURE_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR);
VALIDATORS.put(AWARE_TAP_PAUSE_TOUCH_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR);
+ VALIDATORS.put(TAP_GESTURE, TAP_GESTURE_VALIDATOR);
}
/**
diff --git a/core/java/android/provider/SettingsStringUtil.java b/core/java/android/provider/SettingsStringUtil.java
index a3dc9471a1d0..9e495dd775dc 100644
--- a/core/java/android/provider/SettingsStringUtil.java
+++ b/core/java/android/provider/SettingsStringUtil.java
@@ -126,7 +126,7 @@ public class SettingsStringUtil {
@Override
protected String itemToString(ComponentName item) {
- return item.flattenToString();
+ return item != null ? item.flattenToString() : "null";
}
public static String add(String delimitedElements, ComponentName element) {
diff --git a/core/java/android/service/carrier/CarrierMessagingServiceWrapper.java b/core/java/android/service/carrier/CarrierMessagingServiceWrapper.java
new file mode 100644
index 000000000000..de90b94d7535
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierMessagingServiceWrapper.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.carrier;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.net.Uri;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.List;
+
+/**
+ * Provides basic structure for platform to connect to the carrier messaging service.
+ * <p>
+ * <code>
+ * CarrierMessagingServiceWrapper carrierMessagingServiceWrapper =
+ * new CarrierMessagingServiceWrapperImpl();
+ * if (carrierMessagingServiceWrapper.bindToCarrierMessagingService(context, carrierPackageName)) {
+ * // wait for onServiceReady callback
+ * } else {
+ * // Unable to bind: handle error.
+ * }
+ * </code>
+ * <p> Upon completion {@link #disposeConnection} should be called to unbind the
+ * CarrierMessagingService.
+ * @hide
+ */
+@SystemApi
+public abstract class CarrierMessagingServiceWrapper {
+ // Populated by bindToCarrierMessagingService. bindToCarrierMessagingService must complete
+ // prior to calling disposeConnection so that mCarrierMessagingServiceConnection is initialized.
+ private volatile CarrierMessagingServiceConnection mCarrierMessagingServiceConnection;
+
+ private volatile ICarrierMessagingService mICarrierMessagingService;
+
+ /**
+ * Binds to the carrier messaging service under package {@code carrierPackageName}. This method
+ * should be called exactly once.
+ *
+ * @param context the context
+ * @param carrierPackageName the carrier package name
+ * @return true upon successfully binding to a carrier messaging service, false otherwise
+ * @hide
+ */
+ @SystemApi
+ public boolean bindToCarrierMessagingService(@NonNull Context context,
+ @NonNull String carrierPackageName) {
+ Preconditions.checkState(mCarrierMessagingServiceConnection == null);
+
+ Intent intent = new Intent(CarrierMessagingService.SERVICE_INTERFACE);
+ intent.setPackage(carrierPackageName);
+ mCarrierMessagingServiceConnection = new CarrierMessagingServiceConnection();
+ return context.bindService(intent, mCarrierMessagingServiceConnection,
+ Context.BIND_AUTO_CREATE);
+ }
+
+ /**
+ * Unbinds the carrier messaging service. This method should be called exactly once.
+ *
+ * @param context the context
+ * @hide
+ */
+ @SystemApi
+ public void disposeConnection(@NonNull Context context) {
+ Preconditions.checkNotNull(mCarrierMessagingServiceConnection);
+ context.unbindService(mCarrierMessagingServiceConnection);
+ mCarrierMessagingServiceConnection = null;
+ }
+
+ /**
+ * Implemented by subclasses to use the carrier messaging service once it is ready.
+ * @hide
+ */
+ @SystemApi
+ public abstract void onServiceReady();
+
+ /**
+ * Called when connection with service is established.
+ *
+ * @param carrierMessagingService the carrier messaing service interface
+ */
+ private void onServiceReady(ICarrierMessagingService carrierMessagingService) {
+ mICarrierMessagingService = carrierMessagingService;
+ onServiceReady();
+ }
+
+ /**
+ * Request filtering an incoming SMS message.
+ * The service will call callback.onFilterComplete with the filtering result.
+ *
+ * @param pdu the PDUs of the message
+ * @param format the format of the PDUs, typically "3gpp" or "3gpp2"
+ * @param destPort the destination port of a data SMS. It will be -1 for text SMS
+ * @param subId SMS subscription ID of the SIM
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void filterSms(@NonNull MessagePdu pdu, @NonNull String format, int destPort,
+ int subId, @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.filterSms(pdu, format, destPort, subId,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new text SMS from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendSmsComplete} with the send
+ * status.
+ *
+ * @param text the text to send
+ * @param subId SMS subscription ID of the SIM
+ * @param destAddress phone number of the recipient of the message
+ * @param sendSmsFlag flag for sending SMS
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendTextSms(@NonNull String text, int subId, @NonNull String destAddress,
+ int sendSmsFlag, @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendTextSms(text, subId, destAddress, sendSmsFlag,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new data SMS from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendSmsComplete} with the send
+ * status.
+ *
+ * @param data the data to send
+ * @param subId SMS subscription ID of the SIM
+ * @param destAddress phone number of the recipient of the message
+ * @param destPort port number of the recipient of the message
+ * @param sendSmsFlag flag for sending SMS
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendDataSms(@NonNull byte[] data, int subId, @NonNull String destAddress,
+ int destPort, int sendSmsFlag,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendDataSms(data, subId, destAddress, destPort,
+ sendSmsFlag, new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new multi-part text SMS from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendMultipartSmsComplete}
+ * with the send status.
+ *
+ * @param parts the parts of the multi-part text SMS to send
+ * @param subId SMS subscription ID of the SIM
+ * @param destAddress phone number of the recipient of the message
+ * @param sendSmsFlag flag for sending SMS
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendMultipartTextSms(@NonNull List<String> parts, int subId,
+ @NonNull String destAddress, int sendSmsFlag,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendMultipartTextSms(parts, subId, destAddress,
+ sendSmsFlag, new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new MMS PDU from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendMmsComplete} with the send
+ * status.
+ *
+ * @param pduUri the content provider URI of the PDU to send
+ * @param subId SMS subscription ID of the SIM
+ * @param location the optional URI to send this MMS PDU. If this is {code null},
+ * the PDU should be sent to the default MMSC URL.
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendMms(@NonNull Uri pduUri, int subId, @NonNull Uri location,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendMms(pduUri, subId, location,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request downloading a new MMS.
+ * The service will call {@link ICarrierMessagingCallback#onDownloadMmsComplete} with the
+ * download status.
+ *
+ * @param pduUri the content provider URI of the PDU to be downloaded.
+ * @param subId SMS subscription ID of the SIM
+ * @param location the URI of the message to be downloaded.
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void downloadMms(@NonNull Uri pduUri, int subId, @NonNull Uri location,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.downloadMms(pduUri, subId, location,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * A basic {@link ServiceConnection}.
+ */
+ private final class CarrierMessagingServiceConnection implements ServiceConnection {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ onServiceReady(ICarrierMessagingService.Stub.asInterface(service));
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+ }
+
+ /**
+ * Callback wrapper used for response to requests exposed by
+ * {@link CarrierMessagingServiceWrapper}.
+ * @hide
+ */
+ @SystemApi
+ public abstract static class CarrierMessagingCallbackWrapper {
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#filterSms}.
+ * @param result a bitmask integer to indicate how the incoming text SMS should be handled
+ * by the platform. Bits set can be
+ * {@link CarrierMessagingService#RECEIVE_OPTIONS_DROP} and
+ * {@link CarrierMessagingService#
+ * RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE}.
+ * {@see CarrierMessagingService#onReceiveTextSms}.
+ * @hide
+ */
+ @SystemApi
+ public void onFilterComplete(int result) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#sendTextSms} and
+ * {@link CarrierMessagingServiceWrapper#sendDataSms}.
+ * @param result send status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @param messageRef message reference of the just-sent message. This field is applicable
+ * only if result is {@link CarrierMessagingService#SEND_STATUS_OK}.
+ * @hide
+ */
+ @SystemApi
+ public void onSendSmsComplete(int result, int messageRef) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#sendMultipartTextSms}.
+ * @param result send status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @param messageRefs an array of message references, one for each part of the
+ * multipart SMS. This field is applicable only if result is
+ * {@link CarrierMessagingService#SEND_STATUS_OK}.
+ * @hide
+ */
+ @SystemApi
+ public void onSendMultipartSmsComplete(int result, @Nullable int[] messageRefs) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#sendMms}.
+ * @param result send status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @param sendConfPdu a possibly {code null} SendConf PDU, which confirms that the message
+ * was sent. sendConfPdu is ignored if the {@code result} is not
+ * {@link CarrierMessagingService#SEND_STATUS_OK}.
+ * @hide
+ */
+ @SystemApi
+ public void onSendMmsComplete(int result, @Nullable byte[] sendConfPdu) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#downloadMms}.
+ * @param result download status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @hide
+ */
+ @SystemApi
+ public void onDownloadMmsComplete(int result) {
+
+ }
+ }
+
+ private final class CarrierMessagingCallbackWrapperInternal
+ extends ICarrierMessagingCallback.Stub {
+ CarrierMessagingCallbackWrapper mCarrierMessagingCallbackWrapper;
+
+ CarrierMessagingCallbackWrapperInternal(CarrierMessagingCallbackWrapper callback) {
+ mCarrierMessagingCallbackWrapper = callback;
+ }
+
+ @Override
+ public void onFilterComplete(int result) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onFilterComplete(result);
+ }
+
+ @Override
+ public void onSendSmsComplete(int result, int messageRef) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onSendSmsComplete(result, messageRef);
+ }
+
+ @Override
+ public void onSendMultipartSmsComplete(int result, int[] messageRefs)
+ throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onSendMultipartSmsComplete(result, messageRefs);
+ }
+
+ @Override
+ public void onSendMmsComplete(int result, byte[] sendConfPdu) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onSendMmsComplete(result, sendConfPdu);
+ }
+
+ @Override
+ public void onDownloadMmsComplete(int result) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onDownloadMmsComplete(result);
+ }
+ }
+}
diff --git a/core/java/android/service/carrier/CarrierService.java b/core/java/android/service/carrier/CarrierService.java
index aeb186b00686..9184d6d51f44 100644
--- a/core/java/android/service/carrier/CarrierService.java
+++ b/core/java/android/service/carrier/CarrierService.java
@@ -16,17 +16,15 @@ package android.service.carrier;
import android.annotation.CallSuper;
import android.app.Service;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PersistableBundle;
-import android.os.RemoteException;
import android.os.ResultReceiver;
-import android.os.ServiceManager;
+import android.os.telephony.TelephonyRegistryManager;
import android.util.Log;
-import com.android.internal.telephony.ITelephonyRegistry;
-
/**
* A service that exposes carrier-specific functionality to the system.
* <p>
@@ -55,16 +53,10 @@ public abstract class CarrierService extends Service {
public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService";
- private static ITelephonyRegistry sRegistry;
-
private final ICarrierService.Stub mStubWrapper;
public CarrierService() {
mStubWrapper = new ICarrierServiceWrapper();
- if (sRegistry == null) {
- sRegistry = ITelephonyRegistry.Stub.asInterface(
- ServiceManager.getService("telephony.registry"));
- }
}
/**
@@ -122,9 +114,12 @@ public abstract class CarrierService extends Service {
* @see android.telephony.TelephonyManager#hasCarrierPrivileges
*/
public final void notifyCarrierNetworkChange(boolean active) {
- try {
- if (sRegistry != null) sRegistry.notifyCarrierNetworkChange(active);
- } catch (RemoteException | NullPointerException ex) {}
+ TelephonyRegistryManager telephonyRegistryMgr =
+ (TelephonyRegistryManager) this.getSystemService(
+ Context.TELEPHONY_REGISTRY_SERVICE);
+ if (telephonyRegistryMgr != null) {
+ telephonyRegistryMgr.notifyCarrierNetworkChange(active);
+ }
}
/**
diff --git a/core/java/android/service/carrier/ICarrierMessagingService.aidl b/core/java/android/service/carrier/ICarrierMessagingService.aidl
index 2d96c3da6487..c4dfb57bb6a0 100644
--- a/core/java/android/service/carrier/ICarrierMessagingService.aidl
+++ b/core/java/android/service/carrier/ICarrierMessagingService.aidl
@@ -36,6 +36,7 @@ oneway interface ICarrierMessagingService {
* @param subId SMS subscription ID of the SIM
* @param callback the callback to notify upon completion
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void filterSms(
in MessagePdu pdu, String format, int destPort, int subId,
in ICarrierMessagingCallback callback);
diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl
index d3f2a70029f7..d254ffdb6986 100644
--- a/core/java/android/service/dreams/IDreamManager.aidl
+++ b/core/java/android/service/dreams/IDreamManager.aidl
@@ -29,6 +29,7 @@ interface IDreamManager {
void awaken();
@UnsupportedAppUsage
void setDreamComponents(in ComponentName[] componentNames);
+ @UnsupportedAppUsage
ComponentName[] getDreamComponents();
ComponentName getDefaultDreamComponent();
void testDream(in ComponentName componentName);
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index ff8b13506201..12c25806d666 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -15,6 +15,8 @@
*/
package android.service.euicc;
+import static android.telephony.euicc.EuiccCardManager.ResetOption;
+
import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -503,7 +505,7 @@ public abstract class EuiccService extends Service {
String nickname);
/**
- * Erase all of the subscriptions on the device.
+ * Erase all operational subscriptions on the device.
*
* <p>This is intended to be used for device resets. As such, the reset should be performed even
* if an active SIM must be deactivated in order to access the eUICC.
@@ -512,10 +514,31 @@ public abstract class EuiccService extends Service {
* @return the result of the erase operation. May be one of the predefined {@code RESULT_}
* constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}.
* @see android.telephony.euicc.EuiccManager#eraseSubscriptions
+ *
+ * @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
+ * and use {@link #onEraseSubscriptionsWithOptions(int, int)} instead
*/
+ @Deprecated
public abstract int onEraseSubscriptions(int slotId);
/**
+ * Erase specific subscriptions on the device.
+ *
+ * <p>This is intended to be used for device resets. As such, the reset should be performed even
+ * if an active SIM must be deactivated in order to access the eUICC.
+ *
+ * @param slotIndex index of the SIM slot to use for the operation.
+ * @param options flag for specific group of subscriptions to erase
+ * @return the result of the erase operation. May be one of the predefined {@code RESULT_}
+ * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}.
+ * @see android.telephony.euicc.EuiccManager#eraseSubscriptionsWithOptions
+ */
+ public int onEraseSubscriptionsWithOptions(int slotIndex, @ResetOption int options) {
+ throw new UnsupportedOperationException(
+ "This method must be overridden to enable the ResetOption parameter");
+ }
+
+ /**
* Ensure that subscriptions will be retained on the next factory reset.
*
* <p>Called directly before a factory reset. Assumes that a normal factory reset will lead to
@@ -751,6 +774,23 @@ public abstract class EuiccService extends Service {
}
@Override
+ public void eraseSubscriptionsWithOptions(
+ int slotIndex, @ResetOption int options, IEraseSubscriptionsCallback callback) {
+ mExecutor.execute(new Runnable() {
+ @Override
+ public void run() {
+ int result = EuiccService.this.onEraseSubscriptionsWithOptions(
+ slotIndex, options);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+ });
+ }
+
+ @Override
public void retainSubscriptionsForFactoryReset(int slotId,
IRetainSubscriptionsForFactoryResetCallback callback) {
mExecutor.execute(new Runnable() {
diff --git a/core/java/android/service/euicc/IEuiccService.aidl b/core/java/android/service/euicc/IEuiccService.aidl
index c2cdf093706f..2acc47aae919 100644
--- a/core/java/android/service/euicc/IEuiccService.aidl
+++ b/core/java/android/service/euicc/IEuiccService.aidl
@@ -52,6 +52,8 @@ oneway interface IEuiccService {
void updateSubscriptionNickname(int slotId, String iccid, String nickname,
in IUpdateSubscriptionNicknameCallback callback);
void eraseSubscriptions(int slotId, in IEraseSubscriptionsCallback callback);
+ void eraseSubscriptionsWithOptions(
+ int slotIndex, int options, in IEraseSubscriptionsCallback callback);
void retainSubscriptionsForFactoryReset(
int slotId, in IRetainSubscriptionsForFactoryResetCallback callback);
} \ No newline at end of file
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index b44c9d59ebe5..93e3ea44f7c7 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -1514,6 +1514,7 @@ public abstract class NotificationListenerService extends Service {
private ArrayList<Notification.Action> mSmartActions;
private ArrayList<CharSequence> mSmartReplies;
private boolean mCanBubble;
+ private boolean mVisuallyInterruptive;
private static final int PARCEL_VERSION = 2;
@@ -1545,6 +1546,7 @@ public abstract class NotificationListenerService extends Service {
out.writeTypedList(mSmartActions, flags);
out.writeCharSequenceList(mSmartReplies);
out.writeBoolean(mCanBubble);
+ out.writeBoolean(mVisuallyInterruptive);
}
/** @hide */
@@ -1577,6 +1579,7 @@ public abstract class NotificationListenerService extends Service {
mSmartActions = in.createTypedArrayList(Notification.Action.CREATOR);
mSmartReplies = in.readCharSequenceList();
mCanBubble = in.readBoolean();
+ mVisuallyInterruptive = in.readBoolean();
}
@@ -1764,6 +1767,11 @@ public abstract class NotificationListenerService extends Service {
}
/** @hide */
+ public boolean visuallyInterruptive() {
+ return mVisuallyInterruptive;
+ }
+
+ /** @hide */
public boolean isNoisy() {
return mNoisy;
}
@@ -1779,7 +1787,8 @@ public abstract class NotificationListenerService extends Service {
ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge,
int userSentiment, boolean hidden, long lastAudiblyAlertedMs,
boolean noisy, ArrayList<Notification.Action> smartActions,
- ArrayList<CharSequence> smartReplies, boolean canBubble) {
+ ArrayList<CharSequence> smartReplies, boolean canBubble,
+ boolean visuallyInterruptive) {
mKey = key;
mRank = rank;
mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW;
@@ -1800,6 +1809,7 @@ public abstract class NotificationListenerService extends Service {
mSmartActions = smartActions;
mSmartReplies = smartReplies;
mCanBubble = canBubble;
+ mVisuallyInterruptive = visuallyInterruptive;
}
/**
@@ -1824,7 +1834,8 @@ public abstract class NotificationListenerService extends Service {
other.mNoisy,
other.mSmartActions,
other.mSmartReplies,
- other.mCanBubble);
+ other.mCanBubble,
+ other.mVisuallyInterruptive);
}
/**
diff --git a/core/java/android/util/Singleton.java b/core/java/android/util/Singleton.java
index 33135e6fd62c..15c6b5b5d7f8 100644
--- a/core/java/android/util/Singleton.java
+++ b/core/java/android/util/Singleton.java
@@ -26,6 +26,11 @@ import android.annotation.UnsupportedAppUsage;
* @hide
*/
public abstract class Singleton<T> {
+
+ @UnsupportedAppUsage
+ public Singleton() {
+ }
+
@UnsupportedAppUsage
private T mInstance;
diff --git a/core/java/android/view/AccessibilityIterators.java b/core/java/android/view/AccessibilityIterators.java
index 54cfc00cb5b3..5f9bf39fb3dd 100644
--- a/core/java/android/view/AccessibilityIterators.java
+++ b/core/java/android/view/AccessibilityIterators.java
@@ -47,6 +47,10 @@ public final class AccessibilityIterators {
public static abstract class AbstractTextSegmentIterator implements TextSegmentIterator {
@UnsupportedAppUsage
+ public AbstractTextSegmentIterator() {
+ }
+
+ @UnsupportedAppUsage
protected String mText;
private final int[] mSegment = new int[2];
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 39792ce58367..1c3294858db8 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -151,6 +151,7 @@ interface IWindowManager
float getCurrentAnimatorScale();
// For testing
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void setInTouchMode(boolean showFocus);
// For StrictMode flashing a red border on violations from the UI
@@ -158,6 +159,7 @@ interface IWindowManager
// Manager uses that to determine whether or not the red border should
// actually be shown. (it will be ignored that pid doesn't have windows
// on screen)
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void showStrictModeViolation(boolean on);
// Proxy to set the system property for whether the flashing
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index c6536bb71cba..8bbfd7441d0a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -492,7 +492,7 @@ import java.util.function.Predicate;
*
* <p>
* To initiate a layout, call {@link #requestLayout}. This method is typically
- * called by a view on itself when it believes that is can no longer fit within
+ * called by a view on itself when it believes that it can no longer fit within
* its current bounds.
* </p>
*
@@ -2850,7 +2850,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Default for the root view. The gravity determines the text alignment, ALIGN_NORMAL,
- * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction.
+ * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph's text direction.
*
* Use with {@link #setTextAlignment(int)}
*/
@@ -2878,7 +2878,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
public static final int TEXT_ALIGNMENT_CENTER = 4;
/**
- * Align to the start of the view, which is ALIGN_LEFT if the view’s resolved
+ * Align to the start of the view, which is ALIGN_LEFT if the view's resolved
* layoutDirection is LTR, and ALIGN_RIGHT otherwise.
*
* Use with {@link #setTextAlignment(int)}
@@ -2886,7 +2886,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
public static final int TEXT_ALIGNMENT_VIEW_START = 5;
/**
- * Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved
+ * Align to the end of the view, which is ALIGN_RIGHT if the view's resolved
* layoutDirection is LTR, and ALIGN_LEFT otherwise.
*
* Use with {@link #setTextAlignment(int)}
@@ -3689,7 +3689,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* if the user swipes from the top of the screen.
* <p>When system bars are hidden in immersive mode, they can be revealed temporarily with
* system gestures, such as swiping from the top of the screen. These transient system bars
- * will overlay app’s content, may have some degree of transparency, and will automatically
+ * will overlay app's content, may have some degree of transparency, and will automatically
* hide after a short timeout.
* </p><p>Since this flag is a modifier for {@link #SYSTEM_UI_FLAG_FULLSCREEN} and
* {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, it only has an effect when used in combination
@@ -4555,6 +4555,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
static class ListenerInfo {
+
+ @UnsupportedAppUsage
+ ListenerInfo() {
+ }
+
/**
* Listener used to dispatch focus change events.
* This field should be made private, so it is hidden from the SDK.
@@ -10293,7 +10298,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
- * Gets the unique identifier of the window in which this View reseides.
+ * Gets the unique identifier of the window in which this View resides.
*
* @return The window accessibility id.
*
@@ -26391,7 +26396,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Returns the over-scroll mode for this view. The result will be
- * one of {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
+ * one of {@link #OVER_SCROLL_ALWAYS}, {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
* (allow over-scrolling only if the view content is larger than the container),
* or {@link #OVER_SCROLL_NEVER}.
*
@@ -26408,7 +26413,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Set the over-scroll mode for this view. Valid over-scroll modes are
- * {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
+ * {@link #OVER_SCROLL_ALWAYS}, {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
* (allow over-scrolling only if the view content is larger than the container),
* or {@link #OVER_SCROLL_NEVER}.
*
@@ -27842,6 +27847,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
private int mClassification;
+ @UnsupportedAppUsage
+ private CheckForLongPress() {
+ }
+
@Override
public void run() {
if ((mOriginalPressedState == isPressed()) && (mParent != null)
@@ -28327,6 +28336,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* whenever possible.
*/
static class InvalidateInfo {
+
+ @UnsupportedAppUsage
+ InvalidateInfo() {
+ }
+
private static final int POOL_LIMIT = 10;
private static final SynchronizedPool<InvalidateInfo> sPool =
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 8a1fd62c0201..c67fca59fe97 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -870,6 +870,94 @@ public class ViewDebug {
return null;
}
+ private static class StreamingPictureCallbackHandler implements AutoCloseable,
+ HardwareRenderer.PictureCapturedCallback, Runnable {
+ private final HardwareRenderer mRenderer;
+ private final Callable<OutputStream> mCallback;
+ private final Executor mExecutor;
+ private final ReentrantLock mLock = new ReentrantLock(false);
+ private final ArrayDeque<byte[]> mQueue = new ArrayDeque<>(3);
+ private final ByteArrayOutputStream mByteStream = new ByteArrayOutputStream();
+ private boolean mStopListening;
+ private Thread mRenderThread;
+
+ private StreamingPictureCallbackHandler(HardwareRenderer renderer,
+ Callable<OutputStream> callback, Executor executor) {
+ mRenderer = renderer;
+ mCallback = callback;
+ mExecutor = executor;
+ mRenderer.setPictureCaptureCallback(this);
+ }
+
+ @Override
+ public void close() {
+ mLock.lock();
+ mStopListening = true;
+ mLock.unlock();
+ mRenderer.setPictureCaptureCallback(null);
+ }
+
+ @Override
+ public void onPictureCaptured(Picture picture) {
+ mLock.lock();
+ if (mStopListening) {
+ mLock.unlock();
+ mRenderer.setPictureCaptureCallback(null);
+ return;
+ }
+ if (mRenderThread == null) {
+ mRenderThread = Thread.currentThread();
+ }
+ boolean needsInvoke = true;
+ if (mQueue.size() == 3) {
+ mQueue.removeLast();
+ needsInvoke = false;
+ }
+ picture.writeToStream(mByteStream);
+ mQueue.add(mByteStream.toByteArray());
+ mByteStream.reset();
+ mLock.unlock();
+
+ if (needsInvoke) {
+ mExecutor.execute(this);
+ }
+ }
+
+ @Override
+ public void run() {
+ mLock.lock();
+ final byte[] picture = mQueue.poll();
+ final boolean isStopped = mStopListening;
+ mLock.unlock();
+ if (Thread.currentThread() == mRenderThread) {
+ close();
+ throw new IllegalStateException(
+ "ViewDebug#startRenderingCommandsCapture must be given an executor that "
+ + "invokes asynchronously");
+ }
+ if (isStopped) {
+ return;
+ }
+ OutputStream stream = null;
+ try {
+ stream = mCallback.call();
+ } catch (Exception ex) {
+ Log.w("ViewDebug", "Aborting rendering commands capture "
+ + "because callback threw exception", ex);
+ }
+ if (stream != null) {
+ try {
+ stream.write(picture);
+ } catch (IOException ex) {
+ Log.w("ViewDebug", "Aborting rendering commands capture "
+ + "due to IOException writing to output stream", ex);
+ }
+ } else {
+ close();
+ }
+ }
+ }
+
/**
* Begins capturing the entire rendering commands for the view tree referenced by the given
* view. The view passed may be any View in the tree as long as it is attached. That is,
@@ -915,18 +1003,7 @@ public class ViewDebug {
}
final HardwareRenderer renderer = attachInfo.mThreadedRenderer;
if (renderer != null) {
- return new PictureCallbackHandler(renderer, (picture -> {
- try {
- OutputStream stream = callback.call();
- if (stream != null) {
- picture.writeToStream(stream);
- return true;
- }
- } catch (Exception ex) {
- // fall through
- }
- return false;
- }), executor);
+ return new StreamingPictureCallbackHandler(renderer, callback, executor);
}
return null;
}
diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java
index 9a5f4c9cc8b9..c72baca0b93b 100644
--- a/core/java/android/view/ViewTreeObserver.java
+++ b/core/java/android/view/ViewTreeObserver.java
@@ -218,6 +218,11 @@ public final class ViewTreeObserver {
* @hide
*/
public final static class InternalInsetsInfo {
+
+ @UnsupportedAppUsage
+ public InternalInsetsInfo() {
+ }
+
/**
* Offsets from the frame of the window at which the content of
* windows behind it should be placed.
diff --git a/core/java/android/view/animation/AnimationUtils.java b/core/java/android/view/animation/AnimationUtils.java
index c877b9cec812..f5b074674454 100644
--- a/core/java/android/view/animation/AnimationUtils.java
+++ b/core/java/android/view/animation/AnimationUtils.java
@@ -127,7 +127,7 @@ public class AnimationUtils {
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
- * @return The animation object reference by the specified id
+ * @return The animation object referenced by the specified id
* @throws NotFoundException when the animation cannot be loaded
*/
public static Animation loadAnimation(Context context, @AnimRes int id)
@@ -208,7 +208,7 @@ public class AnimationUtils {
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
- * @return The animation object reference by the specified id
+ * @return The animation controller object referenced by the specified id
* @throws NotFoundException when the layout animation controller cannot be loaded
*/
public static LayoutAnimationController loadLayoutAnimation(Context context, @AnimRes int id)
@@ -331,7 +331,7 @@ public class AnimationUtils {
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
- * @return The animation object reference by the specified id
+ * @return The interpolator object referenced by the specified id
* @throws NotFoundException
*/
public static Interpolator loadInterpolator(Context context, @AnimRes @InterpolatorRes int id)
@@ -361,7 +361,7 @@ public class AnimationUtils {
*
* @param res The resources
* @param id The resource id of the animation to load
- * @return The interpolator object reference by the specified id
+ * @return The interpolator object referenced by the specified id
* @throws NotFoundException
* @hide
*/
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 563e00e3ca6a..7e067197ced8 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -50,6 +50,11 @@ public final class CacheManager {
*/
@Deprecated
public static class CacheResult {
+
+ @UnsupportedAppUsage
+ public CacheResult() {
+ }
+
// these fields are saved to the database
@UnsupportedAppUsage
int httpStatusCode;
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index 23d12374453f..3824c22a40a7 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -22,7 +22,10 @@ import android.net.WebAddress;
/**
* Manages the cookies used by an application's {@link WebView} instances.
- * Cookies are manipulated according to RFC2109.
+ * <p>
+ * CookieManager represents cookies as strings in the same format as the
+ * HTTP {@code Cookie} and {@code Set-Cookie} header fields (defined in
+ * <a href="https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03">RFC6265bis</a>).
*/
public abstract class CookieManager {
/**
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 4db630808ef1..f8522edb7dcd 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -71,11 +71,24 @@ public class WebChromeClient {
}
/**
- * Notify the host application that the current page has entered full
- * screen mode. The host application must show the custom View which
- * contains the web contents &mdash; video or other HTML content &mdash;
- * in full screen mode. Also see "Full screen support" documentation on
- * {@link WebView}.
+ * Notify the host application that the current page has entered full screen mode. After this
+ * call, web content will no longer be rendered in the WebView, but will instead be rendered
+ * in {@code view}. The host application should add this View to a Window which is configured
+ * with {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} flag in order to
+ * actually display this web content full screen.
+ *
+ * <p>The application may explicitly exit fullscreen mode by invoking {@code callback} (ex. when
+ * the user presses the back button). However, this is generally not necessary as the web page
+ * will often show its own UI to close out of fullscreen. Regardless of how the WebView exits
+ * fullscreen mode, WebView will invoke {@link #onHideCustomView()}, signaling for the
+ * application to remove the custom View.
+ *
+ * <p>If this method is not overridden, WebView will report to the web page it does not support
+ * fullscreen mode and will not honor the web page's request to run in fullscreen mode.
+ *
+ * <p class="note"><b>Note:</b> if overriding this method, the application must also override
+ * {@link #onHideCustomView()}.
+ *
* @param view is the View object to be shown.
* @param callback invoke this callback to request the page to exit
* full screen mode.
@@ -98,10 +111,13 @@ public class WebChromeClient {
CustomViewCallback callback) {};
/**
- * Notify the host application that the current page has exited full
- * screen mode. The host application must hide the custom View, ie. the
- * View passed to {@link #onShowCustomView} when the content entered fullscreen.
- * Also see "Full screen support" documentation on {@link WebView}.
+ * Notify the host application that the current page has exited full screen mode. The host
+ * application must hide the custom View (the View which was previously passed to {@link
+ * #onShowCustomView(View, CustomViewCallback) onShowCustomView()}). After this call, web
+ * content will render in the original WebView again.
+ *
+ * <p class="note"><b>Note:</b> if overriding this method, the application must also override
+ * {@link #onShowCustomView(View, CustomViewCallback) onShowCustomView()}.
*/
public void onHideCustomView() {}
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 7282008f7e3a..2895621f962a 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -328,6 +328,9 @@ public abstract class WebSettings {
* <p>
* The built-in mechanisms are the only currently supported zoom
* mechanisms, so it is recommended that this setting is always enabled.
+ * However, on-screen zoom controls are deprecated in Android (see
+ * {@link android.widget.ZoomButtonsController}) so it's recommended to
+ * disable {@link #setDisplayZoomControls}.
*
* @param enabled whether the WebView should use its built-in zoom mechanisms
*/
@@ -347,7 +350,9 @@ public abstract class WebSettings {
/**
* Sets whether the WebView should display on-screen zoom controls when
* using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
- * The default is {@code true}.
+ * The default is {@code true}. However, on-screen zoom controls are deprecated
+ * in Android (see {@link android.widget.ZoomButtonsController}) so it's
+ * recommended to set this to {@code false}.
*
* @param enabled whether the WebView should display on-screen zoom controls
*/
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 2f44d6ee88b1..b732b7eeaa01 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -120,10 +120,6 @@ import java.util.function.Predicate;
* <a href="{@docRoot}training/improving-layouts/smooth-scrolling.html">
* Making ListView Scrolling Smooth</a> for more ways to ensure a smooth user experience.</p>
*
- * <p>For a more complete example of creating a custom adapter, see the
- * <a href="{@docRoot}samples/CustomChoiceList/index.html">
- * Custom Choice List</a> sample app.</p>
- *
* <p>To specify an action when a user clicks or taps on a single list item, see
* <a href="{@docRoot}guide/topics/ui/declaring-layout.html#HandlingUserSelections">
* Handling click events</a>.</p>
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 6b324a541c42..facb7d09f250 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -36,7 +36,6 @@ import android.view.ViewGroup;
import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.view.inspector.InspectableProperty;
-import android.view.inspector.InspectionCompanion;
import android.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.RemoteViews.RemoteView;
@@ -73,7 +72,7 @@ import java.util.TreeSet;
*
* <p>This behavior has been preserved for apps that set <code>android:targetSdkVersion="17"</code>
* or older in their manifest's <code>uses-sdk</code> tag for compatibility. Apps targeting SDK
- * version 18 or newer will receive the correct behavior</p>
+ * version 18 or newer will receive the correct behavior.</p>
*
* <p>See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative
* Layout</a> guide.</p>
@@ -2026,6 +2025,11 @@ public class RelativeLayout extends ViewGroup {
* A node with no dependent is considered a root of the graph.
*/
static class Node {
+
+ @UnsupportedAppUsage
+ Node() {
+ }
+
/**
* The view representing this node in the layout.
*/
diff --git a/core/java/android/widget/ScrollBarDrawable.java b/core/java/android/widget/ScrollBarDrawable.java
index 1bed32ecf347..a5d3e45323a4 100644
--- a/core/java/android/widget/ScrollBarDrawable.java
+++ b/core/java/android/widget/ScrollBarDrawable.java
@@ -60,6 +60,10 @@ public class ScrollBarDrawable extends Drawable implements Drawable.Callback {
private ColorFilter mColorFilter;
private boolean mHasSetColorFilter;
+ @UnsupportedAppUsage
+ public ScrollBarDrawable() {
+ }
+
/**
* Indicate whether the horizontal scrollbar track should always be drawn
* regardless of the extent. Defaults to false.
diff --git a/core/java/com/android/internal/app/AlertActivity.java b/core/java/com/android/internal/app/AlertActivity.java
index 0b08099b51ed..7307de5146f8 100644
--- a/core/java/com/android/internal/app/AlertActivity.java
+++ b/core/java/com/android/internal/app/AlertActivity.java
@@ -34,6 +34,10 @@ import android.view.accessibility.AccessibilityEvent;
*/
public abstract class AlertActivity extends Activity implements DialogInterface {
+ @UnsupportedAppUsage
+ public AlertActivity() {
+ }
+
/**
* The model for the alert.
*
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index cae1f3831b4a..102ba5c2ec5e 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -26,6 +26,7 @@ import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.UnsupportedAppUsage;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.prediction.AppPredictionContext;
@@ -141,6 +142,9 @@ import java.util.Set;
public class ChooserActivity extends ResolverActivity {
private static final String TAG = "ChooserActivity";
+ @UnsupportedAppUsage
+ public ChooserActivity() {
+ }
/**
* Boolean extra to change the following behavior: Normally, ChooserActivity finishes itself
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 068056f091d7..c7d2547a24f4 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -101,6 +101,10 @@ import java.util.Set;
@UiThread
public class ResolverActivity extends Activity {
+ @UnsupportedAppUsage
+ public ResolverActivity() {
+ }
+
// Temporary flag for new chooser delegate behavior.
boolean mEnableChooserDelegate = true;
diff --git a/core/java/com/android/internal/compat/CompatibilityChangeConfig.java b/core/java/com/android/internal/compat/CompatibilityChangeConfig.java
index fd2ada08edc1..36bc22906695 100644
--- a/core/java/com/android/internal/compat/CompatibilityChangeConfig.java
+++ b/core/java/com/android/internal/compat/CompatibilityChangeConfig.java
@@ -49,6 +49,18 @@ public final class CompatibilityChangeConfig implements Parcelable {
return mChangeConfig.forceDisabledSet();
}
+ /**
+ * Returns if a change is enabled or disabled in this config.
+ */
+ public boolean isChangeEnabled(long changeId) {
+ if (mChangeConfig.isForceEnabled(changeId)) {
+ return true;
+ } else if (mChangeConfig.isForceDisabled(changeId)) {
+ return false;
+ }
+ throw new IllegalStateException("Change " + changeId + " is not defined.");
+ }
+
private CompatibilityChangeConfig(Parcel in) {
long[] enabledArray = in.createLongArray();
long[] disabledArray = in.createLongArray();
diff --git a/core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl b/core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl
new file mode 100644
index 000000000000..3bc72771f99c
--- /dev/null
+++ b/core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.compat;
+
+parcelable CompatibilityChangeInfo;
diff --git a/core/java/com/android/internal/compat/CompatibilityChangeInfo.java b/core/java/com/android/internal/compat/CompatibilityChangeInfo.java
new file mode 100644
index 000000000000..e48e2df4043c
--- /dev/null
+++ b/core/java/com/android/internal/compat/CompatibilityChangeInfo.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.compat;
+
+import android.annotation.Nullable;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * This class is a parcelable version of {@link com.android.server.compat.Change}.
+ *
+ * @hide
+ */
+public class CompatibilityChangeInfo implements Parcelable {
+ private final long mChangeId;
+ private final @Nullable String mName;
+ private final int mEnableAfterTargetSdk;
+ private final boolean mDisabled;
+
+ public long getId() {
+ return mChangeId;
+ }
+
+ @Nullable
+ public String getName() {
+ return mName;
+ }
+
+ public int getEnableAfterTargetSdk() {
+ return mEnableAfterTargetSdk;
+ }
+
+ public boolean getDisabled() {
+ return mDisabled;
+ }
+
+ public CompatibilityChangeInfo(
+ Long changeId, String name, int enableAfterTargetSdk, boolean disabled) {
+ this.mChangeId = changeId;
+ this.mName = name;
+ this.mEnableAfterTargetSdk = enableAfterTargetSdk;
+ this.mDisabled = disabled;
+ }
+
+ private CompatibilityChangeInfo(Parcel in) {
+ mChangeId = in.readLong();
+ mName = in.readString();
+ mEnableAfterTargetSdk = in.readInt();
+ mDisabled = in.readBoolean();
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(mChangeId);
+ dest.writeString(mName);
+ dest.writeInt(mEnableAfterTargetSdk);
+ dest.writeBoolean(mDisabled);
+ }
+
+ public static final Parcelable.Creator<CompatibilityChangeInfo> CREATOR =
+ new Parcelable.Creator<CompatibilityChangeInfo>() {
+
+ @Override
+ public CompatibilityChangeInfo createFromParcel(Parcel in) {
+ return new CompatibilityChangeInfo(in);
+ }
+
+ @Override
+ public CompatibilityChangeInfo[] newArray(int size) {
+ return new CompatibilityChangeInfo[size];
+ }
+ };
+}
diff --git a/core/java/com/android/internal/compat/IPlatformCompat.aidl b/core/java/com/android/internal/compat/IPlatformCompat.aidl
index 8391ad2f12c2..5857642cbd4e 100644
--- a/core/java/com/android/internal/compat/IPlatformCompat.aidl
+++ b/core/java/com/android/internal/compat/IPlatformCompat.aidl
@@ -17,8 +17,10 @@
package com.android.internal.compat;
import android.content.pm.ApplicationInfo;
+import java.util.Map;
parcelable CompatibilityChangeConfig;
+parcelable CompatibilityChangeInfo;
/**
* Platform private API for talking with the PlatformCompat service.
@@ -146,4 +148,21 @@ interface IPlatformCompat
*
*/
void clearOverrides(in String packageName);
+
+ /**
+ * Get configs for an application.
+ *
+ * @param appInfo The application whose config will be returned.
+ *
+ * @return A {@link CompatibilityChangeConfig}, representing whether a change is enabled for
+ * the given app or not.
+ */
+ CompatibilityChangeConfig getAppConfig(in ApplicationInfo appInfo);
+
+ /**
+ * List all compatibility changes.
+ *
+ * @return An array of {@link CompatChangeInfo} known to the service.
+ */
+ CompatibilityChangeInfo[] listAllChanges();
}
diff --git a/core/java/com/android/internal/content/PackageMonitor.java b/core/java/com/android/internal/content/PackageMonitor.java
index c928f3f39f03..5d7d3af8750a 100644
--- a/core/java/com/android/internal/content/PackageMonitor.java
+++ b/core/java/com/android/internal/content/PackageMonitor.java
@@ -27,6 +27,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;
import android.util.Slog;
+
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.Preconditions;
@@ -72,6 +73,10 @@ public abstract class PackageMonitor extends android.content.BroadcastReceiver {
String[] mTempArray = new String[1];
@UnsupportedAppUsage
+ public PackageMonitor() {
+ }
+
+ @UnsupportedAppUsage
public void register(Context context, Looper thread, boolean externalStorage) {
register(context, thread, null, externalStorage);
}
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index a691a2403f37..f916cf64564d 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -41,6 +41,10 @@ public class MetricsLogger {
private static MetricsLogger sMetricsLogger;
+ @UnsupportedAppUsage
+ public MetricsLogger() {
+ }
+
private static MetricsLogger getLogger() {
if (sMetricsLogger == null) {
sMetricsLogger = new MetricsLogger();
diff --git a/core/java/com/android/internal/net/LegacyVpnInfo.java b/core/java/com/android/internal/net/LegacyVpnInfo.java
index 9ee97108ce49..2ad9759b1f68 100644
--- a/core/java/com/android/internal/net/LegacyVpnInfo.java
+++ b/core/java/com/android/internal/net/LegacyVpnInfo.java
@@ -45,6 +45,10 @@ public class LegacyVpnInfo implements Parcelable {
public int state = -1;
public PendingIntent intent;
+ @UnsupportedAppUsage
+ public LegacyVpnInfo() {
+ }
+
@Override
public int describeContents() {
return 0;
diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java
index 65b974ba8b42..e6be54964705 100644
--- a/core/java/com/android/internal/net/VpnConfig.java
+++ b/core/java/com/android/internal/net/VpnConfig.java
@@ -108,6 +108,10 @@ public class VpnConfig implements Parcelable {
public Network[] underlyingNetworks;
public ProxyInfo proxyInfo;
+ @UnsupportedAppUsage
+ public VpnConfig() {
+ }
+
public void updateAllowedFamilies(InetAddress address) {
if (address instanceof Inet4Address) {
allowIPv4 = true;
diff --git a/core/java/com/android/internal/os/BaseCommand.java b/core/java/com/android/internal/os/BaseCommand.java
index 278f40660ee9..5ba662913529 100644
--- a/core/java/com/android/internal/os/BaseCommand.java
+++ b/core/java/com/android/internal/os/BaseCommand.java
@@ -40,6 +40,10 @@ public abstract class BaseCommand {
private String[] mRawArgs;
+ @UnsupportedAppUsage
+ public BaseCommand() {
+ }
+
/**
* Call to run the command.
*/
diff --git a/core/java/com/android/internal/os/BatterySipper.java b/core/java/com/android/internal/os/BatterySipper.java
index 02c9542fa40d..b1fc369835c6 100644
--- a/core/java/com/android/internal/os/BatterySipper.java
+++ b/core/java/com/android/internal/os/BatterySipper.java
@@ -134,6 +134,8 @@ public class BatterySipper implements Comparable<BatterySipper> {
// This list must be kept current with atoms.proto (frameworks/base/cmds/statsd/src/atoms.proto)
// so the ordinal values (and therefore the order) must never change.
// ****************
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/os/BatterySipper$DrainType;")
public enum DrainType {
AMBIENT_DISPLAY,
@UnsupportedAppUsage
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 46e041b3f33e..3d91c37272ad 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -114,6 +114,13 @@ public final class Zygote {
*/
public static final int DEBUG_IGNORE_APP_SIGNAL_HANDLER = 1 << 17;
+ /**
+ * Disable runtime access to {@link android.annotation.TestApi} annotated members.
+ *
+ * <p>This only takes effect if Hidden API access restrictions are enabled as well.
+ */
+ public static final int DISABLE_TEST_API_ENFORCEMENT_POLICY = 1 << 18;
+
/** No external storage should be mounted. */
public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE;
/** Default external storage should be mounted. */
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 72d24645a2e7..ad4c6dd7a92b 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -248,6 +248,18 @@ public class ZygoteInit {
InputStream is;
try {
+ // If we are profiling the boot image, avoid preloading classes.
+ // Can't use device_config since we are the zygote.
+ String prop = SystemProperties.get(
+ "persist.device_config.runtime_native_boot.profilebootclasspath", "");
+ // Might be empty if the property is unset since the default is "".
+ if (prop.length() == 0) {
+ prop = SystemProperties.get("dalvik.vm.profilebootclasspath", "");
+ }
+ if ("true".equals(prop)) {
+ return;
+ }
+
is = new FileInputStream(PRELOADED_CLASSES);
} catch (FileNotFoundException e) {
Log.e(TAG, "Couldn't find " + PRELOADED_CLASSES + ".");
diff --git a/core/java/com/android/internal/preference/YesNoPreference.java b/core/java/com/android/internal/preference/YesNoPreference.java
index 7abf416bf0af..94ef619f286a 100644
--- a/core/java/com/android/internal/preference/YesNoPreference.java
+++ b/core/java/com/android/internal/preference/YesNoPreference.java
@@ -23,6 +23,8 @@ import android.os.Parcelable;
import android.preference.DialogPreference;
import android.util.AttributeSet;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* The {@link YesNoPreference} is a preference to show a dialog with Yes and No
* buttons.
@@ -40,6 +42,7 @@ public class YesNoPreference extends DialogPreference {
this(context, attrs, defStyleAttr, 0);
}
+ @UnsupportedAppUsage
public YesNoPreference(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.yesNoPreferenceStyle);
}
diff --git a/core/java/com/android/internal/util/MemInfoReader.java b/core/java/com/android/internal/util/MemInfoReader.java
index 630916ebeecb..c1d129b66e7a 100644
--- a/core/java/com/android/internal/util/MemInfoReader.java
+++ b/core/java/com/android/internal/util/MemInfoReader.java
@@ -24,6 +24,10 @@ public final class MemInfoReader {
final long[] mInfos = new long[Debug.MEMINFO_COUNT];
@UnsupportedAppUsage
+ public MemInfoReader() {
+ }
+
+ @UnsupportedAppUsage
public void readMemInfo() {
// Permit disk reads here, as /proc/meminfo isn't really "on
// disk" and should be fast. TODO: make BlockGuard ignore
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index f9cdf3d0be61..f5a9fde97159 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -16,9 +16,11 @@
package com.android.internal.view;
+import android.annotation.UnsupportedAppUsage;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.input.InputManager;
+import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -37,6 +39,10 @@ public class BaseIWindow extends IWindow.Stub {
private IWindowSession mSession;
public int mSeq;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public BaseIWindow() {
+ }
+
public void setSession(IWindowSession session) {
mSession = session;
}
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
index d48034b66266..1f5b0701d2a7 100644
--- a/core/java/com/android/internal/widget/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -91,6 +91,10 @@ public class PointerLocationView extends View implements InputDeviceListener,
private VelocityTracker.Estimator mEstimator = new VelocityTracker.Estimator();
private VelocityTracker.Estimator mAltEstimator = new VelocityTracker.Estimator();
+ @UnsupportedAppUsage
+ public PointerState() {
+ }
+
public void clearTrace() {
mTraceCount = 0;
}
diff --git a/core/java/com/android/server/net/BaseNetworkObserver.java b/core/java/com/android/server/net/BaseNetworkObserver.java
index a0740eee5df6..e1a10a5805f5 100644
--- a/core/java/com/android/server/net/BaseNetworkObserver.java
+++ b/core/java/com/android/server/net/BaseNetworkObserver.java
@@ -28,6 +28,11 @@ import android.net.RouteInfo;
* @hide
*/
public class BaseNetworkObserver extends INetworkManagementEventObserver.Stub {
+
+ @UnsupportedAppUsage
+ public BaseNetworkObserver() {
+ }
+
@Override
public void interfaceStatusChanged(String iface, boolean up) {
// default no-op
diff --git a/core/java/com/google/android/util/AbstractMessageParser.java b/core/java/com/google/android/util/AbstractMessageParser.java
index 9d12f82aeb75..00fcb16f6d3a 100644
--- a/core/java/com/google/android/util/AbstractMessageParser.java
+++ b/core/java/com/google/android/util/AbstractMessageParser.java
@@ -17,13 +17,14 @@
package com.google.android.util;
import android.annotation.UnsupportedAppUsage;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.Set;
-import java.util.List;
/**
*
@@ -653,8 +654,9 @@ public abstract class AbstractMessageParser {
/** Represents a unit of parsed output. */
public static abstract class Token {
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/google/android/util/AbstractMessageParser$Token$Type;")
public enum Type {
-
@UnsupportedAppUsage
HTML ("html"),
@UnsupportedAppUsage
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index bb5780558bdf..3704ccdfb8ea 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -59,6 +59,10 @@ FileDescriptorWhitelist* FileDescriptorWhitelist::Get() {
return instance_;
}
+static bool IsArtMemfd(const std::string& path) {
+ return android::base::StartsWith(path, "/memfd:/boot-image-methods.art");
+}
+
bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
// Check the static whitelist path.
for (const auto& whitelist_path : kPathWhitelist) {
@@ -87,6 +91,11 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
return true;
}
+ // the in-memory file created by ART through memfd_create is allowed.
+ if (IsArtMemfd(path)) {
+ return true;
+ }
+
// Whitelist files needed for Runtime Resource Overlay, like these:
// /system/vendor/overlay/framework-res.apk
// /system/vendor/overlay-subdir/pg/framework-res.apk
@@ -312,6 +321,11 @@ void FileDescriptorInfo::ReopenOrDetach(fail_fn_t fail_fn) const {
return DetachSocket(fail_fn);
}
+ // Children can directly use the in-memory file created by ART through memfd_create.
+ if (IsArtMemfd(file_path)) {
+ return;
+ }
+
// NOTE: This might happen if the file was unlinked after being opened.
// It's a common pattern in the case of temporary files and the like but
// we should not allow such usage from the zygote.
@@ -531,6 +545,10 @@ FileDescriptorTable::FileDescriptorTable(
}
void FileDescriptorTable::RestatInternal(std::set<int>& open_fds, fail_fn_t fail_fn) {
+ // ART creates a file through memfd for optimization purposes. We make sure
+ // there is at most one being created.
+ bool art_memfd_seen = false;
+
// Iterate through the list of file descriptors we've already recorded
// and check whether :
//
@@ -563,6 +581,14 @@ void FileDescriptorTable::RestatInternal(std::set<int>& open_fds, fail_fn_t fail
// FD.
}
+ if (IsArtMemfd(it->second->file_path)) {
+ if (art_memfd_seen) {
+ fail_fn("ART fd already seen: " + it->second->file_path);
+ } else {
+ art_memfd_seen = true;
+ }
+ }
+
++it;
// Finally, remove the FD from the set of open_fds. We do this last because
diff --git a/core/proto/OWNERS b/core/proto/OWNERS
index 6ab0fc91d744..74ced8921799 100644
--- a/core/proto/OWNERS
+++ b/core/proto/OWNERS
@@ -3,8 +3,10 @@
# Metrics
joeo@google.com
singhtejinder@google.com
+yanmin@google.com
yaochen@google.com
yro@google.com
+zhouwenjie@google.com
# Settings UI
per-file settings_enums.proto=tmfang@google.com
diff --git a/core/proto/android/app/settings_enums.proto b/core/proto/android/app/settings_enums.proto
index f817c9bec3f5..0ccef6ea17c8 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -2406,4 +2406,9 @@ enum PageId {
// CATEGORY: SETTINGS
// OS: Q
SETTINGS_AWARE_DISPLAY = 1750;
+
+ // OPEN: Settings > System > Input & Gesture > tap gesture
+ // CATEGORY: SETTINGS
+ // OS: Q
+ SETTINGS_GESTURE_TAP = 1751;
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 9aacbe65e480..1f20d7afb983 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -497,6 +497,7 @@
<protected-broadcast android:name="android.telephony.action.CARRIER_CONFIG_CHANGED" />
<protected-broadcast android:name="android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED" />
<protected-broadcast android:name="android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
+ <protected-broadcast android:name="android.telephony.action.OTA_EMERGENCY_NUMBER_DB_INSTALLED" />
<protected-broadcast android:name="android.telephony.action.SECRET_CODE" />
<protected-broadcast android:name="android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION" />
<protected-broadcast android:name="android.telephony.action.SUBSCRIPTION_PLANS_CHANGED" />
diff --git a/core/res/res/values-mcc208-mnc10-fr/strings.xml b/core/res/res/values-mcc208-mnc10-fr/strings.xml
new file mode 100644
index 000000000000..a1a2c8f4887f
--- /dev/null
+++ b/core/res/res/values-mcc208-mnc10-fr/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="wifi_calling_off_summary" msgid="8720659586041656098">Utiliser les appels Wi-Fi lorsque le service est disponible</string>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ea62c980ca17..7dc0788d0f3e 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -448,7 +448,7 @@
</string-array>
<!-- Package name for the default CellBroadcastService module [DO NOT TRANSLATE] -->
- <string name="cellbroadcast_default_package" translatable="false">com.android.cellbroadcastreceiver
+ <string name="cellbroadcast_default_package" translatable="false">com.android.cellbroadcastservice
</string>
<!-- If the mobile hotspot feature requires provisioning, a package name and class name
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 55271258c882..cbeca16758f6 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4858,10 +4858,10 @@
<string name="confirm_battery_saver">OK</string>
<!-- [CHAR_LIMIT=NONE] Battery saver: Feature description, with a "learn more" link. -->
- <string name="battery_saver_description_with_learn_more">Battery Saver turns off or restricts background activity, some visual effects \u0026 other high-power features to extend battery life. <annotation id="url">Learn More</annotation></string>
+ <string name="battery_saver_description_with_learn_more">To extend battery life, Battery Saver:\n&#183;Turns on Dark theme\n&#183;Turns off or restricts background activity, some visual effects, and other features like \u201cHey Google\u201d\n\n<annotation id="url">Learn more</annotation></string>
<!-- [CHAR_LIMIT=NONE] Battery saver: Feature description, without a "learn more" link. -->
- <string name="battery_saver_description">Battery Saver turns off or restricts background activity, some visual effects \u0026 other high-power features to extend battery life.</string>
+ <string name="battery_saver_description">To extend battery life, Battery Saver:\n&#183;Turns on Dark theme\n&#183;Turns off or restricts background activity, some visual effects, and other features like \u201cHey Google\u201d</string>
<!-- [CHAR_LIMIT=NONE] Data saver: Feature description -->
<string name="data_saver_description">To help reduce data usage, Data Saver prevents some apps from sending or receiving data in the background. An app you’re currently using can access data, but may do so less frequently. This may mean, for example, that images don’t display until you tap them.</string>
diff --git a/core/tests/coretests/src/android/content/pm/PackageParserTest.java b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
index 58c43ac2cf91..5e41355601e4 100644
--- a/core/tests/coretests/src/android/content/pm/PackageParserTest.java
+++ b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
@@ -508,7 +508,12 @@ public class PackageParserTest {
apexInfo.modulePath = apexFile.getPath();
apexInfo.versionCode = 191000070;
int flags = PackageManager.GET_META_DATA | PackageManager.GET_SIGNING_CERTIFICATES;
- PackageInfo pi = PackageParser.generatePackageInfoFromApex(apexInfo, flags);
+
+ PackageParser pp = new PackageParser();
+ Package p = pp.parsePackage(apexFile, flags, false);
+ PackageParser.collectCertificates(p, false);
+ PackageInfo pi = PackageParser.generatePackageInfo(p, apexInfo, flags);
+
assertEquals("com.google.android.tzdata", pi.applicationInfo.packageName);
assertTrue(pi.applicationInfo.enabled);
assertEquals(28, pi.applicationInfo.targetSdkVersion);
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index bdb58f63d044..b7b02a3d61f1 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -731,6 +731,7 @@ public class SettingsBackupTest {
Settings.Secure.SILENCE_GESTURE,
Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE,
Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
+ Settings.Secure.TAP_GESTURE,
Settings.Secure.FACE_UNLOCK_RE_ENROLL);
@Test