Merge "Change 'HDMI' on music notification panel UI to 'External Device'"
diff --git a/apct-tests/perftests/core/AndroidManifest.xml b/apct-tests/perftests/core/AndroidManifest.xml
index 56fa70c..0395480 100644
--- a/apct-tests/perftests/core/AndroidManifest.xml
+++ b/apct-tests/perftests/core/AndroidManifest.xml
@@ -15,6 +15,7 @@
<application>
<uses-library android:name="android.test.runner" />
+ <profileable android:shell="true" />
<activity android:name="android.perftests.utils.PerfTestActivity"
android:exported="true">
<intent-filter>
diff --git a/api/Android.mk b/api/Android.mk
new file mode 100644
index 0000000..ce5f995
--- /dev/null
+++ b/api/Android.mk
@@ -0,0 +1,2 @@
+.PHONY: checkapi
+checkapi: frameworks-base-api-current-compat frameworks-base-api-system-current-compat frameworks-base-api-module-lib-current-compat
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 6d982ced..9673e8ce 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1094,7 +1094,7 @@
&& (options == null
|| ActivityOptions.fromBundle(options).getLaunchTaskId() == -1)) {
throw new AndroidRuntimeException(
- "Calling startActivity() from outside of an Activity "
+ "Calling startActivity() from outside of an Activity"
+ " context requires the FLAG_ACTIVITY_NEW_TASK flag."
+ " Is this really what you want?");
}
@@ -1128,7 +1128,7 @@
public int startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
throw new AndroidRuntimeException(
- "Calling startActivities() from outside of an Activity "
+ "Calling startActivities() from outside of an Activity"
+ " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
+ " Is this really what you want?");
}
@@ -1142,7 +1142,7 @@
warnIfCallingFromSystemProcess();
if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
throw new AndroidRuntimeException(
- "Calling startActivities() from outside of an Activity "
+ "Calling startActivities() from outside of an Activity"
+ " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
+ " Is this really what you want?");
}
diff --git a/core/java/android/preference/GenericInflater.java b/core/java/android/preference/GenericInflater.java
index 7edc987..fe53d4e 100644
--- a/core/java/android/preference/GenericInflater.java
+++ b/core/java/android/preference/GenericInflater.java
@@ -406,7 +406,7 @@
InflateException ie = new InflateException(attrs
.getPositionDescription()
+ ": Error inflating class "
- + constructor.getClass().getName());
+ + constructor.getDeclaringClass().getName());
ie.initCause(e);
throw ie;
}
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index b1e7d15..deafd19 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -1001,16 +1001,24 @@
}
/**
+ * This will enable jdwp by default for all apps. It is OK to cache this property
+ * because we expect to reboot the system whenever this property changes
+ */
+ private static final boolean ENABLE_JDWP = SystemProperties.get(
+ "persist.debug.dalvik.vm.jdwp.enabled").equals("1");
+
+ /**
* Applies debugger system properties to the zygote arguments.
*
- * If "ro.debuggable" is "1", all apps are debuggable. Otherwise,
- * the debugger state is specified via the "--enable-jdwp" flag
- * in the spawn request.
+ * For eng builds all apps are debuggable. On userdebug and user builds
+ * if persist.debuggable.dalvik.vm.jdwp.enabled is 1 all apps are
+ * debuggable. Otherwise, the debugger state is specified via the
+ * "--enable-jdwp" flag in the spawn request.
*
* @param args non-null; zygote spawner args
*/
static void applyDebuggerSystemProperty(ZygoteArguments args) {
- if (RoSystemProperties.DEBUGGABLE) {
+ if (Build.IS_ENG || ENABLE_JDWP) {
args.mRuntimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
}
}
diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp
index f7a98d1..30d9ea1 100644
--- a/core/jni/android_os_MessageQueue.cpp
+++ b/core/jni/android_os_MessageQueue.cpp
@@ -51,6 +51,21 @@
virtual int handleEvent(int fd, int events, void* data);
+ /**
+ * A simple proxy that holds a weak reference to a looper callback.
+ */
+ class WeakLooperCallback : public LooperCallback {
+ protected:
+ virtual ~WeakLooperCallback();
+
+ public:
+ WeakLooperCallback(const wp<LooperCallback>& callback);
+ virtual int handleEvent(int fd, int events, void* data);
+
+ private:
+ wp<LooperCallback> mCallback;
+ };
+
private:
JNIEnv* mPollEnv;
jobject mPollObj;
@@ -131,7 +146,8 @@
if (events & CALLBACK_EVENT_OUTPUT) {
looperEvents |= Looper::EVENT_OUTPUT;
}
- mLooper->addFd(fd, Looper::POLL_CALLBACK, looperEvents, this,
+ mLooper->addFd(fd, Looper::POLL_CALLBACK, looperEvents,
+ sp<WeakLooperCallback>::make(this),
reinterpret_cast<void*>(events));
} else {
mLooper->removeFd(fd);
@@ -162,6 +178,24 @@
}
+// --- NativeMessageQueue::WeakLooperCallback ---
+
+NativeMessageQueue::WeakLooperCallback::WeakLooperCallback(const wp<LooperCallback>& callback) :
+ mCallback(callback) {
+}
+
+NativeMessageQueue::WeakLooperCallback::~WeakLooperCallback() {
+}
+
+int NativeMessageQueue::WeakLooperCallback::handleEvent(int fd, int events, void* data) {
+ sp<LooperCallback> callback = mCallback.promote();
+ if (callback != nullptr) {
+ return callback->handleEvent(fd, events, data);
+ }
+ return 0;
+}
+
+
// ----------------------------------------------------------------------------
sp<MessageQueue> android_os_MessageQueue_getMessageQueue(JNIEnv* env, jobject messageQueueObj) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 91d8138..da91471 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -8786,6 +8786,7 @@
* @param incrementalMetrics metrics for apps installed on Incremental.
* @param errorId a unique id to append to the dropbox headers.
*/
+ @SuppressWarnings("DoNotCall") // Ignore warning for synchronous to call to worker.run()
public void addErrorToDropBox(String eventType,
ProcessRecord process, String processName, String activityShortComponentName,
String parentShortComponentName, ProcessRecord parentProcess,
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 676dc19..6a53978 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -3210,41 +3210,44 @@
return;
}
- if (mSession != null && mMobikeEnabled) {
- Log.d(
- TAG,
- "IKE Session has mobility. Delay handleSessionLost for losing network "
- + network
- + " on session with token "
- + mCurrentToken);
+ Log.d(TAG, "Schedule a delay handleSessionLost for losing network "
+ + network
+ + " on session with token "
+ + mCurrentToken);
- final int token = mCurrentToken;
- // Delay the teardown in case a new network will be available soon. For example,
- // during handover between two WiFi networks, Android will disconnect from the
- // first WiFi and then connects to the second WiFi.
- mScheduledHandleNetworkLostFuture =
- mExecutor.schedule(
- () -> {
- if (isActiveToken(token)) {
- handleSessionLost(null /* exception */, network);
- } else {
- Log.d(
- TAG,
- "Scheduled handleSessionLost fired for "
- + "obsolete token "
- + token);
+ final int token = mCurrentToken;
+ // Delay the teardown in case a new network will be available soon. For example,
+ // during handover between two WiFi networks, Android will disconnect from the
+ // first WiFi and then connects to the second WiFi.
+ mScheduledHandleNetworkLostFuture =
+ mExecutor.schedule(
+ () -> {
+ if (isActiveToken(token)) {
+ handleSessionLost(new IkeNetworkLostException(network),
+ network);
+
+ synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
+ updateState(DetailedState.DISCONNECTED,
+ "Network lost");
}
+ } else {
+ Log.d(
+ TAG,
+ "Scheduled handleSessionLost fired for "
+ + "obsolete token "
+ + token);
+ }
- // Reset mScheduledHandleNetworkLostFuture since it's
- // already run on executor thread.
- mScheduledHandleNetworkLostFuture = null;
- },
- NETWORK_LOST_TIMEOUT_MS,
- TimeUnit.MILLISECONDS);
- } else {
- Log.d(TAG, "Call handleSessionLost for losing network " + network);
- handleSessionLost(null /* exception */, network);
- }
+ // Reset mScheduledHandleNetworkLostFuture since it's
+ // already run on executor thread.
+ mScheduledHandleNetworkLostFuture = null;
+ },
+ NETWORK_LOST_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
+
}
private void cancelHandleNetworkLostTimeout() {
@@ -4185,8 +4188,6 @@
*/
@NonNull
public synchronized List<String> getAppExclusionList(@NonNull String packageName) {
- enforceNotRestrictedUser();
-
final long oldId = Binder.clearCallingIdentity();
try {
final byte[] bytes = getVpnProfileStore().get(getVpnAppExcludedForPackage(packageName));
diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java
index c75de42..ac892da 100644
--- a/telephony/java/android/telephony/NetworkService.java
+++ b/telephony/java/android/telephony/NetworkService.java
@@ -265,7 +265,7 @@
/** @hide */
@Override
public void onDestroy() {
- mHandlerThread.quit();
+ mHandlerThread.quitSafely();
super.onDestroy();
}
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 700d615..d8b2cbe 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -725,7 +725,7 @@
@Override
public void onDestroy() {
- mHandlerThread.quit();
+ mHandlerThread.quitSafely();
super.onDestroy();
}