Merge "Make isAccessibilityButtonSupported public" into oc-mr1-dev
diff --git a/api/current.txt b/api/current.txt
index 8a68060..24ab586 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4214,12 +4214,6 @@
public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 {
ctor public Application();
- method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent);
- method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String);
- method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String);
- method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String);
- method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent);
- method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent);
method public void onConfigurationChanged(android.content.res.Configuration);
method public void onCreate();
method public void onLowMemory();
@@ -26033,8 +26027,8 @@
method public boolean protect(java.net.Socket);
method public boolean protect(java.net.DatagramSocket);
method public boolean setUnderlyingNetworks(android.net.Network[]);
- field public static final java.lang.String METADATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
field public static final java.lang.String SERVICE_INTERFACE = "android.net.VpnService";
+ field public static final java.lang.String SERVICE_META_DATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
}
public class VpnService.Builder {
@@ -38883,7 +38877,7 @@
public static final class Call.RttCall {
method public int getRttAudioMode();
- method public java.lang.String read() throws java.io.IOException;
+ method public java.lang.String read();
method public java.lang.String readImmediately() throws java.io.IOException;
method public void setRttMode(int);
method public void write(java.lang.String) throws java.io.IOException;
diff --git a/api/system-current.txt b/api/system-current.txt
index 5326437..9963268 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4378,12 +4378,6 @@
public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 {
ctor public Application();
- method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent);
- method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String);
- method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String);
- method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String);
- method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent);
- method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent);
method public void onConfigurationChanged(android.content.res.Configuration);
method public void onCreate();
method public void onLowMemory();
@@ -28331,8 +28325,8 @@
method public boolean protect(java.net.Socket);
method public boolean protect(java.net.DatagramSocket);
method public boolean setUnderlyingNetworks(android.net.Network[]);
- field public static final java.lang.String METADATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
field public static final java.lang.String SERVICE_INTERFACE = "android.net.VpnService";
+ field public static final java.lang.String SERVICE_META_DATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
}
public class VpnService.Builder {
@@ -42128,7 +42122,7 @@
public static final class Call.RttCall {
method public int getRttAudioMode();
- method public java.lang.String read() throws java.io.IOException;
+ method public java.lang.String read();
method public java.lang.String readImmediately() throws java.io.IOException;
method public void setRttMode(int);
method public void write(java.lang.String) throws java.io.IOException;
diff --git a/api/test-current.txt b/api/test-current.txt
index 8178520..343228a 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -4227,12 +4227,6 @@
public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 {
ctor public Application();
- method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent);
- method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String);
- method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String);
- method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String);
- method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent);
- method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent);
method public void onConfigurationChanged(android.content.res.Configuration);
method public void onCreate();
method public void onLowMemory();
@@ -26177,8 +26171,8 @@
method public boolean protect(java.net.Socket);
method public boolean protect(java.net.DatagramSocket);
method public boolean setUnderlyingNetworks(android.net.Network[]);
- field public static final java.lang.String METADATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
field public static final java.lang.String SERVICE_INTERFACE = "android.net.VpnService";
+ field public static final java.lang.String SERVICE_META_DATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
}
public class VpnService.Builder {
@@ -39126,7 +39120,7 @@
public static final class Call.RttCall {
method public int getRttAudioMode();
- method public java.lang.String read() throws java.io.IOException;
+ method public java.lang.String read();
method public java.lang.String readImmediately() throws java.io.IOException;
method public void setRttMode(int);
method public void write(java.lang.String) throws java.io.IOException;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 43693e1..2e4ce18 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -2666,14 +2666,8 @@
Activity activity = null;
try {
java.lang.ClassLoader cl = appContext.getClassLoader();
- if (appContext.getApplicationContext() instanceof Application) {
- activity = ((Application) appContext.getApplicationContext())
- .instantiateActivity(cl, component.getClassName(), r.intent);
- }
- if (activity == null) {
- activity = mInstrumentation.newActivity(
- cl, component.getClassName(), r.intent);
- }
+ activity = mInstrumentation.newActivity(
+ cl, component.getClassName(), r.intent);
StrictMode.incrementExpectedActivityCount(activity.getClass());
r.intent.setExtrasClassLoader(cl);
r.intent.prepareToEnterProcess();
@@ -3169,8 +3163,7 @@
data.intent.setExtrasClassLoader(cl);
data.intent.prepareToEnterProcess();
data.setExtrasClassLoader(cl);
- receiver = instantiate(cl, component, data.intent, app,
- Application::instantiateReceiver);
+ receiver = (BroadcastReceiver)cl.loadClass(component).newInstance();
} catch (Exception e) {
if (DEBUG_BROADCAST) Slog.i(TAG,
"Finishing failed broadcast to " + data.intent.getComponent());
@@ -3258,13 +3251,12 @@
} else {
try {
if (DEBUG_BACKUP) Slog.v(TAG, "Initializing agent class " + classname);
- ContextImpl context = ContextImpl.createAppContext(this, packageInfo);
java.lang.ClassLoader cl = packageInfo.getClassLoader();
- agent = instantiate(cl, classname, context,
- Application::instantiateBackupAgent);
+ agent = (BackupAgent) cl.loadClass(classname).newInstance();
// set up the agent's context
+ ContextImpl context = ContextImpl.createAppContext(this, packageInfo);
context.setOuterContext(agent);
agent.attach(context);
@@ -3324,12 +3316,9 @@
LoadedApk packageInfo = getPackageInfoNoCheck(
data.info.applicationInfo, data.compatInfo);
Service service = null;
- Application app = null;
try {
- app = packageInfo.makeApplication(false, mInstrumentation);
java.lang.ClassLoader cl = packageInfo.getClassLoader();
- service = instantiate(cl, data.info.name, data.intent, app,
- Application::instantiateService);
+ service = (Service) cl.loadClass(data.info.name).newInstance();
} catch (Exception e) {
if (!mInstrumentation.onException(service, e)) {
throw new RuntimeException(
@@ -3344,6 +3333,7 @@
ContextImpl context = ContextImpl.createAppContext(this, packageInfo);
context.setOuterContext(service);
+ Application app = packageInfo.makeApplication(false, mInstrumentation);
service.attach(context, this, data.info.name, data.token, app,
ActivityManager.getService());
service.onCreate();
@@ -5682,8 +5672,8 @@
try {
final ClassLoader cl = instrContext.getClassLoader();
- mInstrumentation = instantiate(cl, data.instrumentationName.getClassName(),
- instrContext, Application::instantiateInstrumentation);
+ mInstrumentation = (Instrumentation)
+ cl.loadClass(data.instrumentationName.getClassName()).newInstance();
} catch (Exception e) {
throw new RuntimeException(
"Unable to instantiate instrumentation "
@@ -6234,8 +6224,8 @@
try {
final java.lang.ClassLoader cl = c.getClassLoader();
- localProvider = instantiate(cl, info.name, context,
- Application::instantiateProvider);
+ localProvider = (ContentProvider)cl.
+ loadClass(info.name).newInstance();
provider = localProvider.getIContentProvider();
if (provider == null) {
Slog.e(TAG, "Failed to instantiate class " +
@@ -6434,49 +6424,6 @@
}
}
- private <T> T instantiate(ClassLoader cl, String className, Context c,
- Instantiator<T> instantiator)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException {
- Application app = getApp(c);
- if (app != null) {
- T a = instantiator.instantiate(app, cl, className);
- if (a != null) return a;
- }
- return (T) cl.loadClass(className).newInstance();
- }
-
- private <T> T instantiate(ClassLoader cl, String className, Intent intent, Context c,
- IntentInstantiator<T> instantiator)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException {
- Application app = getApp(c);
- if (app != null) {
- T a = instantiator.instantiate(app, cl, className, intent);
- if (a != null) return a;
- }
- return (T) cl.loadClass(className).newInstance();
- }
-
- private Application getApp(Context c) {
- // We need this shortcut to avoid actually calling getApplicationContext() on an Application
- // because the Application may not return itself for getApplicationContext() because the
- // API doesn't enforce it.
- if (c instanceof Application) return (Application) c;
- if (c.getApplicationContext() instanceof Application) {
- return (Application) c.getApplicationContext();
- }
- return null;
- }
-
- private interface Instantiator<T> {
- T instantiate(Application app, ClassLoader cl, String className)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException;
- }
-
- private interface IntentInstantiator<T> {
- T instantiate(Application app, ClassLoader cl, String className, Intent intent)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException;
- }
-
private static class EventLoggingReporter implements EventLogger.Reporter {
@Override
public void report (int code, Object... list) {
diff --git a/core/java/android/app/Application.java b/core/java/android/app/Application.java
index cc23ec9..156df36 100644
--- a/core/java/android/app/Application.java
+++ b/core/java/android/app/Application.java
@@ -16,20 +16,17 @@
package android.app;
+import java.util.ArrayList;
+
import android.annotation.CallSuper;
-import android.app.backup.BackupAgent;
-import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
import android.content.ComponentCallbacks2;
-import android.content.ContentProvider;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
-import java.util.ArrayList;
-
/**
* Base class for maintaining global application state. You can provide your own
* implementation by creating a subclass and specifying the fully-qualified name
@@ -292,73 +289,4 @@
}
}
}
-
- /**
- * Allows application to override the creation of activities. This can be used to
- * perform things such as dependency injection or class loader changes to these
- * classes. Return null to use the default creation flow.
- * @param cl The default classloader to use for instantiation.
- * @param className The class to be instantiated.
- * @param intent Intent creating the class.
- */
- public Activity instantiateActivity(ClassLoader cl, String className, Intent intent) {
- return null;
- }
-
- /**
- * Allows application to override the creation of receivers. This can be used to
- * perform things such as dependency injection or class loader changes to these
- * classes. Return null to use the default creation flow.
- * @param cl The default classloader to use for instantiation.
- * @param className The class to be instantiated.
- * @param intent Intent creating the class.
- */
- public BroadcastReceiver instantiateReceiver(ClassLoader cl, String className, Intent intent) {
- return null;
- }
-
- /**
- * Allows application to override the creation of services. This can be used to
- * perform things such as dependency injection or class loader changes to these
- * classes. Return null to use the default creation flow.
- * @param cl The default classloader to use for instantiation.
- * @param className The class to be instantiated.
- * @param intent Intent creating the class.
- */
- public Service instantiateService(ClassLoader cl, String className, Intent intent) {
- return null;
- }
-
- /**
- * Allows application to override the creation of providers. This can be used to
- * perform things such as dependency injection or class loader changes to these
- * classes. Return null to use the default creation flow.
- * @param cl The default classloader to use for instantiation.
- * @param className The class to be instantiated.
- */
- public ContentProvider instantiateProvider(ClassLoader cl, String className) {
- return null;
- }
-
- /**
- * Allows application to override the creation of backup agents. This can be used to
- * perform things such as dependency injection or class loader changes to these
- * classes. Return null to use the default creation flow.
- * @param cl The default classloader to use for instantiation.
- * @param className The class to be instantiated.
- */
- public BackupAgent instantiateBackupAgent(ClassLoader cl, String className) {
- return null;
- }
-
- /**
- * Allows application to override the creation of instrumentation. This can be used to
- * perform things such as dependency injection or class loader changes to these
- * classes. Return null to use the default creation flow.
- * @param cl The default classloader to use for instantiation.
- * @param className The class to be instantiated.
- */
- public Instrumentation instantiateInstrumentation(ClassLoader cl, String className) {
- return null;
- }
}
\ No newline at end of file
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index dea1dbe..586f13f 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -1164,7 +1164,8 @@
* Constant for {@link Builder#setGroupAlertBehavior(int)}, meaning that all children
* notification in a group should be silenced (no sound or vibration) even if they are posted
* to a {@link NotificationChannel} that has sound and/or vibration. Use this constant to
- * mute this notification if this notification is a group child.
+ * mute this notification if this notification is a group child. This must be applied to all
+ * children notifications you want to mute.
*
* <p> For example, you might want to use this constant if you post a number of children
* notifications at once (say, after a periodic sync), and only need to notify the user
@@ -1179,7 +1180,8 @@
* to mute this notification if this notification is a group summary.
*
* <p>For example, you might want to use this constant if only the children notifications
- * in your group have content and the summary is only used to visually group notifications.
+ * in your group have content and the summary is only used to visually group notifications
+ * rather than to alert the user that new information is available.
*/
public static final int GROUP_ALERT_CHILDREN = 2;
@@ -2914,7 +2916,9 @@
* Sets the group alert behavior for this notification. Use this method to mute this
* notification if alerts for this notification's group should be handled by a different
* notification. This is only applicable for notifications that belong to a
- * {@link #setGroup(String) group}.
+ * {@link #setGroup(String) group}. This must be called on all notifications you want to
+ * mute. For example, if you want only the summary of your group to make noise, all
+ * children in the group should have the group alert behavior {@link #GROUP_ALERT_SUMMARY}.
*
* <p> The default value is {@link #GROUP_ALERT_ALL}.</p>
*/
diff --git a/core/java/android/app/NotificationChannelGroup.java b/core/java/android/app/NotificationChannelGroup.java
index 7e8f191a..18ad9cf 100644
--- a/core/java/android/app/NotificationChannelGroup.java
+++ b/core/java/android/app/NotificationChannelGroup.java
@@ -15,24 +15,18 @@
*/
package android.app;
-import android.annotation.StringRes;
import android.annotation.SystemApi;
import android.content.Intent;
-import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
-import android.service.notification.NotificationListenerService;
import android.text.TextUtils;
-import android.util.Slog;
import org.json.JSONException;
import org.json.JSONObject;
-import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -115,10 +109,8 @@
return mName;
}
- /*
+ /**
* Returns the list of channels that belong to this group
- *
- * @hide
*/
public List<NotificationChannel> getChannels() {
return mChannels;
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 32a64b0..56123a7 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -3939,7 +3939,7 @@
* {@link android.Manifest.permission#BIND_VPN_SERVICE};</li>
* <li>target {@link android.os.Build.VERSION_CODES#N API 24} or above; and</li>
* <li><i>not</i> explicitly opt out of the feature through
- * {@link android.net.VpnService#METADATA_SUPPORTS_ALWAYS_ON}.</li>
+ * {@link android.net.VpnService#SERVICE_META_DATA_SUPPORTS_ALWAYS_ON}.</li>
* </ul>
* The call will fail if called with the package name of an unsupported VPN app.
*
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 48123fe..744ee8e 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -840,8 +840,8 @@
* In order to support the always-on feature, an app has to
* <ul>
* <li>target {@link VERSION_CODES#N API 24} or above, and
- * <li>not opt out through the {@link VpnService#METADATA_SUPPORTS_ALWAYS_ON} meta-data
- * field.
+ * <li>not opt out through the {@link VpnService#SERVICE_META_DATA_SUPPORTS_ALWAYS_ON}
+ * meta-data field.
* </ul>
*
* @param userId The identifier of the user for whom the VPN app is installed.
diff --git a/core/java/android/net/IpPrefix.java b/core/java/android/net/IpPrefix.java
index 6b4f2d5..6e2654e 100644
--- a/core/java/android/net/IpPrefix.java
+++ b/core/java/android/net/IpPrefix.java
@@ -20,6 +20,8 @@
import android.os.Parcelable;
import android.util.Pair;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -185,6 +187,20 @@
}
/**
+ * @hide
+ */
+ public boolean isIPv6() {
+ return getAddress() instanceof Inet6Address;
+ }
+
+ /**
+ * @hide
+ */
+ public boolean isIPv4() {
+ return getAddress() instanceof Inet4Address;
+ }
+
+ /**
* Returns a string representation of this {@code IpPrefix}.
*
* @return a string such as {@code "192.0.2.0/24"} or {@code "2001:db8:1:2::/64"}.
diff --git a/core/java/android/net/LinkAddress.java b/core/java/android/net/LinkAddress.java
index 62de991..bcfe938 100644
--- a/core/java/android/net/LinkAddress.java
+++ b/core/java/android/net/LinkAddress.java
@@ -76,7 +76,7 @@
* RFC 6724 section 3.2.
* @hide
*/
- static int scopeForUnicastAddress(InetAddress addr) {
+ private static int scopeForUnicastAddress(InetAddress addr) {
if (addr.isAnyLocalAddress()) {
return RT_SCOPE_HOST;
}
@@ -101,7 +101,7 @@
* Per RFC 4193 section 8, fc00::/7 identifies these addresses.
*/
private boolean isIPv6ULA() {
- if (address instanceof Inet6Address) {
+ if (isIPv6()) {
byte[] bytes = address.getAddress();
return ((bytes[0] & (byte)0xfe) == (byte)0xfc);
}
@@ -109,13 +109,29 @@
}
/**
+ * @return true if the address is IPv6.
+ * @hide
+ */
+ public boolean isIPv6() {
+ return address instanceof Inet6Address;
+ }
+
+ /**
+ * @return true if the address is IPv4 or is a mapped IPv4 address.
+ * @hide
+ */
+ public boolean isIPv4() {
+ return address instanceof Inet4Address;
+ }
+
+ /**
* Utility function for the constructors.
*/
private void init(InetAddress address, int prefixLength, int flags, int scope) {
if (address == null ||
address.isMulticastAddress() ||
prefixLength < 0 ||
- ((address instanceof Inet4Address) && prefixLength > 32) ||
+ (address instanceof Inet4Address && prefixLength > 32) ||
(prefixLength > 128)) {
throw new IllegalArgumentException("Bad LinkAddress params " + address +
"/" + prefixLength);
@@ -184,6 +200,7 @@
*/
public LinkAddress(String address, int flags, int scope) {
// This may throw an IllegalArgumentException; catching it is the caller's responsibility.
+ // TODO: consider rejecting mapped IPv4 addresses such as "::ffff:192.0.2.5/24".
Pair<InetAddress, Integer> ipAndMask = NetworkUtils.parseIpAndMask(address);
init(ipAndMask.first, ipAndMask.second, flags, scope);
}
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java
index 7fb0c47..185b181 100644
--- a/core/java/android/net/VpnService.java
+++ b/core/java/android/net/VpnService.java
@@ -152,9 +152,10 @@
* </service>
* } </pre>
*
- * <p>This meta-data field defaults to {@code true} if absent.
+ * <p>This meta-data field defaults to {@code true} if absent. It will only have effect on
+ * {@link android.os.Build.VERSION_CODES#O_MR1} or higher.
*/
- public static final String METADATA_SUPPORTS_ALWAYS_ON =
+ public static final String SERVICE_META_DATA_SUPPORTS_ALWAYS_ON =
"android.net.VpnService.SUPPORTS_ALWAYS_ON";
/**
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index b916b43..e6e1da4 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -220,6 +220,21 @@
void unregisterTetheringStatsProvider(ITetheringStatsProvider provider);
/**
+ * Reports that a tethering provider has reached a data limit.
+ *
+ * Currently triggers a global alert, which causes NetworkStatsService to poll counters and
+ * re-evaluate data usage.
+ *
+ * This does not take an interface name because:
+ * 1. The tethering offload stats provider cannot reliably determine the interface on which the
+ * limit was reached, because the HAL does not provide it.
+ * 2. Firing an interface-specific alert instead of a global alert isn't really useful since in
+ * all cases of interest, the system responds to both in the same way - it polls stats, and
+ * then notifies NetworkPolicyManagerService of the fact.
+ */
+ void tetherLimitReached(ITetheringStatsProvider provider);
+
+ /**
** PPPD
**/
diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java
index ca39854..50cd7b1 100644
--- a/core/java/android/util/Patterns.java
+++ b/core/java/android/util/Patterns.java
@@ -406,7 +406,7 @@
* the local part to be at most 64 octets.
*/
private static final String EMAIL_ADDRESS_LOCAL_PART =
- "[" + EMAIL_CHAR + "]" + "(?:[" + EMAIL_CHAR + "\\.]{1,62}[" + EMAIL_CHAR + "])?";
+ "[" + EMAIL_CHAR + "]" + "(?:[" + EMAIL_CHAR + "\\.]{0,62}[" + EMAIL_CHAR + "])?";
/**
* Regular expression for the domain part of an email address. RFC5321 section 4.5.3.1.2 limits
diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java
index d327180..d64c9a1 100644
--- a/core/java/com/android/internal/notification/SystemNotificationChannels.java
+++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java
@@ -132,10 +132,12 @@
context.getString(R.string.notification_channel_usb),
NotificationManager.IMPORTANCE_MIN));
- channelsList.add(new NotificationChannel(
+ NotificationChannel foregroundChannel = new NotificationChannel(
FOREGROUND_SERVICE,
context.getString(R.string.notification_channel_foreground_service),
- NotificationManager.IMPORTANCE_LOW));
+ NotificationManager.IMPORTANCE_LOW);
+ foregroundChannel.setBlockableSystem(true);
+ channelsList.add(foregroundChannel);
nm.createNotificationChannels(channelsList);
}
diff --git a/core/res/res/values-mcc310-mnc030/strings.xml b/core/res/res/values-mcc310-mnc030/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc030/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc170 b/core/res/res/values-mcc310-mnc170
deleted file mode 120000
index cfced17..0000000
--- a/core/res/res/values-mcc310-mnc170
+++ /dev/null
@@ -1 +0,0 @@
-./values-mcc310-mnc150
\ No newline at end of file
diff --git a/core/res/res/values-mcc310-mnc170/strings.xml b/core/res/res/values-mcc310-mnc170/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc170/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc280/strings.xml b/core/res/res/values-mcc310-mnc280/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc280/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc380 b/core/res/res/values-mcc310-mnc380
deleted file mode 120000
index cfced17..0000000
--- a/core/res/res/values-mcc310-mnc380
+++ /dev/null
@@ -1 +0,0 @@
-./values-mcc310-mnc150
\ No newline at end of file
diff --git a/core/res/res/values-mcc310-mnc380/strings.xml b/core/res/res/values-mcc310-mnc380/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc380/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc410/strings.xml b/core/res/res/values-mcc310-mnc410/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc410/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc560/strings.xml b/core/res/res/values-mcc310-mnc560/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc560/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc950/strings.xml b/core/res/res/values-mcc310-mnc950/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc950/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc180/strings.xml b/core/res/res/values-mcc311-mnc180/strings.xml
new file mode 100644
index 0000000..a3fea29
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc180/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 95aa264..ca4b355 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -531,15 +531,18 @@
<!-- Integer parameters of the wifi to cellular handover feature
wifi should not stick to bad networks -->
<integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_5GHz">-82</integer>
+ <integer translatable="false" name="config_wifi_framework_wifi_score_entry_rssi_threshold_5GHz">-82</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_low_rssi_threshold_5GHz">-70</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_good_rssi_threshold_5GHz">-57</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_24GHz">-85</integer>
+ <integer translatable="false" name="config_wifi_framework_wifi_score_entry_rssi_threshold_24GHz">-85</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_low_rssi_threshold_24GHz">-73</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_good_rssi_threshold_24GHz">-60</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_bad_link_speed_24">6</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_bad_link_speed_5">12</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_good_link_speed_24">24</integer>
<integer translatable="false" name="config_wifi_framework_wifi_score_good_link_speed_5">36</integer>
+
<string translatable="false" name="config_wifi_random_mac_oui">DA-A1-19</string>
<string translatable="false" name="config_wifi_framework_sap_2G_channel_list">1,6,11</string>
@@ -626,10 +629,10 @@
<bool name="config_automatic_brightness_available">false</bool>
<!-- Fast brightness animation ramp rate in brightness units per second-->
- <integer translatable="false" name="config_brightness_ramp_rate_fast">200</integer>
+ <integer translatable="false" name="config_brightness_ramp_rate_fast">180</integer>
<!-- Slow brightness animation ramp rate in brightness units per second-->
- <integer translatable="false" name="config_brightness_ramp_rate_slow">40</integer>
+ <integer translatable="false" name="config_brightness_ramp_rate_slow">60</integer>
<!-- Don't name config resources like this. It should look like config_annoyDianne -->
<bool name="config_annoy_dianne">true</bool>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8a5625b..ce6815f 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -593,17 +593,18 @@
<!-- This is the label for the notification channel settings that controls the behavior
of the notification about applications that are running in the background (that is,
perhaps confusingly, running foreground services but not the foreground UI on the screen).
- [CHAR LIMIT=NONE] -->
- <string name="notification_channel_foreground_service">Apps running in background</string>
+ [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=6665375982962336520] -->
+ <string name="notification_channel_foreground_service">Apps consuming battery</string>
- <!-- Label for foreground service notification when one app is running. [CHAR LIMIT=NONE] -->
+ <!-- Label for foreground service notification when one app is running.
+ [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=6826789589341671842] -->
<string name="foreground_service_app_in_background"><xliff:g id="app_name">%1$s</xliff:g> is
- running in the background</string>
+ using battery</string>
<!-- Label for foreground service notification when multiple apps are running.
- [CHAR LIMIT=NONE] -->
+ [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=7150914856893450380] -->
<string name="foreground_service_apps_in_background"><xliff:g id="number">%1$d</xliff:g> apps
- are running in the background</string>
+ are using battery</string>
<!-- Content for foreground service notification when one app is running.
[CHAR LIMIT=NONE] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index af08e24..04cfe48 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -357,9 +357,11 @@
<java-symbol type="integer" name="config_wifi_framework_associated_full_scan_max_total_dwell_time" />
<java-symbol type="integer" name="config_wifi_framework_associated_partial_scan_max_num_active_channels" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_bad_rssi_threshold_24GHz" />
+ <java-symbol type="integer" name="config_wifi_framework_wifi_score_entry_rssi_threshold_24GHz" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_low_rssi_threshold_24GHz" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_good_rssi_threshold_24GHz" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_bad_rssi_threshold_5GHz" />
+ <java-symbol type="integer" name="config_wifi_framework_wifi_score_entry_rssi_threshold_5GHz" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_low_rssi_threshold_5GHz" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_good_rssi_threshold_5GHz" />
<java-symbol type="integer" name="config_wifi_framework_wifi_score_bad_link_speed_24" />
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginActivity.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginActivity.java
deleted file mode 100644
index 925214e..0000000
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginActivity.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package com.android.systemui.plugins;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.Resources;
-import android.os.Bundle;
-
-import com.android.systemui.plugins.annotations.ProvidesInterface;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * A PluginActivity is an activity that replaces another full activity (e.g. RecentsActivity)
- * at runtime within the sysui process.
- */
-@ProvidesInterface(version = PluginActivity.VERSION)
-public abstract class PluginActivity extends Activity implements Plugin {
-
- public static final int VERSION = 1;
-
- public static final String ACTION_RECENTS = "com.android.systemui.action.PLUGIN_RECENTS";
-
- private Context mSysuiContext;
- private boolean mSettingActionBar;
-
- @Override
- public final void onCreate(Context sysuiContext, Context pluginContext) {
- mSysuiContext = sysuiContext;
- super.attachBaseContext(pluginContext);
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Theme theme = getClass().getDeclaredAnnotation(Theme.class);
- if (theme != null && theme.value() != 0) {
- setTheme(theme.value());
- }
- mSettingActionBar = true;
- getActionBar();
- mSettingActionBar = false;
- }
-
- @Override
- public Resources getResources() {
- return mSettingActionBar ? mSysuiContext.getResources() : super.getResources();
- }
-
- @Override
- protected void attachBaseContext(Context newBase) {
- mSysuiContext = newBase;
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- }
-
- public Context getSysuiContext() {
- return mSysuiContext;
- }
-
- public Context getPluginContext() {
- return getBaseContext();
- }
-
- /**
- * Since PluginActivities are declared as services instead of activities (since they
- * are plugins), they can't have a theme attached to them. Instead a PluginActivity
- * can annotate itself with @Theme to specify the resource of the style it wants
- * to be themed with.
- */
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Theme {
- int value();
- }
-}
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginDependency.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginDependency.java
index db2e376..25ce3dd 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginDependency.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginDependency.java
@@ -21,11 +21,6 @@
public static final int VERSION = 1;
static DependencyProvider sProvider;
- /**
- * Allows a plugin to get a hold of static dependencies if they have declared dependence
- * on their interface. For one-shot plugins this will only work during onCreate and will
- * not work afterwards.
- */
public static <T> T get(Plugin p, Class<T> cls) {
return sProvider.get(p, cls);
}
diff --git a/packages/SystemUI/res/layout/car_qs_panel.xml b/packages/SystemUI/res/layout/car_qs_panel.xml
index d1f7ff8..0b46b0b 100644
--- a/packages/SystemUI/res/layout/car_qs_panel.xml
+++ b/packages/SystemUI/res/layout/car_qs_panel.xml
@@ -24,4 +24,11 @@
<include layout="@layout/car_status_bar_header" />
<include layout="@layout/car_qs_footer" />
+
+ <com.android.systemui.statusbar.car.UserGridView
+ android:id="@+id/user_grid"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/car_margin"
+ android:layout_marginRight="@dimen/car_margin" />
</LinearLayout>
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index ecc2111..49253ec 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -34,7 +34,6 @@
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.plugins.ActivityStarter;
-import com.android.systemui.plugins.PluginActivityManager;
import com.android.systemui.plugins.PluginDependencyProvider;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.plugins.PluginManagerImpl;
@@ -295,8 +294,6 @@
mProviders.put(UiOffloadThread.class, UiOffloadThread::new);
- mProviders.put(PluginActivityManager.class,
- () -> new PluginActivityManager(mContext, getDependency(PluginManager.class)));
mProviders.put(PowerUI.WarningsUI.class, () -> new PowerNotificationWarnings(mContext));
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
index 49a076f..9adafda 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -16,7 +16,6 @@
package com.android.systemui;
-import android.app.Activity;
import android.app.ActivityThread;
import android.app.Application;
import android.content.BroadcastReceiver;
@@ -41,7 +40,6 @@
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.plugins.OverlayPlugin;
import com.android.systemui.plugins.Plugin;
-import com.android.systemui.plugins.PluginActivityManager;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.power.PowerUI;
@@ -281,10 +279,4 @@
public SystemUI[] getServices() {
return mServices;
}
-
- @Override
- public Activity instantiateActivity(ClassLoader cl, String className, Intent intent) {
- if (!mServicesStarted) return null;
- return Dependency.get(PluginActivityManager.class).instantiate(cl, className, intent);
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/plugins/PluginActivityManager.java b/packages/SystemUI/src/com/android/systemui/plugins/PluginActivityManager.java
deleted file mode 100644
index 9becc38..0000000
--- a/packages/SystemUI/src/com/android/systemui/plugins/PluginActivityManager.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package com.android.systemui.plugins;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.text.TextUtils;
-import android.util.ArrayMap;
-
-public class PluginActivityManager {
-
- private final Context mContext;
- private final PluginManager mPluginManager;
- private final ArrayMap<String, String> mActionLookup = new ArrayMap<>();
-
- public PluginActivityManager(Context context, PluginManager pluginManager) {
- mContext = context;
- mPluginManager = pluginManager;
- }
-
- public void addActivityPlugin(String className, String action) {
- mActionLookup.put(className, action);
- }
-
- public Activity instantiate(ClassLoader cl, String className, Intent intent) {
- String action = mActionLookup.get(className);
- if (TextUtils.isEmpty(action)) return null;
- return mPluginManager.getOneShotPlugin(action, PluginActivity.class);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/plugins/PluginManagerImpl.java b/packages/SystemUI/src/com/android/systemui/plugins/PluginManagerImpl.java
index a968399..493d244 100644
--- a/packages/SystemUI/src/com/android/systemui/plugins/PluginManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/plugins/PluginManagerImpl.java
@@ -42,6 +42,7 @@
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.systemui.Dependency;
import com.android.systemui.plugins.PluginInstanceManager.PluginContextWrapper;
+import com.android.systemui.plugins.PluginInstanceManager.PluginInfo;
import com.android.systemui.plugins.annotations.ProvidesInterface;
import dalvik.system.PathClassLoader;
@@ -119,21 +120,14 @@
}
PluginInstanceManager<T> p = mFactory.createPluginInstanceManager(mContext, action, null,
false, mLooper, cls, this);
- PluginListener<Plugin> listener = new PluginListener<Plugin>() {
- @Override
- public void onPluginConnected(Plugin plugin, Context pluginContext) { }
- };
- mPluginMap.put(listener, p);
mPluginPrefs.addAction(action);
- PluginInstanceManager.PluginInfo<T> info = p.getPlugin();
+ PluginInfo<T> info = p.getPlugin();
if (info != null) {
mOneShotPackages.add(info.mPackage);
mHasOneShot = true;
startListening();
- mPluginMap.remove(listener);
return info.mPlugin;
}
- mPluginMap.remove(listener);
return null;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
index e574c01..a48bcbd 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
@@ -310,11 +310,47 @@
vpnWarning.setMovementMethod(new LinkMovementMethod());
}
+ // Note: if a new section is added, should update configSubtitleVisibility to include
+ // the handling of the subtitle
+ configSubtitleVisibility(managementMessage != null,
+ caCertsMessage != null,
+ networkLoggingMessage != null,
+ vpnMessage != null,
+ dialogView);
+
mDialog.show();
mDialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
+ protected void configSubtitleVisibility(boolean showDeviceManagement, boolean showCaCerts,
+ boolean showNetworkLogging, boolean showVpn, View dialogView) {
+ // Device Management title should always been shown
+ // When there is a Device Management message, all subtitles should be shown
+ if (showDeviceManagement) {
+ return;
+ }
+ // Hide the subtitle if there is only 1 message shown
+ int mSectionCountExcludingDeviceMgt = 0;
+ if (showCaCerts) { mSectionCountExcludingDeviceMgt++; }
+ if (showNetworkLogging) { mSectionCountExcludingDeviceMgt++; }
+ if (showVpn) { mSectionCountExcludingDeviceMgt++; }
+
+ // No work needed if there is no sections or more than 1 section
+ if (mSectionCountExcludingDeviceMgt != 1) {
+ return;
+ }
+ if (showCaCerts) {
+ dialogView.findViewById(R.id.ca_certs_subtitle).setVisibility(View.GONE);
+ }
+ if (showNetworkLogging) {
+ dialogView.findViewById(R.id.network_logging_subtitle).setVisibility(View.GONE);
+ }
+ if (showVpn) {
+ dialogView.findViewById(R.id.vpn_subtitle).setVisibility(View.GONE);
+ }
+ }
+
private String getSettingsButton() {
return mContext.getString(R.string.monitoring_button_view_policies);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFooter.java b/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFooter.java
index 9730f29..d42b87b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFooter.java
@@ -18,6 +18,7 @@
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
@@ -27,6 +28,7 @@
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.qs.QSFooter;
import com.android.systemui.qs.QSPanel;
+import com.android.systemui.statusbar.car.UserGridView;
import com.android.systemui.statusbar.phone.MultiUserSwitch;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.UserInfoController;
@@ -37,10 +39,13 @@
*/
public class CarQSFooter extends RelativeLayout implements QSFooter,
UserInfoController.OnUserInfoChangedListener {
+ private static final String TAG = "CarQSFooter";
+
private UserInfoController mUserInfoController;
private MultiUserSwitch mMultiUserSwitch;
private ImageView mMultiUserAvatar;
+ private UserGridView mUserGridView;
public CarQSFooter(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -54,6 +59,19 @@
mUserInfoController = Dependency.get(UserInfoController.class);
+ mMultiUserSwitch.setOnClickListener(v -> {
+ if (mUserGridView == null) {
+ Log.e(TAG, "CarQSFooter not properly set up; cannot display user switcher.");
+ return;
+ }
+
+ if (!mUserGridView.isShowing()) {
+ mUserGridView.show();
+ } else {
+ mUserGridView.hide();
+ }
+ });
+
findViewById(R.id.settings_button).setOnClickListener(v -> {
ActivityStarter activityStarter = Dependency.get(ActivityStarter.class);
@@ -80,6 +98,10 @@
}
}
+ public void setUserGridView(UserGridView view) {
+ mUserGridView = view;
+ }
+
@Override
public void setListening(boolean listening) {
if (listening) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFragment.java
index 7c2a812..13298d3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/car/CarQSFragment.java
@@ -22,9 +22,12 @@
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.qs.QSFooter;
+import com.android.systemui.statusbar.car.UserGridView;
+import com.android.systemui.statusbar.policy.UserSwitcherController;
/**
* A quick settings fragment for the car. For auto, there is no row for quick settings or ability
@@ -33,7 +36,8 @@
*/
public class CarQSFragment extends Fragment implements QS {
private View mHeader;
- private QSFooter mFooter;
+ private CarQSFooter mFooter;
+ private UserGridView mUserGridView;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@@ -46,6 +50,12 @@
super.onViewCreated(view, savedInstanceState);
mHeader = view.findViewById(R.id.header);
mFooter = view.findViewById(R.id.qs_footer);
+
+ mUserGridView = view.findViewById(R.id.user_grid);
+ mUserGridView.init(null, Dependency.get(UserSwitcherController.class),
+ false /* showInitially */);
+
+ mFooter.setUserGridView(mUserGridView);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index d10e080..4a8b43e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -43,14 +43,11 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.Dependency;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.SystemUI;
-import com.android.systemui.plugins.PluginActivity;
-import com.android.systemui.plugins.PluginActivityManager;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
@@ -239,8 +236,6 @@
registerWithSystemUser();
}
putComponent(Recents.class, this);
- Dependency.get(PluginActivityManager.class).addActivityPlugin(RecentsImpl.RECENTS_ACTIVITY,
- PluginActivity.ACTION_RECENTS);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
index 6060134..172c62a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
@@ -53,7 +53,7 @@
mParent = containerStub.inflate();
mContainer = mParent.findViewById(R.id.container);
mUserGridView = mContainer.findViewById(R.id.user_grid);
- mUserGridView.init(statusBar, mUserSwitcherController);
+ mUserGridView.init(statusBar, mUserSwitcherController, true /* showInitially */);
mUserGridView.setUserSelectionListener(record -> {
if (!record.isCurrent) {
toggleSwitchInProgress(true);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java
index f178aa6..e551801 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridView.java
@@ -16,20 +16,21 @@
package com.android.systemui.statusbar.car;
+import android.animation.Animator;
+import android.animation.Animator.AnimatorListener;
+import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
-import android.os.UserHandle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
+import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.util.AttributeSet;
-import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -37,9 +38,7 @@
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.android.internal.util.UserIcons;
import com.android.systemui.R;
-import com.android.systemui.statusbar.UserUtil;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.UserSwitcherController;
@@ -48,21 +47,44 @@
* One of the uses of this is for the lock screen in auto.
*/
public class UserGridView extends ViewPager {
+ private static final int EXPAND_ANIMATION_TIME_MS = 200;
+ private static final int HIDE_ANIMATION_TIME_MS = 133;
+
private StatusBar mStatusBar;
private UserSwitcherController mUserSwitcherController;
private Adapter mAdapter;
private UserSelectionListener mUserSelectionListener;
+ private ValueAnimator mHeightAnimator;
+ private int mTargetHeight;
+ private int mHeightChildren;
+ private boolean mShowing;
public UserGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
- public void init(StatusBar statusBar, UserSwitcherController userSwitcherController) {
+ public void init(StatusBar statusBar, UserSwitcherController userSwitcherController,
+ boolean showInitially) {
mStatusBar = statusBar;
mUserSwitcherController = userSwitcherController;
mAdapter = new Adapter(mUserSwitcherController);
addOnLayoutChangeListener(mAdapter);
setAdapter(mAdapter);
+ mShowing = showInitially;
+ }
+
+ public boolean isShowing() {
+ return mShowing;
+ }
+
+ public void show() {
+ mShowing = true;
+ animateHeightChange(getMeasuredHeight(), mHeightChildren);
+ }
+
+ public void hide() {
+ mShowing = false;
+ animateHeightChange(getMeasuredHeight(), 0);
}
public void onUserSwitched(int newUserId) {
@@ -83,16 +105,85 @@
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Wrap content doesn't work in ViewPagers, so simulate the behavior in code.
int height = 0;
- for(int i = 0; i < getChildCount(); i++) {
- View child = getChildAt(i);
- child.measure(widthMeasureSpec,
- MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
- height = Math.max(child.getMeasuredHeight(), height);
+ if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {
+ height = MeasureSpec.getSize(heightMeasureSpec);
+ } else {
+ for (int i = 0; i < getChildCount(); i++) {
+ View child = getChildAt(i);
+ child.measure(widthMeasureSpec,
+ MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
+ height = Math.max(child.getMeasuredHeight(), height);
+ }
+
+ mHeightChildren = height;
+
+ // Override the height if it's not showing.
+ if (!mShowing) {
+ height = 0;
+ }
+
+ // Respect the AT_MOST request from parent.
+ if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) {
+ height = Math.min(MeasureSpec.getSize(heightMeasureSpec), height);
+ }
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
+
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
+ private void animateHeightChange(int oldHeight, int newHeight) {
+ // If there is no change in height or an animation is already in progress towards the
+ // desired height, then there's no need to make any changes.
+ if (oldHeight == newHeight || newHeight == mTargetHeight) {
+ return;
+ }
+
+ // Animation in progress is not going towards the new target, so cancel it.
+ if (mHeightAnimator != null){
+ mHeightAnimator.cancel();
+ }
+
+ mTargetHeight = newHeight;
+ mHeightAnimator = ValueAnimator.ofInt(oldHeight, mTargetHeight);
+ mHeightAnimator.addUpdateListener(valueAnimator -> {
+ ViewGroup.LayoutParams layoutParams = getLayoutParams();
+ layoutParams.height = (Integer) valueAnimator.getAnimatedValue();
+ requestLayout();
+ });
+ mHeightAnimator.addListener(new AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animator) {}
+
+ @Override
+ public void onAnimationEnd(Animator animator) {
+ // ValueAnimator does not guarantee that the update listener will get an update
+ // to the final value, so here, the final value is set. Though the final calculated
+ // height (mTargetHeight) could be set, WRAP_CONTENT is more appropriate.
+ ViewGroup.LayoutParams layoutParams = getLayoutParams();
+ layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ requestLayout();
+ mHeightAnimator = null;
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animator) {}
+
+ @Override
+ public void onAnimationRepeat(Animator animator) {}
+ });
+
+ mHeightAnimator.setInterpolator(new FastOutSlowInInterpolator());
+ if (oldHeight < newHeight) {
+ // Expanding
+ mHeightAnimator.setDuration(EXPAND_ANIMATION_TIME_MS);
+ } else {
+ // Hiding
+ mHeightAnimator.setDuration(HIDE_ANIMATION_TIME_MS);
+ }
+ mHeightAnimator.start();
+ }
+
/**
* This is a ViewPager.PagerAdapter which deletegates the work to a
* UserSwitcherController.BaseUserAdapter. Java doesn't support multiple inheritance so we have
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java
index 844a2c4..3115361 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java
@@ -16,7 +16,10 @@
package com.android.systemui.statusbar.notification;
+import android.content.Context;
import android.graphics.Color;
+import android.os.UserHandle;
+import android.provider.Settings;
import android.view.View;
import android.widget.ImageView;
@@ -57,4 +60,10 @@
offsetView.getLocationOnScreen(sLocationOffset);
return sLocationOffset[1] - sLocationBase[1];
}
+
+ public static boolean isHapticFeedbackDisabled(Context context) {
+ return Settings.System.getIntForUser(context.getContentResolver(),
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) == 0;
+ }
+
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
index c45c05e..f06dd7b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
@@ -54,6 +54,7 @@
private boolean mFullyPulsing;
private float mAodFrontScrimOpacity = 0;
+ private Runnable mSetDozeInFrontAlphaDelayed;
public DozeScrimController(ScrimController scrimController, Context context) {
mContext = context;
@@ -69,8 +70,7 @@
mDozingAborted = false;
abortAnimations();
mScrimController.setDozeBehindAlpha(1f);
- mScrimController.setDozeInFrontAlpha(
- mDozeParameters.getAlwaysOn() ? mAodFrontScrimOpacity : 1f);
+ setDozeInFrontAlpha(mDozeParameters.getAlwaysOn() ? mAodFrontScrimOpacity : 1f);
} else {
cancelPulsing();
if (animate) {
@@ -83,7 +83,7 @@
} else {
abortAnimations();
mScrimController.setDozeBehindAlpha(0f);
- mScrimController.setDozeInFrontAlpha(0f);
+ setDozeInFrontAlpha(0f);
}
}
}
@@ -97,7 +97,7 @@
mAodFrontScrimOpacity = scrimOpacity;
if (mDozing && !isPulsing() && !mDozingAborted && !mWakeAndUnlocking
&& mDozeParameters.getAlwaysOn()) {
- mScrimController.setDozeInFrontAlpha(mAodFrontScrimOpacity);
+ setDozeInFrontAlpha(mAodFrontScrimOpacity);
}
}
@@ -107,7 +107,7 @@
if (!mWakeAndUnlocking) {
mWakeAndUnlocking = true;
mScrimController.setDozeBehindAlpha(0f);
- mScrimController.setDozeInFrontAlpha(0f);
+ setDozeInFrontAlpha(0f);
}
}
@@ -127,7 +127,7 @@
// be invoked when we're done so that the caller can drop the pulse wakelock.
mPulseCallback = callback;
mPulseReason = reason;
- mScrimController.setDozeInFrontAlpha(1f);
+ setDozeInFrontAlpha(1f);
mHandler.post(mPulseIn);
}
@@ -138,9 +138,8 @@
cancelPulsing();
if (mDozing && !mWakeAndUnlocking) {
mScrimController.setDozeBehindAlpha(1f);
- mScrimController.setDozeInFrontAlpha(
- mDozeParameters.getAlwaysOn() && !mDozingAborted ?
- mAodFrontScrimOpacity : 1f);
+ setDozeInFrontAlpha(mDozeParameters.getAlwaysOn() && !mDozingAborted
+ ? mAodFrontScrimOpacity : 1f);
}
}
@@ -295,6 +294,25 @@
: mScrimController.getDozeBehindAlpha();
}
+ private void setDozeInFrontAlpha(float opacity) {
+ setDozeInFrontAlphaDelayed(opacity, 0 /* delay */);
+
+ }
+
+ private void setDozeInFrontAlphaDelayed(float opacity, long delayMs) {
+ if (mSetDozeInFrontAlphaDelayed != null) {
+ mHandler.removeCallbacks(mSetDozeInFrontAlphaDelayed);
+ mSetDozeInFrontAlphaDelayed = null;
+ }
+ if (delayMs < 0) {
+ mScrimController.setDozeInFrontAlpha(opacity);
+ } else {
+ mHandler.postDelayed(mSetDozeInFrontAlphaDelayed = () -> {
+ setDozeInFrontAlpha(opacity);
+ }, delayMs);
+ }
+ }
+
private final Runnable mPulseIn = new Runnable() {
@Override
public void run() {
@@ -364,7 +382,9 @@
// Signal that the pulse is all finished so we can turn the screen off now.
DozeScrimController.this.pulseFinished();
if (mDozeParameters.getAlwaysOn()) {
- mScrimController.setDozeInFrontAlpha(mAodFrontScrimOpacity);
+ // Setting power states can happen after we push out the frame. Make sure we
+ // stay fully opaque until the power state request reaches the lower levels.
+ setDozeInFrontAlphaDelayed(mAodFrontScrimOpacity, 30);
}
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
index e0d9748..88a5626 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
@@ -16,14 +16,19 @@
package com.android.systemui.statusbar.phone;
+import static com.android.systemui.statusbar.notification.NotificationUtils.isHapticFeedbackDisabled;
+
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Icon;
+import android.os.AsyncTask;
+import android.os.UserHandle;
import android.os.VibrationEffect;
import android.os.Vibrator;
+import android.provider.Settings;
import android.support.v4.util.ArrayMap;
import android.support.v4.util.ArraySet;
import android.util.AttributeSet;
@@ -34,6 +39,7 @@
import com.android.systemui.R;
import com.android.systemui.statusbar.AlphaOptimizedFrameLayout;
import com.android.systemui.statusbar.StatusBarIconView;
+import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.stack.AnimationFilter;
import com.android.systemui.statusbar.stack.AnimationProperties;
import com.android.systemui.statusbar.stack.StackStateAnimator;
@@ -623,9 +629,10 @@
boolean wasInShelf = icon.isInShelf();
boolean inShelf = iconAppearAmount == 1.0f;
icon.setIsInShelf(inShelf);
- if (mVibrateOnAnimation && !justAdded && mAnimationsEnabled
- && wasInShelf != inShelf) {
- mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_TICK));
+ if (shouldVibrateChange(wasInShelf != inShelf)) {
+ AsyncTask.execute(
+ () -> mVibrator.vibrate(VibrationEffect.get(
+ VibrationEffect.EFFECT_TICK)));
}
}
justAdded = false;
@@ -634,6 +641,25 @@
justUndarkened = false;
}
+ private boolean shouldVibrateChange(boolean inShelfChanged) {
+ if (!mVibrateOnAnimation) {
+ return false;
+ }
+ if (justAdded) {
+ return false;
+ }
+ if (!mAnimationsEnabled) {
+ return false;
+ }
+ if (!inShelfChanged) {
+ return false;
+ }
+ if (isHapticFeedbackDisabled(mContext)) {
+ return false;
+ }
+ return true;
+ }
+
public boolean hasCustomTransformHeight() {
return isLastExpandIcon && customTransformHeight != NO_VALUE;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index d3ee550..46f9c04 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -16,6 +16,8 @@
package com.android.systemui.statusbar.phone;
+import static com.android.systemui.statusbar.notification.NotificationUtils.isHapticFeedbackDisabled;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -23,9 +25,12 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.os.AsyncTask;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.os.VibrationEffect;
import android.os.Vibrator;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.view.InputDevice;
@@ -45,6 +50,7 @@
import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import java.io.FileDescriptor;
@@ -59,6 +65,7 @@
private float mMinExpandHeight;
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mPanelUpdateWhenAnimatorEnds;
+ private boolean mVibrateOnOpening;
private final void logf(String fmt, Object... args) {
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
@@ -203,6 +210,8 @@
mNotificationsDragEnabled =
getResources().getBoolean(R.bool.config_enableNotificationShadeDrag);
mVibrator = mContext.getSystemService(Vibrator.class);
+ mVibrateOnOpening = mContext.getResources().getBoolean(
+ R.bool.config_vibrateOnIconAnimation);
}
protected void loadDimens() {
@@ -394,7 +403,10 @@
runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(),
false /* collapseWhenFinished */);
notifyBarPanelExpansionChanged();
- mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_CLICK));
+ if (mVibrateOnOpening && !isHapticFeedbackDisabled(mContext)) {
+ AsyncTask.execute(
+ () -> mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_TICK)));
+ }
}
protected abstract float getOpeningHeight();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/plugins/PluginManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/plugins/PluginManagerTest.java
index bba982c..b8e9fcd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/plugins/PluginManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/plugins/PluginManagerTest.java
@@ -26,6 +26,8 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
+import android.support.test.annotation.UiThreadTest;
+import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -34,10 +36,11 @@
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.systemui.Dependency;
import com.android.systemui.SysuiTestCase;
-import com.android.systemui.plugins.PluginInstanceManager.PluginInfo;
import com.android.systemui.plugins.annotations.ProvidesInterface;
+import com.android.systemui.plugins.PluginInstanceManager.PluginInfo;
import com.android.systemui.plugins.PluginManagerImpl.PluginInstanceManagerFactory;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java
index a8487b3..4f98836 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java
@@ -29,6 +29,7 @@
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.SpannableStringBuilder;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@@ -395,6 +396,57 @@
mFooter.getVpnMessage(false, true, VPN_PACKAGE, null));
}
+ @Test
+ public void testConfigSubtitleVisibility() {
+ View view = LayoutInflater.from(mContext)
+ .inflate(R.layout.quick_settings_footer_dialog, null);
+
+ // Device Management subtitle should be shown when there is Device Management section only
+ // Other sections visibility will be set somewhere else so it will not be tested here
+ mFooter.configSubtitleVisibility(true, false, false, false, view);
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.device_management_subtitle).getVisibility());
+
+ // If there are multiple sections, all subtitles should be shown
+ mFooter.configSubtitleVisibility(true, true, false, false, view);
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.device_management_subtitle).getVisibility());
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.ca_certs_subtitle).getVisibility());
+
+ // If there are multiple sections, all subtitles should be shown
+ mFooter.configSubtitleVisibility(true, true, true, true, view);
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.device_management_subtitle).getVisibility());
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.ca_certs_subtitle).getVisibility());
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.network_logging_subtitle).getVisibility());
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.vpn_subtitle).getVisibility());
+
+ // If there are multiple sections, all subtitles should be shown, event if there is no
+ // Device Management section
+ mFooter.configSubtitleVisibility(false, true, true, true, view);
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.ca_certs_subtitle).getVisibility());
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.network_logging_subtitle).getVisibility());
+ assertEquals(View.VISIBLE,
+ view.findViewById(R.id.vpn_subtitle).getVisibility());
+
+ // If there is only 1 section, the title should be hidden
+ mFooter.configSubtitleVisibility(false, true, false, false, view);
+ assertEquals(View.GONE,
+ view.findViewById(R.id.ca_certs_subtitle).getVisibility());
+ mFooter.configSubtitleVisibility(false, false, true, false, view);
+ assertEquals(View.GONE,
+ view.findViewById(R.id.network_logging_subtitle).getVisibility());
+ mFooter.configSubtitleVisibility(false, false, false, true, view);
+ assertEquals(View.GONE,
+ view.findViewById(R.id.vpn_subtitle).getVisibility());
+ }
+
private CharSequence addLink(CharSequence description) {
final SpannableStringBuilder message = new SpannableStringBuilder();
message.append(description);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakePluginManager.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakePluginManager.java
index d1b1c5b..0a83a89 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakePluginManager.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakePluginManager.java
@@ -14,6 +14,7 @@
package com.android.systemui.utils.leaks;
+import android.content.Context;
import android.testing.LeakCheck;
import com.android.systemui.plugins.Plugin;
diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
index 2a2797c..f8c0e27 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
@@ -562,7 +562,10 @@
void onTimeout(RemoteFillService remoteService) {
// NOTE: Must make these 2 calls asynchronously, because the cancellation signal is
// handled by the service, which could block.
- remoteService.dispatchOnFillTimeout(mCancellation);
+ final ICancellationSignal cancellation = mCancellation;
+ if (cancellation != null) {
+ remoteService.dispatchOnFillTimeout(cancellation);
+ }
remoteService.dispatchOnFillRequestFailure(PendingFillRequest.this, null);
}
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index 3a4c9f8..901e1e7 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -547,6 +547,18 @@
}
}
+ @Override
+ public void tetherLimitReached(ITetheringStatsProvider provider) {
+ mContext.enforceCallingOrSelfPermission(NETWORK_STACK, TAG);
+ synchronized(mTetheringStatsProviders) {
+ if (!mTetheringStatsProviders.containsKey(provider)) {
+ return;
+ }
+ // No current code examines the interface parameter in a global alert. Just pass null.
+ notifyLimitReached(LIMIT_GLOBAL_ALERT, null);
+ }
+ }
+
// Sync the state of the given chain with the native daemon.
private void syncFirewallChainLocked(int chain, String name) {
SparseIntArray rules;
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 88d8944..617ba96 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -96,6 +96,7 @@
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
+import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static android.view.Display.DEFAULT_DISPLAY;
@@ -1580,8 +1581,9 @@
// A task can not be docked even if it is considered resizeable because it only supports
// picture-in-picture mode but has a non-resizeable resizeMode
return mService.mSupportsSplitScreenMultiWindow
- && isResizeable(false /* checkSupportsPip */)
- && !ActivityInfo.isPreserveOrientationMode(mResizeMode);
+ && (mService.mForceResizableActivities
+ || (isResizeable(false /* checkSupportsPip */)
+ && !ActivityInfo.isPreserveOrientationMode(mResizeMode)));
}
/**
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index e82eabf..56cff7c 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -305,8 +305,8 @@
* In order to support the always-on feature, an app has to
* <ul>
* <li>target {@link VERSION_CODES#N API 24} or above, and
- * <li>not opt out through the {@link VpnService#METADATA_SUPPORTS_ALWAYS_ON} meta-data
- * field.
+ * <li>not opt out through the {@link VpnService#SERVICE_META_DATA_SUPPORTS_ALWAYS_ON}
+ * meta-data field.
* </ul>
*
* @param packageName the canonical package name of the VPN app
@@ -340,8 +340,8 @@
for (ResolveInfo rInfo : services) {
final Bundle metaData = rInfo.serviceInfo.metaData;
- if (metaData != null
- && !metaData.getBoolean(VpnService.METADATA_SUPPORTS_ALWAYS_ON, true)) {
+ if (metaData != null &&
+ !metaData.getBoolean(VpnService.SERVICE_META_DATA_SUPPORTS_ALWAYS_ON, true)) {
return false;
}
}
diff --git a/services/core/java/com/android/server/connectivity/tethering/OffloadController.java b/services/core/java/com/android/server/connectivity/tethering/OffloadController.java
index 55e290a..ad661d7 100644
--- a/services/core/java/com/android/server/connectivity/tethering/OffloadController.java
+++ b/services/core/java/com/android/server/connectivity/tethering/OffloadController.java
@@ -60,6 +60,8 @@
private final Handler mHandler;
private final OffloadHardwareInterface mHwInterface;
private final ContentResolver mContentResolver;
+ private final INetworkManagementService mNms;
+ private final ITetheringStatsProvider mStatsProvider;
private final SharedLog mLog;
private boolean mConfigInitialized;
private boolean mControlInitialized;
@@ -89,13 +91,14 @@
mHandler = h;
mHwInterface = hwi;
mContentResolver = contentResolver;
+ mNms = nms;
+ mStatsProvider = new OffloadTetheringStatsProvider();
mLog = log.forSubComponent(TAG);
mExemptPrefixes = new HashSet<>();
mLastLocalPrefixStrs = new HashSet<>();
try {
- nms.registerTetheringStatsProvider(
- new OffloadTetheringStatsProvider(), getClass().getSimpleName());
+ mNms.registerTetheringStatsProvider(mStatsProvider, getClass().getSimpleName());
} catch (RemoteException e) {
mLog.e("Cannot register offload stats provider: " + e);
}
@@ -150,7 +153,26 @@
@Override
public void onStoppedLimitReached() {
mLog.log("onStoppedLimitReached");
- // Poll for statistics and notify NetworkStats
+
+ // We cannot reliably determine on which interface the limit was reached,
+ // because the HAL interface does not specify it. We cannot just use the
+ // current upstream, because that might have changed since the time that
+ // the HAL queued the callback.
+ // TODO: rev the HAL so that it provides an interface name.
+
+ // Fetch current stats, so that when our notification reaches
+ // NetworkStatsService and triggers a poll, we will respond with
+ // current data (which will be above the limit that was reached).
+ // Note that if we just changed upstream, this is unnecessary but harmless.
+ // The stats for the previous upstream were already updated on this thread
+ // just after the upstream was changed, so they are also up-to-date.
+ updateStatsForCurrentUpstream();
+
+ try {
+ mNms.tetherLimitReached(mStatsProvider);
+ } catch (RemoteException e) {
+ mLog.e("Cannot report data limit reached: " + e);
+ }
}
@Override
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 0072ba4..f88a074 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -3046,9 +3046,7 @@
updateRestrictBackgroundRulesOnUidStatusChangedUL(uid, oldUidState, uidState);
if (isProcStateAllowedWhileIdleOrPowerSaveMode(oldUidState)
!= isProcStateAllowedWhileIdleOrPowerSaveMode(uidState) ) {
- if (isUidIdle(uid)) {
- updateRuleForAppIdleUL(uid);
- }
+ updateRuleForAppIdleUL(uid);
if (mDeviceIdleMode) {
updateRuleForDeviceIdleUL(uid);
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 28acd9a..845efa6 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -804,6 +804,7 @@
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_LOCALE_CHANGED.equals(intent.getAction())) {
mZenModeHelper.updateDefaultZenRules();
+ mRankingHelper.onLocaleChanged(context, ActivityManager.getCurrentUser());
}
}
};
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index 9622a24..3386fe83 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -1073,6 +1073,22 @@
}
}
+ protected void onLocaleChanged(Context context, int userId) {
+ synchronized (mRecords) {
+ int N = mRecords.size();
+ for (int i = 0; i < N; i++) {
+ Record record = mRecords.valueAt(i);
+ if (UserHandle.getUserId(record.uid) == userId) {
+ if (record.channels.containsKey(NotificationChannel.DEFAULT_CHANNEL_ID)) {
+ record.channels.get(NotificationChannel.DEFAULT_CHANNEL_ID).setName(
+ context.getResources().getString(
+ R.string.default_notification_channel_label));
+ }
+ }
+ }
+ }
+ }
+
public void onPackagesChanged(boolean removingPackage, int changeUserId, String[] pkgList,
int[] uidList) {
if (pkgList == null || pkgList.length == 0) {
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index d99408f..56835f6 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -4867,7 +4867,7 @@
pw.print(" enabled=");
pw.print(ps.getEnabled(user.id));
pw.print(" instant=");
- pw.println(ps.getInstantApp(user.id));
+ pw.print(ps.getInstantApp(user.id));
pw.print(" virtual=");
pw.println(ps.getVirtulalPreload(user.id));
diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java
index 1ca98ac..f142ff6 100644
--- a/services/core/java/com/android/server/wm/AppWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java
@@ -632,9 +632,12 @@
mContainer.startingSurface = null;
mContainer.startingWindow = null;
mContainer.startingDisplayed = false;
- if (surface == null && DEBUG_STARTING_WINDOW) {
- Slog.v(TAG_WM, "startingWindow was set but startingSurface==null, couldn't "
- + "remove");
+ if (surface == null) {
+ if (DEBUG_STARTING_WINDOW) {
+ Slog.v(TAG_WM, "startingWindow was set but startingSurface==null, couldn't "
+ + "remove");
+ }
+ return;
}
} else {
if (DEBUG_STARTING_WINDOW) {
diff --git a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java
index 801479b..65bf330 100644
--- a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java
+++ b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java
@@ -46,6 +46,7 @@
import android.app.NotificationManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.graphics.Color;
import android.media.AudioAttributes;
import android.net.Uri;
@@ -78,6 +79,7 @@
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -127,6 +129,8 @@
when(mPm.getPackageUidAsUser(eq(UPDATED_PKG), anyInt())).thenReturn(UID2);
when(mContext.getResources()).thenReturn(
InstrumentationRegistry.getContext().getResources());
+ when(mContext.getContentResolver()).thenReturn(
+ InstrumentationRegistry.getContext().getContentResolver());
when(mContext.getPackageManager()).thenReturn(mPm);
when(mContext.getApplicationInfo()).thenReturn(legacy);
// most tests assume badging is enabled
@@ -1366,4 +1370,22 @@
assertFalse(mHelper.badgingEnabled(USER));
assertTrue(mHelper.badgingEnabled(USER2));
}
+
+ @Test
+ public void testOnLocaleChanged_updatesDefaultChannels() throws Exception {
+ String newLabel = "bananas!";
+ final NotificationChannel defaultChannel = mHelper.getNotificationChannel(PKG, UID,
+ NotificationChannel.DEFAULT_CHANNEL_ID, false);
+ assertFalse(newLabel.equals(defaultChannel.getName()));
+
+ Resources res = mock(Resources.class);
+ when(mContext.getResources()).thenReturn(res);
+ when(res.getString(com.android.internal.R.string.default_notification_channel_label))
+ .thenReturn(newLabel);
+
+ mHelper.onLocaleChanged(mContext, USER.getIdentifier());
+
+ assertEquals(newLabel, mHelper.getNotificationChannel(PKG, UID,
+ NotificationChannel.DEFAULT_CHANNEL_ID, false).getName());
+ }
}
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index c1289d3..e13bd61 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -1089,12 +1089,17 @@
* @return A string containing text sent by the remote user, or {@code null} if the
* conversation has been terminated or if there was an error while reading.
*/
- public String read() throws IOException {
- int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
- if (numRead < 0) {
+ public String read() {
+ try {
+ int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
+ if (numRead < 0) {
+ return null;
+ }
+ return new String(mReadBuffer, 0, numRead);
+ } catch (IOException e) {
+ Log.w(this, "Exception encountered when reading from InputStreamReader: %s", e);
return null;
}
- return new String(mReadBuffer, 0, numRead);
}
/**
@@ -1105,7 +1110,11 @@
*/
public String readImmediately() throws IOException {
if (mReceiveStream.ready()) {
- return read();
+ int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
+ if (numRead < 0) {
+ return null;
+ }
+ return new String(mReadBuffer, 0, numRead);
} else {
return null;
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 7f9de0d..81353df 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -567,20 +567,27 @@
"carrier_data_call_retry_config_strings";
/**
- * Delay between trying APN from the pool
+ * Delay in milliseconds between trying APN from the pool
* @hide
*/
public static final String KEY_CARRIER_DATA_CALL_APN_DELAY_DEFAULT_LONG =
"carrier_data_call_apn_delay_default_long";
/**
- * Faster delay between trying APN from the pool
+ * Faster delay in milliseconds between trying APN from the pool
* @hide
*/
public static final String KEY_CARRIER_DATA_CALL_APN_DELAY_FASTER_LONG =
"carrier_data_call_apn_delay_faster_long";
/**
+ * Delay in milliseconds for retrying APN after disconnect
+ * @hide
+ */
+ public static final String KEY_CARRIER_DATA_CALL_APN_RETRY_AFTER_DISCONNECT_LONG =
+ "carrier_data_call_apn_retry_after_disconnect_long";
+
+ /**
* Data call setup permanent failure causes by the carrier
*/
public static final String KEY_CARRIER_DATA_CALL_PERMANENT_FAILURE_STRINGS =
@@ -1645,6 +1652,7 @@
"others:max_retries=3, 5000, 5000, 5000"});
sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_DELAY_DEFAULT_LONG, 20000);
sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_DELAY_FASTER_LONG, 3000);
+ sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_RETRY_AFTER_DISCONNECT_LONG, 10000);
sDefaults.putString(KEY_CARRIER_ERI_FILE_NAME_STRING, "eri.xml");
sDefaults.putInt(KEY_DURATION_BLOCKING_DISABLED_AFTER_EMERGENCY_INT, 7200);
sDefaults.putStringArray(KEY_CARRIER_METERED_APN_TYPES_STRINGS,
diff --git a/core/tests/coretests/src/android/net/IpPrefixTest.java b/tests/net/java/android/net/IpPrefixTest.java
similarity index 93%
rename from core/tests/coretests/src/android/net/IpPrefixTest.java
rename to tests/net/java/android/net/IpPrefixTest.java
index 4f2387d..b5b2c07 100644
--- a/core/tests/coretests/src/android/net/IpPrefixTest.java
+++ b/tests/net/java/android/net/IpPrefixTest.java
@@ -16,18 +16,27 @@
package android.net;
-import android.net.IpPrefix;
-import android.os.Parcel;
-import android.test.suitebuilder.annotation.SmallTest;
-import java.net.InetAddress;
-import java.util.Random;
-import junit.framework.TestCase;
-
-import static android.test.MoreAsserts.assertNotEqual;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-public class IpPrefixTest extends TestCase {
+import android.os.Parcel;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import java.net.InetAddress;
+import java.util.Random;
+
+import org.junit.runner.RunWith;
+import org.junit.Test;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class IpPrefixTest {
private static InetAddress Address(String addr) {
return InetAddress.parseNumericAddress(addr);
@@ -42,7 +51,7 @@
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xa0
};
- @SmallTest
+ @Test
public void testConstructor() {
IpPrefix p;
try {
@@ -103,6 +112,7 @@
} catch(IllegalArgumentException expected) {}
}
+ @Test
public void testTruncation() {
IpPrefix p;
@@ -170,7 +180,7 @@
assertFalse(o2.equals(o1));
}
- @SmallTest
+ @Test
public void testEquals() {
IpPrefix p1, p2;
@@ -212,7 +222,7 @@
assertAreNotEqual(p1, p2);
}
- @SmallTest
+ @Test
public void testContains() {
IpPrefix p = new IpPrefix("2001:db8:f00::ace:d00d/127");
assertTrue(p.contains(Address("2001:db8:f00::ace:d00c")));
@@ -240,7 +250,7 @@
assertFalse(ipv4Default.contains(Address("2001:db8::f00")));
}
- @SmallTest
+ @Test
public void testHashCode() {
IpPrefix p = new IpPrefix(new byte[4], 0);
Random random = new Random();
@@ -261,12 +271,12 @@
assertEquals(p.hashCode(), oldP.hashCode());
}
if (p.hashCode() != oldP.hashCode()) {
- assertNotEqual(p, oldP);
+ assertNotEquals(p, oldP);
}
}
}
- @SmallTest
+ @Test
public void testHashCodeIsNotConstant() {
IpPrefix[] prefixes = {
new IpPrefix("2001:db8:f00::ace:d00d/127"),
@@ -276,12 +286,12 @@
};
for (int i = 0; i < prefixes.length; i++) {
for (int j = i + 1; j < prefixes.length; j++) {
- assertNotEqual(prefixes[i].hashCode(), prefixes[j].hashCode());
+ assertNotEquals(prefixes[i].hashCode(), prefixes[j].hashCode());
}
}
}
- @SmallTest
+ @Test
public void testMappedAddressesAreBroken() {
// 192.0.2.0/24 != ::ffff:c000:0204/120, but because we use InetAddress,
// we are unable to comprehend that.
@@ -318,13 +328,16 @@
assertEquals(p, p2);
}
+ @Test
public void testParceling() {
IpPrefix p;
p = new IpPrefix("2001:4860:db8::/64");
assertParcelingIsLossless(p);
+ assertTrue(p.isIPv6());
p = new IpPrefix("192.0.2.0/25");
assertParcelingIsLossless(p);
+ assertTrue(p.isIPv4());
}
}
diff --git a/core/tests/coretests/src/android/net/LinkAddressTest.java b/tests/net/java/android/net/LinkAddressTest.java
similarity index 91%
rename from core/tests/coretests/src/android/net/LinkAddressTest.java
rename to tests/net/java/android/net/LinkAddressTest.java
index adf8d95..c1ad946 100644
--- a/core/tests/coretests/src/android/net/LinkAddressTest.java
+++ b/tests/net/java/android/net/LinkAddressTest.java
@@ -16,6 +16,23 @@
package android.net;
+import static android.system.OsConstants.IFA_F_DADFAILED;
+import static android.system.OsConstants.IFA_F_DEPRECATED;
+import static android.system.OsConstants.IFA_F_OPTIMISTIC;
+import static android.system.OsConstants.IFA_F_PERMANENT;
+import static android.system.OsConstants.IFA_F_TEMPORARY;
+import static android.system.OsConstants.IFA_F_TENTATIVE;
+import static android.system.OsConstants.RT_SCOPE_HOST;
+import static android.system.OsConstants.RT_SCOPE_LINK;
+import static android.system.OsConstants.RT_SCOPE_SITE;
+import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
@@ -27,44 +44,35 @@
import java.util.Comparator;
import java.util.List;
-import android.net.LinkAddress;
import android.os.Parcel;
-import android.test.AndroidTestCase;
-import static android.test.MoreAsserts.assertNotEqual;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
-import static android.system.OsConstants.IFA_F_DADFAILED;
-import static android.system.OsConstants.IFA_F_DEPRECATED;
-import static android.system.OsConstants.IFA_F_OPTIMISTIC;
-import static android.system.OsConstants.IFA_F_PERMANENT;
-import static android.system.OsConstants.IFA_F_TEMPORARY;
-import static android.system.OsConstants.IFA_F_TENTATIVE;
-import static android.system.OsConstants.RT_SCOPE_HOST;
-import static android.system.OsConstants.RT_SCOPE_LINK;
-import static android.system.OsConstants.RT_SCOPE_SITE;
-import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
+import org.junit.runner.RunWith;
+import org.junit.Test;
-/**
- * Tests for {@link LinkAddress}.
- */
-public class LinkAddressTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class LinkAddressTest {
private static final String V4 = "192.0.2.1";
private static final String V6 = "2001:db8::1";
private static final InetAddress V4_ADDRESS = NetworkUtils.numericToInetAddress(V4);
private static final InetAddress V6_ADDRESS = NetworkUtils.numericToInetAddress(V6);
+ @Test
public void testConstants() {
// RT_SCOPE_UNIVERSE = 0, but all the other constants should be nonzero.
- assertNotEqual(0, RT_SCOPE_HOST);
- assertNotEqual(0, RT_SCOPE_LINK);
- assertNotEqual(0, RT_SCOPE_SITE);
+ assertNotEquals(0, RT_SCOPE_HOST);
+ assertNotEquals(0, RT_SCOPE_LINK);
+ assertNotEquals(0, RT_SCOPE_SITE);
- assertNotEqual(0, IFA_F_DEPRECATED);
- assertNotEqual(0, IFA_F_PERMANENT);
- assertNotEqual(0, IFA_F_TENTATIVE);
+ assertNotEquals(0, IFA_F_DEPRECATED);
+ assertNotEquals(0, IFA_F_PERMANENT);
+ assertNotEquals(0, IFA_F_TENTATIVE);
}
+ @Test
public void testConstructors() throws SocketException {
LinkAddress address;
@@ -74,12 +82,14 @@
assertEquals(25, address.getPrefixLength());
assertEquals(0, address.getFlags());
assertEquals(RT_SCOPE_UNIVERSE, address.getScope());
+ assertTrue(address.isIPv4());
address = new LinkAddress(V6_ADDRESS, 127);
assertEquals(V6_ADDRESS, address.getAddress());
assertEquals(127, address.getPrefixLength());
assertEquals(0, address.getFlags());
assertEquals(RT_SCOPE_UNIVERSE, address.getScope());
+ assertTrue(address.isIPv6());
// Nonsensical flags/scopes or combinations thereof are acceptable.
address = new LinkAddress(V6 + "/64", IFA_F_DEPRECATED | IFA_F_PERMANENT, RT_SCOPE_LINK);
@@ -87,12 +97,14 @@
assertEquals(64, address.getPrefixLength());
assertEquals(IFA_F_DEPRECATED | IFA_F_PERMANENT, address.getFlags());
assertEquals(RT_SCOPE_LINK, address.getScope());
+ assertTrue(address.isIPv6());
address = new LinkAddress(V4 + "/23", 123, 456);
assertEquals(V4_ADDRESS, address.getAddress());
assertEquals(23, address.getPrefixLength());
assertEquals(123, address.getFlags());
assertEquals(456, address.getScope());
+ assertTrue(address.isIPv4());
// InterfaceAddress doesn't have a constructor. Fetch some from an interface.
List<InterfaceAddress> addrs = NetworkInterface.getByName("lo").getInterfaceAddresses();
@@ -174,6 +186,7 @@
} catch(IllegalArgumentException expected) {}
}
+ @Test
public void testAddressScopes() {
assertEquals(RT_SCOPE_HOST, new LinkAddress("::/128").getScope());
assertEquals(RT_SCOPE_HOST, new LinkAddress("0.0.0.0/32").getScope());
@@ -216,6 +229,7 @@
assertFalse(l2 + " unexpectedly equal to " + l1, l2.equals(l1));
}
+ @Test
public void testEqualsAndSameAddressAs() {
LinkAddress l1, l2, l3;
@@ -293,26 +307,17 @@
assertIsSameAddressAs(l1, l2);
}
+ @Test
public void testHashCode() {
- LinkAddress l;
+ LinkAddress l1, l2;
- l = new LinkAddress(V4_ADDRESS, 23);
- assertEquals(-982787, l.hashCode());
+ l1 = new LinkAddress(V4_ADDRESS, 23);
+ l2 = new LinkAddress(V4_ADDRESS, 23, 0, RT_SCOPE_HOST);
+ assertNotEquals(l1.hashCode(), l2.hashCode());
- l = new LinkAddress(V4_ADDRESS, 23, 0, RT_SCOPE_HOST);
- assertEquals(-971865, l.hashCode());
-
- l = new LinkAddress(V4_ADDRESS, 27);
- assertEquals(-982743, l.hashCode());
-
- l = new LinkAddress(V6_ADDRESS, 64);
- assertEquals(1076522926, l.hashCode());
-
- l = new LinkAddress(V6_ADDRESS, 128);
- assertEquals(1076523630, l.hashCode());
-
- l = new LinkAddress(V6_ADDRESS, 128, IFA_F_TENTATIVE, RT_SCOPE_UNIVERSE);
- assertEquals(1076524846, l.hashCode());
+ l1 = new LinkAddress(V6_ADDRESS, 128);
+ l2 = new LinkAddress(V6_ADDRESS, 128, IFA_F_TENTATIVE, RT_SCOPE_UNIVERSE);
+ assertNotEquals(l1.hashCode(), l2.hashCode());
}
private LinkAddress passThroughParcel(LinkAddress l) {
@@ -334,6 +339,7 @@
assertEquals(l, l2);
}
+ @Test
public void testParceling() {
LinkAddress l;
@@ -352,6 +358,7 @@
assertFalse(msg, l.isGlobalPreferred());
}
+ @Test
public void testIsGlobalPreferred() {
LinkAddress l;
diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java
index f0b3724..296cb76 100644
--- a/tests/net/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/net/java/com/android/server/connectivity/VpnTest.java
@@ -346,7 +346,7 @@
// Apps that opt out explicitly are not supported
appInfo.targetSdkVersion = VERSION_CODES.CUR_DEVELOPMENT;
Bundle metaData = new Bundle();
- metaData.putBoolean(VpnService.METADATA_SUPPORTS_ALWAYS_ON, false);
+ metaData.putBoolean(VpnService.SERVICE_META_DATA_SUPPORTS_ALWAYS_ON, false);
svcInfo.metaData = metaData;
assertFalse(vpn.isAlwaysOnPackageSupported(PKGS[0]));
}
diff --git a/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java b/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
index c4965a0..983e04d 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
@@ -85,6 +85,8 @@
ArgumentCaptor.forClass(ArrayList.class);
private final ArgumentCaptor<ITetheringStatsProvider.Stub> mTetherStatsProviderCaptor =
ArgumentCaptor.forClass(ITetheringStatsProvider.Stub.class);
+ private final ArgumentCaptor<OffloadHardwareInterface.ControlCallback> mControlCallbackCaptor =
+ ArgumentCaptor.forClass(OffloadHardwareInterface.ControlCallback.class);
private MockContentResolver mContentResolver;
@Before public void setUp() {
@@ -103,7 +105,7 @@
private void setupFunctioningHardwareInterface() {
when(mHardware.initOffloadConfig()).thenReturn(true);
- when(mHardware.initOffloadControl(any(OffloadHardwareInterface.ControlCallback.class)))
+ when(mHardware.initOffloadControl(mControlCallbackCaptor.capture()))
.thenReturn(true);
when(mHardware.getForwardedStats(any())).thenReturn(new ForwardedStats());
}
@@ -489,4 +491,17 @@
waitForIdle();
inOrder.verify(mHardware).stopOffloadControl();
}
+
+ @Test
+ public void testDataLimitCallback() throws Exception {
+ setupFunctioningHardwareInterface();
+ enableOffload();
+
+ final OffloadController offload = makeOffloadController();
+ offload.start();
+
+ OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue();
+ callback.onStoppedLimitReached();
+ verify(mNMService, times(1)).tetherLimitReached(mTetherStatsProviderCaptor.getValue());
+ }
}