Merge "wifi: hotspot2: add support for validating passpoint configuration"
diff --git a/api/current.txt b/api/current.txt
index 21fe3e2..21ff787 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -62850,7 +62850,10 @@
method public java.lang.String getComment();
method public long getCompressedSize();
method public long getCrc();
+ method public java.nio.file.attribute.FileTime getCreationTime();
method public byte[] getExtra();
+ method public java.nio.file.attribute.FileTime getLastAccessTime();
+ method public java.nio.file.attribute.FileTime getLastModifiedTime();
method public int getMethod();
method public java.lang.String getName();
method public long getSize();
@@ -62859,7 +62862,10 @@
method public void setComment(java.lang.String);
method public void setCompressedSize(long);
method public void setCrc(long);
+ method public java.util.zip.ZipEntry setCreationTime(java.nio.file.attribute.FileTime);
method public void setExtra(byte[]);
+ method public java.util.zip.ZipEntry setLastAccessTime(java.nio.file.attribute.FileTime);
+ method public java.util.zip.ZipEntry setLastModifiedTime(java.nio.file.attribute.FileTime);
method public void setMethod(int);
method public void setSize(long);
method public void setTime(long);
@@ -62930,6 +62936,7 @@
method public java.io.InputStream getInputStream(java.util.zip.ZipEntry) throws java.io.IOException;
method public java.lang.String getName();
method public int size();
+ method public java.util.stream.Stream<? extends java.util.zip.ZipEntry> stream();
field public static final int CENATT = 36; // 0x24
field public static final int CENATX = 38; // 0x26
field public static final int CENCOM = 32; // 0x20
diff --git a/api/system-current.txt b/api/system-current.txt
index 974db45..6645d53 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -66207,7 +66207,10 @@
method public java.lang.String getComment();
method public long getCompressedSize();
method public long getCrc();
+ method public java.nio.file.attribute.FileTime getCreationTime();
method public byte[] getExtra();
+ method public java.nio.file.attribute.FileTime getLastAccessTime();
+ method public java.nio.file.attribute.FileTime getLastModifiedTime();
method public int getMethod();
method public java.lang.String getName();
method public long getSize();
@@ -66216,7 +66219,10 @@
method public void setComment(java.lang.String);
method public void setCompressedSize(long);
method public void setCrc(long);
+ method public java.util.zip.ZipEntry setCreationTime(java.nio.file.attribute.FileTime);
method public void setExtra(byte[]);
+ method public java.util.zip.ZipEntry setLastAccessTime(java.nio.file.attribute.FileTime);
+ method public java.util.zip.ZipEntry setLastModifiedTime(java.nio.file.attribute.FileTime);
method public void setMethod(int);
method public void setSize(long);
method public void setTime(long);
@@ -66287,6 +66293,7 @@
method public java.io.InputStream getInputStream(java.util.zip.ZipEntry) throws java.io.IOException;
method public java.lang.String getName();
method public int size();
+ method public java.util.stream.Stream<? extends java.util.zip.ZipEntry> stream();
field public static final int CENATT = 36; // 0x24
field public static final int CENATX = 38; // 0x26
field public static final int CENCOM = 32; // 0x20
diff --git a/api/test-current.txt b/api/test-current.txt
index 29de7a5..5301443 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -62930,7 +62930,10 @@
method public java.lang.String getComment();
method public long getCompressedSize();
method public long getCrc();
+ method public java.nio.file.attribute.FileTime getCreationTime();
method public byte[] getExtra();
+ method public java.nio.file.attribute.FileTime getLastAccessTime();
+ method public java.nio.file.attribute.FileTime getLastModifiedTime();
method public int getMethod();
method public java.lang.String getName();
method public long getSize();
@@ -62939,7 +62942,10 @@
method public void setComment(java.lang.String);
method public void setCompressedSize(long);
method public void setCrc(long);
+ method public java.util.zip.ZipEntry setCreationTime(java.nio.file.attribute.FileTime);
method public void setExtra(byte[]);
+ method public java.util.zip.ZipEntry setLastAccessTime(java.nio.file.attribute.FileTime);
+ method public java.util.zip.ZipEntry setLastModifiedTime(java.nio.file.attribute.FileTime);
method public void setMethod(int);
method public void setSize(long);
method public void setTime(long);
@@ -63010,6 +63016,7 @@
method public java.io.InputStream getInputStream(java.util.zip.ZipEntry) throws java.io.IOException;
method public java.lang.String getName();
method public int size();
+ method public java.util.stream.Stream<? extends java.util.zip.ZipEntry> stream();
field public static final int CENATT = 36; // 0x24
field public static final int CENATX = 38; // 0x26
field public static final int CENCOM = 32; // 0x20
diff --git a/cmds/svc/src/com/android/commands/svc/UsbCommand.java b/cmds/svc/src/com/android/commands/svc/UsbCommand.java
index a6ef25f..4dcb05e 100644
--- a/cmds/svc/src/com/android/commands/svc/UsbCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/UsbCommand.java
@@ -50,7 +50,7 @@
IUsbManager usbMgr = IUsbManager.Stub.asInterface(ServiceManager.getService(
Context.USB_SERVICE));
try {
- usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null));
+ usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null), false);
} catch (RemoteException e) {
System.err.println("Error communicating with UsbManager: " + e);
}
diff --git a/core/java/android/hardware/usb/IUsbManager.aidl b/core/java/android/hardware/usb/IUsbManager.aidl
index 6e4c9de..00b0bff 100644
--- a/core/java/android/hardware/usb/IUsbManager.aidl
+++ b/core/java/android/hardware/usb/IUsbManager.aidl
@@ -87,15 +87,13 @@
/* Returns true if the specified USB function is enabled. */
boolean isFunctionEnabled(String function);
- /* Sets the current USB function. */
- void setCurrentFunction(String function);
-
- /* Sets whether USB data (for example, MTP exposed pictures) should be made
- * available on the USB connection. Unlocking data should only be done with
- * user involvement, since exposing pictures or other data could leak sensitive
- * user information.
+ /* Sets the current USB function as well as whether USB data
+ * (for example, MTP exposed pictures) should be made available
+ * on the USB connection. Unlocking data should only be done with
+ * user involvement, since exposing pictures or other data could
+ * leak sensitive user information.
*/
- void setUsbDataUnlocked(boolean unlock);
+ void setCurrentFunction(String function, boolean usbDataUnlocked);
/* Allow USB debugging from the attached host. If alwaysAllow is true, add the
* the public key to list of host keys that the user has approved.
diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java
index f9a7d19..6341cbc 100644
--- a/core/java/android/hardware/usb/UsbManager.java
+++ b/core/java/android/hardware/usb/UsbManager.java
@@ -509,33 +509,23 @@
* {@link #USB_FUNCTION_MIDI}, {@link #USB_FUNCTION_MTP}, {@link #USB_FUNCTION_PTP},
* or {@link #USB_FUNCTION_RNDIS}.
* </p><p>
+ * Also sets whether USB data (for example, MTP exposed pictures) should be made available
+ * on the USB connection when in device mode. Unlocking usb data should only be done with
+ * user involvement, since exposing pictures or other data could leak sensitive
+ * user information.
+ * </p><p>
* Note: This function is asynchronous and may fail silently without applying
* the requested changes.
* </p>
*
* @param function name of the USB function, or null to restore the default function
+ * @param usbDataUnlocked whether user data is accessible
*
* {@hide}
*/
- public void setCurrentFunction(String function) {
+ public void setCurrentFunction(String function, boolean usbDataUnlocked) {
try {
- mService.setCurrentFunction(function);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
- * Sets whether USB data (for example, MTP exposed pictures) should be made available
- * on the USB connection when in device mode. Unlocking usb data should only be done with
- * user involvement, since exposing pictures or other data could leak sensitive
- * user information.
- *
- * {@hide}
- */
- public void setUsbDataUnlocked(boolean unlocked) {
- try {
- mService.setUsbDataUnlocked(unlocked);
+ mService.setCurrentFunction(function, usbDataUnlocked);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/tests/coretests/apks/install_jni_lib/Android.mk b/core/tests/coretests/apks/install_jni_lib/Android.mk
index 9e45d09..d7b38e8 100644
--- a/core/tests/coretests/apks/install_jni_lib/Android.mk
+++ b/core/tests/coretests/apks/install_jni_lib/Android.mk
@@ -19,8 +19,7 @@
LOCAL_SRC_FILES := \
com_android_frameworks_coretests_JNITest.cpp
-LOCAL_SHARED_LIBRARIES := \
- libnativehelper
+LOCAL_SDK_VERSION := 16
LOCAL_CFLAGS += -Wall -Werror
diff --git a/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp b/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp
index 8d91192..0cf3a84 100644
--- a/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp
+++ b/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp
@@ -14,41 +14,23 @@
* limitations under the License.
*/
-#include "nativehelper/JNIHelp.h"
+#include <jni.h>
-namespace android {
-
-static jint checkFunction(JNIEnv*, jclass) {
+extern "C" JNIEXPORT
+jint JNICALL Java_com_android_frameworks_coretests_JNITests_checkFunction(JNIEnv*, jclass) {
return 1;
}
-static const JNINativeMethod sMethods[] = {
- /* name, signature, funcPtr */
- { "checkFunction", "()I", (void*) checkFunction },
-};
-
-int register_com_android_frameworks_coretests_JNITests(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "com/android/frameworks/coretests/JNITests", sMethods,
- NELEM(sMethods));
-}
-
-}
-
/*
* JNI Initialization
*/
jint JNI_OnLoad(JavaVM *jvm, void */* reserved */) {
JNIEnv *e;
- int status;
// Check JNI version
if (jvm->GetEnv((void **) &e, JNI_VERSION_1_6)) {
return JNI_ERR;
}
- if ((status = android::register_com_android_frameworks_coretests_JNITests(e)) < 0) {
- return JNI_ERR;
- }
-
return JNI_VERSION_1_6;
}
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 3c1c0bc..0d9ede0 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -20,6 +20,7 @@
#include "CanvasContext.h"
#include "EglManager.h"
#include "RenderProxy.h"
+#include "utils/FatVector.h"
#include <gui/DisplayEventReceiver.h>
#include <gui/ISurfaceComposer.h>
@@ -282,10 +283,18 @@
"RenderThread Looper POLL_ERROR!");
nsecs_t nextWakeup;
- // Process our queue, if we have anything
- while (RenderTask* task = nextTask(&nextWakeup)) {
- task->run();
- // task may have deleted itself, do not reference it again
+ {
+ FatVector<RenderTask*, 10> workQueue;
+ // Process our queue, if we have anything. By first acquiring
+ // all the pending events then processing them we avoid vsync
+ // starvation if more tasks are queued while we are processing tasks.
+ while (RenderTask* task = nextTask(&nextWakeup)) {
+ workQueue.push_back(task);
+ }
+ for (auto task : workQueue) {
+ task->run();
+ // task may have deleted itself, do not reference it again
+ }
}
if (nextWakeup == LLONG_MAX) {
timeoutMillis = -1;
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java
index 9608daa..24ede16 100755
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java
@@ -116,6 +116,10 @@
List<BluetoothDevice> sinks = getConnectedDevices();
if (sinks != null) {
for (BluetoothDevice sink : sinks) {
+ if (sink.equals(device)) {
+ Log.w(TAG, "Connecting to device " + device + " : disconnect skipped");
+ continue;
+ }
mService.disconnect(sink);
}
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index b59f468..0f54d23 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -6351,13 +6351,18 @@
removeLruProcessLocked(app);
if (mBackupTarget != null && mBackupTarget.app.pid == pid) {
Slog.w(TAG, "Unattached app died before backup, skipping");
- try {
- IBackupManager bm = IBackupManager.Stub.asInterface(
- ServiceManager.getService(Context.BACKUP_SERVICE));
- bm.agentDisconnected(app.info.packageName);
- } catch (RemoteException e) {
- // Can't happen; the backup manager is local
- }
+ mHandler.post(new Runnable() {
+ @Override
+ public void run(){
+ try {
+ IBackupManager bm = IBackupManager.Stub.asInterface(
+ ServiceManager.getService(Context.BACKUP_SERVICE));
+ bm.agentDisconnected(app.info.packageName);
+ } catch (RemoteException e) {
+ // Can't happen; the backup manager is local
+ }
+ }
+ });
}
if (isPendingBroadcastProcessLocked(pid)) {
Slog.w(TAG, "Unattached app died before broadcast acknowledged, skipping");
@@ -16766,13 +16771,18 @@
if (mBackupTarget != null && app.pid == mBackupTarget.app.pid) {
if (DEBUG_BACKUP || DEBUG_CLEANUP) Slog.d(TAG_CLEANUP, "App "
+ mBackupTarget.appInfo + " died during backup");
- try {
- IBackupManager bm = IBackupManager.Stub.asInterface(
- ServiceManager.getService(Context.BACKUP_SERVICE));
- bm.agentDisconnected(app.info.packageName);
- } catch (RemoteException e) {
- // can't happen; backup manager is local
- }
+ mHandler.post(new Runnable() {
+ @Override
+ public void run(){
+ try {
+ IBackupManager bm = IBackupManager.Stub.asInterface(
+ ServiceManager.getService(Context.BACKUP_SERVICE));
+ bm.agentDisconnected(app.info.packageName);
+ } catch (RemoteException e) {
+ // can't happen; backup manager is local
+ }
+ }
+ });
}
for (int i = mPendingProcessChanges.size() - 1; i >= 0; i--) {
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index e888faa..cec4141 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -900,7 +900,7 @@
}
} else {
mUsbTetherRequested = true;
- usbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS);
+ usbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS, false);
}
} else {
final long ident = Binder.clearCallingIdentity();
@@ -910,7 +910,7 @@
Binder.restoreCallingIdentity(ident);
}
if (mRndisEnabled) {
- usbManager.setCurrentFunction(null);
+ usbManager.setCurrentFunction(null, false);
}
mUsbTetherRequested = false;
}
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index df9242d..43b8fa5 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -108,9 +108,8 @@
private static final int MSG_SYSTEM_READY = 3;
private static final int MSG_BOOT_COMPLETED = 4;
private static final int MSG_USER_SWITCHED = 5;
- private static final int MSG_SET_USB_DATA_UNLOCKED = 6;
- private static final int MSG_UPDATE_USER_RESTRICTIONS = 7;
- private static final int MSG_UPDATE_HOST_STATE = 8;
+ private static final int MSG_UPDATE_USER_RESTRICTIONS = 6;
+ private static final int MSG_UPDATE_HOST_STATE = 7;
private static final int AUDIO_MODE_SOURCE = 1;
@@ -287,7 +286,7 @@
if (functions != null) {
mAccessoryModeRequestTime = SystemClock.elapsedRealtime();
- setCurrentFunctions(functions);
+ setCurrentFunctions(functions, false);
}
}
@@ -335,14 +334,22 @@
// Restore default functions.
mCurrentFunctions = SystemProperties.get(USB_CONFIG_PROPERTY,
UsbManager.USB_FUNCTION_NONE);
- if (UsbManager.USB_FUNCTION_NONE.equals(mCurrentFunctions)) {
- mCurrentFunctions = UsbManager.USB_FUNCTION_MTP;
- }
mCurrentFunctionsApplied = mCurrentFunctions.equals(
SystemProperties.get(USB_STATE_PROPERTY));
mAdbEnabled = UsbManager.containsFunction(getDefaultFunctions(),
UsbManager.USB_FUNCTION_ADB);
- setEnabledFunctions(null, false);
+
+ /**
+ * Remove MTP from persistent config, to bring usb to a good state
+ * after fixes to b/31814300. This block can be removed after the update
+ */
+ String persisted = SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY);
+ if (UsbManager.containsFunction(persisted, UsbManager.USB_FUNCTION_MTP)) {
+ SystemProperties.set(USB_PERSISTENT_CONFIG_PROPERTY,
+ UsbManager.removeFunction(persisted, UsbManager.USB_FUNCTION_MTP));
+ }
+
+ setEnabledFunctions(null, false, false);
String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim();
updateState(state);
@@ -374,6 +381,14 @@
sendMessage(m);
}
+ public void sendMessage(int what, Object arg, boolean arg1) {
+ removeMessages(what);
+ Message m = Message.obtain(this, what);
+ m.obj = arg;
+ m.arg1 = (arg1 ? 1 : 0);
+ sendMessage(m);
+ }
+
public void updateState(String state) {
int connected, configured;
@@ -427,29 +442,24 @@
return waitForState(config);
}
- private void setUsbDataUnlocked(boolean enable) {
- if (DEBUG) Slog.d(TAG, "setUsbDataUnlocked: " + enable);
- mUsbDataUnlocked = enable;
- updateUsbNotification();
- updateUsbStateBroadcastIfNeeded();
- setEnabledFunctions(mCurrentFunctions, true);
- }
-
private void setAdbEnabled(boolean enable) {
if (DEBUG) Slog.d(TAG, "setAdbEnabled: " + enable);
if (enable != mAdbEnabled) {
mAdbEnabled = enable;
+ String oldFunctions = mCurrentFunctions;
- // Due to the persist.sys.usb.config property trigger, changing adb state requires
- // persisting default function
- String oldFunctions = getDefaultFunctions();
- String newFunctions = applyAdbFunction(oldFunctions);
- if (!oldFunctions.equals(newFunctions)) {
- SystemProperties.set(USB_PERSISTENT_CONFIG_PROPERTY, newFunctions);
+ // Persist the adb setting
+ String newFunction = applyAdbFunction(SystemProperties.get(
+ USB_PERSISTENT_CONFIG_PROPERTY, UsbManager.USB_FUNCTION_NONE));
+ SystemProperties.set(USB_PERSISTENT_CONFIG_PROPERTY, newFunction);
+
+ // Remove mtp from the config if file transfer is not enabled
+ if (oldFunctions.equals(UsbManager.USB_FUNCTION_MTP) &&
+ !mUsbDataUnlocked && enable) {
+ oldFunctions = UsbManager.USB_FUNCTION_NONE;
}
- // After persisting them use the lock-down aware function set
- setEnabledFunctions(mCurrentFunctions, false);
+ setEnabledFunctions(oldFunctions, true, mUsbDataUnlocked);
updateAdbNotification();
}
@@ -461,10 +471,17 @@
/**
* Evaluates USB function policies and applies the change accordingly.
*/
- private void setEnabledFunctions(String functions, boolean forceRestart) {
+ private void setEnabledFunctions(String functions, boolean forceRestart,
+ boolean usbDataUnlocked) {
if (DEBUG) Slog.d(TAG, "setEnabledFunctions functions=" + functions + ", "
+ "forceRestart=" + forceRestart);
+ if (usbDataUnlocked != mUsbDataUnlocked) {
+ mUsbDataUnlocked = usbDataUnlocked;
+ updateUsbNotification();
+ forceRestart = true;
+ }
+
// Try to set the enabled functions.
final String oldFunctions = mCurrentFunctions;
final boolean oldFunctionsApplied = mCurrentFunctionsApplied;
@@ -501,7 +518,8 @@
}
private boolean trySetEnabledFunctions(String functions, boolean forceRestart) {
- if (functions == null) {
+ if (functions == null || applyAdbFunction(functions)
+ .equals(UsbManager.USB_FUNCTION_NONE)) {
functions = getDefaultFunctions();
}
functions = applyAdbFunction(functions);
@@ -566,7 +584,7 @@
// make sure accessory mode is off
// and restore default functions
Slog.d(TAG, "exited USB accessory mode");
- setEnabledFunctions(null, false);
+ setEnabledFunctions(null, false, false);
if (mCurrentAccessory != null) {
if (mBootCompleted) {
@@ -583,10 +601,6 @@
if (mBroadcastedIntent == null) {
for (String key : keySet) {
if (intent.getBooleanExtra(key, false)) {
- // MTP function is enabled by default.
- if (UsbManager.USB_FUNCTION_MTP.equals(key)) {
- continue;
- }
return true;
}
}
@@ -699,10 +713,7 @@
case MSG_UPDATE_STATE:
mConnected = (msg.arg1 == 1);
mConfigured = (msg.arg2 == 1);
- if (!mConnected) {
- // When a disconnect occurs, relock access to sensitive user data
- mUsbDataUnlocked = false;
- }
+
updateUsbNotification();
updateAdbNotification();
if (UsbManager.containsFunction(mCurrentFunctions,
@@ -710,7 +721,7 @@
updateCurrentAccessory();
} else if (!mConnected) {
// restore defaults when USB is disconnected
- setEnabledFunctions(null, false);
+ setEnabledFunctions(null, false, false);
}
if (mBootCompleted) {
updateUsbStateBroadcastIfNeeded();
@@ -730,13 +741,10 @@
break;
case MSG_SET_CURRENT_FUNCTIONS:
String functions = (String)msg.obj;
- setEnabledFunctions(functions, false);
+ setEnabledFunctions(functions, false, msg.arg1 == 1);
break;
case MSG_UPDATE_USER_RESTRICTIONS:
- setEnabledFunctions(mCurrentFunctions, false);
- break;
- case MSG_SET_USB_DATA_UNLOCKED:
- setUsbDataUnlocked(msg.arg1 == 1);
+ setEnabledFunctions(mCurrentFunctions, false, mUsbDataUnlocked);
break;
case MSG_SYSTEM_READY:
updateUsbNotification();
@@ -764,8 +772,7 @@
Slog.v(TAG, "Current user switched to " + mCurrentUser
+ "; resetting USB host stack for MTP or PTP");
// avoid leaking sensitive data from previous user
- mUsbDataUnlocked = false;
- setEnabledFunctions(mCurrentFunctions, true);
+ setEnabledFunctions(mCurrentFunctions, true, false);
}
mCurrentUser = msg.arg1;
}
@@ -944,14 +951,10 @@
return UsbManager.containsFunction(SystemProperties.get(USB_CONFIG_PROPERTY), function);
}
- public void setCurrentFunctions(String functions) {
- if (DEBUG) Slog.d(TAG, "setCurrentFunctions(" + functions + ")");
- mHandler.sendMessage(MSG_SET_CURRENT_FUNCTIONS, functions);
- }
-
- public void setUsbDataUnlocked(boolean unlocked) {
- if (DEBUG) Slog.d(TAG, "setUsbDataUnlocked(" + unlocked + ")");
- mHandler.sendMessage(MSG_SET_USB_DATA_UNLOCKED, unlocked);
+ public void setCurrentFunctions(String functions, boolean usbDataUnlocked) {
+ if (DEBUG) Slog.d(TAG, "setCurrentFunctions(" + functions + ", " +
+ usbDataUnlocked + ")");
+ mHandler.sendMessage(MSG_SET_CURRENT_FUNCTIONS, functions, usbDataUnlocked);
}
private void readOemUsbOverrideConfig() {
diff --git a/services/usb/java/com/android/server/usb/UsbService.java b/services/usb/java/com/android/server/usb/UsbService.java
index d6dbe90..daccc00 100644
--- a/services/usb/java/com/android/server/usb/UsbService.java
+++ b/services/usb/java/com/android/server/usb/UsbService.java
@@ -287,7 +287,7 @@
}
@Override
- public void setCurrentFunction(String function) {
+ public void setCurrentFunction(String function, boolean usbDataUnlocked) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
if (!isSupportedCurrentFunction(function)) {
@@ -297,7 +297,7 @@
}
if (mDeviceManager != null) {
- mDeviceManager.setCurrentFunctions(function);
+ mDeviceManager.setCurrentFunctions(function, usbDataUnlocked);
} else {
throw new IllegalStateException("USB device mode not supported");
}
@@ -320,12 +320,6 @@
}
@Override
- public void setUsbDataUnlocked(boolean unlocked) {
- mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
- mDeviceManager.setUsbDataUnlocked(unlocked);
- }
-
- @Override
public void allowUsbDebugging(boolean alwaysAllow, String publicKey) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
mDeviceManager.allowUsbDebugging(alwaysAllow, publicKey);
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 66d704b..f177a41 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -515,9 +515,12 @@
final boolean isUnknown = args.argi2 == 1;
if (!mAreAccountsInitialized) {
Log.d(this, "Enqueueing pre-init request %s", id);
- mPreInitializationConnectionRequests.add(new Runnable() {
+ mPreInitializationConnectionRequests.add(
+ new android.telecom.Logging.Runnable(
+ SESSION_HANDLER + SESSION_CREATE_CONN + ".pICR",
+ null /*lock*/) {
@Override
- public void run() {
+ public void loggedRun() {
createConnection(
connectionManagerPhoneAccount,
id,
@@ -525,7 +528,7 @@
isIncoming,
isUnknown);
}
- });
+ }.prepare());
} else {
createConnection(
connectionManagerPhoneAccount,
@@ -1378,9 +1381,9 @@
public void onResult(
final List<ComponentName> componentNames,
final List<IBinder> services) {
- mHandler.post(new Runnable() {
+ mHandler.post(new android.telecom.Logging.Runnable("oAA.qRCS.oR", null /*lock*/) {
@Override
- public void run() {
+ public void loggedRun() {
for (int i = 0; i < componentNames.size() && i < services.size(); i++) {
mRemoteConnectionManager.addConnectionService(
componentNames.get(i),
@@ -1389,17 +1392,17 @@
onAccountsInitialized();
Log.d(this, "remote connection services found: " + services);
}
- });
+ }.prepare());
}
@Override
public void onError() {
- mHandler.post(new Runnable() {
+ mHandler.post(new android.telecom.Logging.Runnable("oAA.qRCS.oE", null /*lock*/) {
@Override
- public void run() {
+ public void loggedRun() {
mAreAccountsInitialized = true;
}
- });
+ }.prepare());
}
});
}
diff --git a/telecomm/java/android/telecom/Log.java b/telecomm/java/android/telecom/Log.java
index 446bbbb..ced6627 100644
--- a/telecomm/java/android/telecom/Log.java
+++ b/telecomm/java/android/telecom/Log.java
@@ -48,13 +48,13 @@
// Generic tag for all Telecom logging
@VisibleForTesting
public static String TAG = "TelecomFramework";
+ public static boolean DEBUG = isLoggable(android.util.Log.DEBUG);
+ public static boolean INFO = isLoggable(android.util.Log.INFO);
+ public static boolean VERBOSE = isLoggable(android.util.Log.VERBOSE);
+ public static boolean WARN = isLoggable(android.util.Log.WARN);
+ public static boolean ERROR = isLoggable(android.util.Log.ERROR);
private static final boolean FORCE_LOGGING = false; /* STOP SHIP if true */
- public static final boolean DEBUG = isLoggable(android.util.Log.DEBUG);
- public static final boolean INFO = isLoggable(android.util.Log.INFO);
- public static final boolean VERBOSE = isLoggable(android.util.Log.VERBOSE);
- public static final boolean WARN = isLoggable(android.util.Log.WARN);
- public static final boolean ERROR = isLoggable(android.util.Log.ERROR);
// Used to synchronize singleton logging lazy initialization
private static final Object sSingletonSync = new Object();
@@ -340,6 +340,11 @@
public static void setTag(String tag) {
TAG = tag;
+ DEBUG = isLoggable(android.util.Log.DEBUG);
+ INFO = isLoggable(android.util.Log.INFO);
+ VERBOSE = isLoggable(android.util.Log.VERBOSE);
+ WARN = isLoggable(android.util.Log.WARN);
+ ERROR = isLoggable(android.util.Log.ERROR);
}
/**
diff --git a/telecomm/java/android/telecom/Logging/Runnable.java b/telecomm/java/android/telecom/Logging/Runnable.java
index 56c52bf..6e81053 100644
--- a/telecomm/java/android/telecom/Logging/Runnable.java
+++ b/telecomm/java/android/telecom/Logging/Runnable.java
@@ -27,7 +27,7 @@
private Session mSubsession;
private final String mSubsessionName;
- private final Object mLock = new Object();
+ private final Object mLock;
private final java.lang.Runnable mRunnable = new java.lang.Runnable() {
@Override
public void run() {
@@ -45,7 +45,18 @@
}
};
- public Runnable(String subsessionName) {
+ /**
+ * Creates a new Telecom Runnable that incorporates Session Logging into it. Useful for carrying
+ * Logging Sessions through different threads as well as through handlers.
+ * @param subsessionName The name that will be used in the Logs to mark this Session
+ * @param lock The synchronization lock that will be used to lock loggedRun().
+ */
+ public Runnable(String subsessionName, Object lock) {
+ if (lock == null) {
+ mLock = new Object();
+ } else {
+ mLock = lock;
+ }
mSubsessionName = subsessionName;
}
@@ -85,4 +96,4 @@
*/
abstract public void loggedRun();
-}
+}
\ No newline at end of file
diff --git a/telecomm/java/android/telecom/Logging/Session.java b/telecomm/java/android/telecom/Logging/Session.java
index 3a7b8c0..c45bd6b 100644
--- a/telecomm/java/android/telecom/Logging/Session.java
+++ b/telecomm/java/android/telecom/Logging/Session.java
@@ -19,6 +19,7 @@
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telecom.Log;
import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
@@ -26,20 +27,23 @@
import java.util.ArrayList;
/**
- * The session that stores information about a thread's point of entry into the Telecom code that
- * persists until the thread exits Telecom.
+ * Stores information about a thread's point of entry into that should persist until that thread
+ * exits.
* @hide
*/
public class Session {
public static final String START_SESSION = "START_SESSION";
+ public static final String START_EXTERNAL_SESSION = "START_EXTERNAL_SESSION";
public static final String CREATE_SUBSESSION = "CREATE_SUBSESSION";
public static final String CONTINUE_SUBSESSION = "CONTINUE_SUBSESSION";
public static final String END_SUBSESSION = "END_SUBSESSION";
public static final String END_SESSION = "END_SESSION";
public static final String SUBSESSION_SEPARATION_CHAR = "->";
+ public static final String SESSION_SEPARATION_CHAR_CHILD = "_";
public static final String EXTERNAL_INDICATOR = "E-";
+ public static final String TRUNCATE_STRING = "...";
/**
* Initial value of mExecutionEndTimeMs and the final value of {@link #getLocalExecutionTime()}
@@ -49,15 +53,19 @@
public static class Info implements Parcelable {
public final String sessionId;
- public final String shortMethodName;
+ public final String methodPath;
- private Info(String id, String methodName) {
+ private Info(String id, String path) {
sessionId = id;
- shortMethodName = methodName;
+ methodPath = path;
}
public static Info getInfo (Session s) {
- return new Info(s.getFullSessionId(), s.getShortMethodName());
+ // Create Info based on the truncated method path if the session is external, so we do
+ // not get multiple stacking external sessions (unless we have DEBUG level logging or
+ // lower).
+ return new Info(s.getFullSessionId(), s.getFullMethodPath(
+ !Log.DEBUG && s.isSessionExternal()));
}
/** Responsible for creating Info objects for deserialized Parcels. */
@@ -86,7 +94,7 @@
@Override
public void writeToParcel(Parcel destination, int flags) {
destination.writeString(sessionId);
- destination.writeString(shortMethodName);
+ destination.writeString(methodPath);
}
}
@@ -226,7 +234,15 @@
if (parentSession == null) {
return mSessionId;
} else {
- return parentSession.getFullSessionId() + "_" + mSessionId;
+ if (Log.VERBOSE) {
+ return parentSession.getFullSessionId() +
+ // Append "_X" to subsession to show subsession designation.
+ SESSION_SEPARATION_CHAR_CHILD + mSessionId;
+ } else {
+ // Only worry about the base ID at the top of the tree.
+ return parentSession.getFullSessionId();
+ }
+
}
}
@@ -259,16 +275,18 @@
}
// Recursively concatenate mShortMethodName with the parent Sessions to create full method
- // path. Caches this string so that multiple calls for the path will be quick.
- public String getFullMethodPath() {
+ // path. if truncatePath is set to true, all other external sessions (except for the most
+ // recent) will be truncated to "..."
+ public String getFullMethodPath(boolean truncatePath) {
StringBuilder sb = new StringBuilder();
- getFullMethodPath(sb);
+ getFullMethodPath(sb, truncatePath);
return sb.toString();
}
- private synchronized void getFullMethodPath(StringBuilder sb) {
- // Don't calculate if we have already figured it out!
- if (!TextUtils.isEmpty(mFullMethodPathCache)) {
+ private synchronized void getFullMethodPath(StringBuilder sb, boolean truncatePath) {
+ // Return cached value for method path. When returning the truncated path, recalculate the
+ // full path without using the cached value.
+ if (!TextUtils.isEmpty(mFullMethodPathCache) && !truncatePath) {
sb.append(mFullMethodPathCache);
return;
}
@@ -278,25 +296,37 @@
// Check to see if the session has been renamed yet. If it has not, then the session
// has not been continued.
isSessionStarted = !mShortMethodName.equals(parentSession.mShortMethodName);
- parentSession.getFullMethodPath(sb);
+ parentSession.getFullMethodPath(sb, truncatePath);
sb.append(SUBSESSION_SEPARATION_CHAR);
}
// Encapsulate the external session's method name so it is obvious what part of the session
- // is external.
+ // is external or truncate it if we do not want the entire history.
if (isExternal()) {
- sb.append("(");
- sb.append(mShortMethodName);
- sb.append(")");
+ if (truncatePath) {
+ sb.append(TRUNCATE_STRING);
+ } else {
+ sb.append("(");
+ sb.append(mShortMethodName);
+ sb.append(")");
+ }
} else {
sb.append(mShortMethodName);
}
-
- if(isSessionStarted) {
+ // If we are returning the truncated path, do not save that path as the full path.
+ if (isSessionStarted && !truncatePath) {
// Cache this value so that we do not have to do this work next time!
// We do not cache the value if the session being evaluated hasn't been continued yet.
mFullMethodPathCache = sb.toString();
}
}
+ // Recursively move to the top of the tree to see if the parent session is external.
+ private boolean isSessionExternal() {
+ if (getParentSession() == null) {
+ return isExternal();
+ } else {
+ return getParentSession().isSessionExternal();
+ }
+ }
@Override
public int hashCode() {
@@ -350,7 +380,7 @@
return mParentSession.toString();
} else {
StringBuilder methodName = new StringBuilder();
- methodName.append(getFullMethodPath());
+ methodName.append(getFullMethodPath(false /*truncatePath*/));
if (mOwnerInfo != null && !mOwnerInfo.isEmpty()) {
methodName.append("(InCall package: ");
methodName.append(mOwnerInfo);
diff --git a/telecomm/java/android/telecom/Logging/SessionManager.java b/telecomm/java/android/telecom/Logging/SessionManager.java
index 8ced7f81..949f7b7 100644
--- a/telecomm/java/android/telecom/Logging/SessionManager.java
+++ b/telecomm/java/android/telecom/Logging/SessionManager.java
@@ -177,8 +177,9 @@
}
// Create Session from Info and add to the sessionMapper under this ID.
+ Log.d(LOGGING_TAG, Session.START_EXTERNAL_SESSION);
Session externalSession = new Session(Session.EXTERNAL_INDICATOR + sessionInfo.sessionId,
- sessionInfo.shortMethodName, System.currentTimeMillis(),
+ sessionInfo.methodPath, System.currentTimeMillis(),
false /*isStartedFromActiveSession*/, null);
externalSession.setIsExternal(true);
// Mark the external session as already completed, since we have no way of knowing when
@@ -190,8 +191,6 @@
// Create a subsession from this external Session parent node
Session childSession = createSubsession();
continueSession(childSession, shortMethodName);
-
- Log.d(LOGGING_TAG, Session.START_SESSION);
}
/**
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 465addf..da87135 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -66,6 +66,93 @@
* supported by the access point.
*/
public String capabilities;
+
+ /**
+ * @hide
+ * No security protocol.
+ */
+ public static final int PROTOCOL_NONE = 0;
+ /**
+ * @hide
+ * Security protocol type: WPA version 1.
+ */
+ public static final int PROTOCOL_WPA = 1;
+ /**
+ * @hide
+ * Security protocol type: WPA version 2, also called RSN.
+ */
+ public static final int PROTOCOL_WPA2 = 2;
+ /**
+ * @hide
+ * Security protocol type:
+ * OSU Server-only authenticated layer 2 Encryption Network.
+ * Used for Hotspot 2.0.
+ */
+ public static final int PROTOCOL_OSEN = 3;
+
+ /**
+ * @hide
+ * No security key management scheme.
+ */
+ public static final int KEY_MGMT_NONE = 0;
+ /**
+ * @hide
+ * Security key management scheme: PSK.
+ */
+ public static final int KEY_MGMT_PSK = 1;
+ /**
+ * @hide
+ * Security key management scheme: EAP.
+ */
+ public static final int KEY_MGMT_EAP = 2;
+ /**
+ * @hide
+ * Security key management scheme: FT_PSK.
+ */
+ public static final int KEY_MGMT_FT_PSK = 3;
+ /**
+ * @hide
+ * Security key management scheme: FT_EAP.
+ */
+ public static final int KEY_MGMT_FT_EAP = 4;
+ /**
+ * @hide
+ * Security key management scheme: PSK_SHA256
+ */
+ public static final int KEY_MGMT_PSK_SHA256 = 5;
+ /**
+ * @hide
+ * Security key management scheme: EAP_SHA256.
+ */
+ public static final int KEY_MGMT_EAP_SHA256 = 6;
+ /**
+ * @hide
+ * Security key management scheme: OSEN.
+ * Used for Hotspot 2.0.
+ */
+ public static final int KEY_MGMT_OSEN = 7;
+
+ /**
+ * @hide
+ * No cipher suite.
+ */
+ public static final int CIPHER_NONE = 0;
+ /**
+ * @hide
+ * No group addressed, only used for group data cipher.
+ */
+ public static final int CIPHER_NO_GROUP_ADDRESSED = 1;
+ /**
+ * @hide
+ * Cipher suite: TKIP
+ */
+ public static final int CIPHER_TKIP = 2;
+ /**
+ * @hide
+ * Cipher suite: CCMP
+ */
+ public static final int CIPHER_CCMP = 3;
+
/**
* The detected signal level in dBm, also known as the RSSI.
*