Merge "Fix MediaRouter prioritization around a2dp devices" into jb-mr1-dev
diff --git a/api/17.txt b/api/17.txt
index bebd566..9af3b49 100644
--- a/api/17.txt
+++ b/api/17.txt
@@ -18905,7 +18905,7 @@
field public static final deprecated java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
field public static final java.lang.String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
field public static final java.lang.String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
- field public static final java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
+ field public static final deprecated java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
field public static final java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
field public static final deprecated java.lang.String LOGGING_ID = "logging_id";
field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference";
diff --git a/api/current.txt b/api/current.txt
index bebd566..9af3b49 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -18905,7 +18905,7 @@
field public static final deprecated java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
field public static final java.lang.String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
field public static final java.lang.String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
- field public static final java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
+ field public static final deprecated java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
field public static final java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
field public static final deprecated java.lang.String LOGGING_ID = "logging_id";
field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference";
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index dae38db..5cde65c 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -35,6 +35,7 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.RegisteredServicesCache;
import android.content.pm.RegisteredServicesCacheListener;
+import android.content.pm.UserInfo;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
@@ -54,6 +55,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
+import android.util.Slog;
import android.util.SparseArray;
import com.android.internal.R;
@@ -70,6 +72,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -261,8 +264,7 @@
accounts = new UserAccounts(mContext, userId);
mUsers.append(userId, accounts);
purgeOldGrants(accounts);
- mAuthenticatorCache.invalidateCache(accounts.userId);
- validateAccountsAndPopulateCache(accounts);
+ validateAccountsInternal(accounts, true /* invalidateAuthenticatorCache */);
}
return accounts;
}
@@ -300,7 +302,28 @@
}
}
- private void validateAccountsAndPopulateCache(UserAccounts accounts) {
+ /**
+ * Validate internal set of accounts against installed authenticators for
+ * given user. Clears cached authenticators before validating.
+ */
+ public void validateAccounts(int userId) {
+ final UserAccounts accounts = getUserAccounts(userId);
+
+ // Invalidate user-specific cache to make sure we catch any
+ // removed authenticators.
+ validateAccountsInternal(accounts, true /* invalidateAuthenticatorCache */);
+ }
+
+ /**
+ * Validate internal set of accounts against installed authenticators for
+ * given user. Clear cached authenticators before validating when requested.
+ */
+ private void validateAccountsInternal(
+ UserAccounts accounts, boolean invalidateAuthenticatorCache) {
+ if (invalidateAuthenticatorCache) {
+ mAuthenticatorCache.invalidateCache(accounts.userId);
+ }
+
final HashSet<AuthenticatorDescription> knownAuth = Sets.newHashSet();
for (RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> service :
mAuthenticatorCache.getAllServices(accounts.userId)) {
@@ -323,7 +346,7 @@
final String accountName = cursor.getString(2);
if (!knownAuth.contains(AuthenticatorDescription.newKey(accountType))) {
- Log.d(TAG, "deleting account " + accountName + " because type "
+ Slog.w(TAG, "deleting account " + accountName + " because type "
+ accountType + " no longer has a registered authenticator");
db.delete(TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId, null);
accountDeleted = true;
@@ -399,7 +422,8 @@
@Override
public void onServiceChanged(AuthenticatorDescription desc, int userId, boolean removed) {
- validateAccountsAndPopulateCache(getUserAccounts(userId));
+ Slog.d(TAG, "onServiceChanged() for userId " + userId);
+ validateAccountsInternal(getUserAccounts(userId), false /* invalidateAuthenticatorCache */);
}
public String getPassword(Account account) {
@@ -1493,10 +1517,23 @@
// Running in system_server; should never happen
throw new RuntimeException(e);
}
+ return getAccounts(runningUserIds);
+ }
+ /** {@hide} */
+ public AccountAndUser[] getAllAccounts() {
+ final List<UserInfo> users = getUserManager().getUsers();
+ final int[] userIds = new int[users.size()];
+ for (int i = 0; i < userIds.length; i++) {
+ userIds[i] = users.get(i).id;
+ }
+ return getAccounts(userIds);
+ }
+
+ private AccountAndUser[] getAccounts(int[] userIds) {
final ArrayList<AccountAndUser> runningAccounts = Lists.newArrayList();
synchronized (mUsers) {
- for (int userId : runningUserIds) {
+ for (int userId : userIds) {
UserAccounts userAccounts = getUserAccounts(userId);
if (userAccounts == null) continue;
synchronized (userAccounts.cacheLock) {
@@ -2006,6 +2043,7 @@
return false;
}
+ @Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {
@@ -2015,17 +2053,15 @@
return;
}
final boolean isCheckinRequest = scanArgs(args, "--checkin") || scanArgs(args, "-c");
+ final IndentingPrintWriter ipw = new IndentingPrintWriter(fout, " ");
- fout = new IndentingPrintWriter(fout, " ");
- int size = mUsers.size();
- for (int i = 0; i < size; i++) {
- fout.println("User " + mUsers.keyAt(i) + ":");
- ((IndentingPrintWriter) fout).increaseIndent();
- dumpUser(mUsers.valueAt(i), fd, fout, args, isCheckinRequest);
- ((IndentingPrintWriter) fout).decreaseIndent();
- if (i < size - 1) {
- fout.println();
- }
+ final List<UserInfo> users = getUserManager().getUsers();
+ for (UserInfo user : users) {
+ ipw.println("User " + user + ":");
+ ipw.increaseIndent();
+ dumpUser(getUserAccounts(user.id), fd, ipw, args, isCheckinRequest);
+ ipw.println();
+ ipw.decreaseIndent();
}
}
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 6e2278d..6fdf3b4 100755
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -45,6 +45,7 @@
public final class BluetoothA2dp implements BluetoothProfile {
private static final String TAG = "BluetoothA2dp";
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/**
* Intent used to broadcast the change in connection state of the A2DP
@@ -113,7 +114,7 @@
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
if (!up) {
- if (DBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {
try {
mService = null;
@@ -126,7 +127,7 @@
synchronized (mConnection) {
try {
if (mService == null) {
- if (DBG) Log.d(TAG,"Binding service...");
+ if (VDBG) Log.d(TAG,"Binding service...");
if (!mContext.bindService(new Intent(IBluetoothA2dp.class.getName()), mConnection, 0)) {
Log.e(TAG, "Could not bind to Bluetooth A2DP Service");
}
@@ -269,7 +270,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getConnectedDevices() {
- if (DBG) log("getConnectedDevices()");
+ if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
try {
return mService.getConnectedDevices();
@@ -286,7 +287,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
- if (DBG) log("getDevicesMatchingStates()");
+ if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
try {
return mService.getDevicesMatchingConnectionStates(states);
@@ -303,7 +304,7 @@
* {@inheritDoc}
*/
public int getConnectionState(BluetoothDevice device) {
- if (DBG) log("getState(" + device + ")");
+ if (VDBG) log("getState(" + device + ")");
if (mService != null && isEnabled()
&& isValidDevice(device)) {
try {
@@ -365,7 +366,7 @@
* @hide
*/
public int getPriority(BluetoothDevice device) {
- if (DBG) log("getPriority(" + device + ")");
+ if (VDBG) log("getPriority(" + device + ")");
if (mService != null && isEnabled()
&& isValidDevice(device)) {
try {
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 541b69f..793d798 100755
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -46,6 +46,7 @@
public final class BluetoothHeadset implements BluetoothProfile {
private static final String TAG = "BluetoothHeadset";
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/**
* Intent used to broadcast the change in connection state of the Headset
@@ -226,7 +227,7 @@
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
if (!up) {
- if (DBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {
try {
mService = null;
@@ -239,7 +240,7 @@
synchronized (mConnection) {
try {
if (mService == null) {
- if (DBG) Log.d(TAG,"Binding service...");
+ if (VDBG) Log.d(TAG,"Binding service...");
if (!mContext.bindService(new Intent(IBluetoothHeadset.class.getName()), mConnection, 0)) {
Log.e(TAG, "Could not bind to Bluetooth Headset Service");
}
@@ -281,7 +282,7 @@
* are ok.
*/
/*package*/ void close() {
- if (DBG) log("close()");
+ if (VDBG) log("close()");
IBluetoothManager mgr = mAdapter.getBluetoothManager();
if (mgr != null) {
@@ -387,7 +388,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getConnectedDevices() {
- if (DBG) log("getConnectedDevices()");
+ if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
try {
return mService.getConnectedDevices();
@@ -404,7 +405,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
- if (DBG) log("getDevicesMatchingStates()");
+ if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
try {
return mService.getDevicesMatchingConnectionStates(states);
@@ -421,7 +422,7 @@
* {@inheritDoc}
*/
public int getConnectionState(BluetoothDevice device) {
- if (DBG) log("getConnectionState(" + device + ")");
+ if (VDBG) log("getConnectionState(" + device + ")");
if (mService != null && isEnabled() &&
isValidDevice(device)) {
try {
@@ -483,7 +484,7 @@
* @hide
*/
public int getPriority(BluetoothDevice device) {
- if (DBG) log("getPriority(" + device + ")");
+ if (VDBG) log("getPriority(" + device + ")");
if (mService != null && isEnabled() &&
isValidDevice(device)) {
try {
@@ -566,7 +567,7 @@
* false otherwise or on error
*/
public boolean isAudioConnected(BluetoothDevice device) {
- if (DBG) log("isAudioConnected()");
+ if (VDBG) log("isAudioConnected()");
if (mService != null && isEnabled() &&
isValidDevice(device)) {
try {
@@ -594,7 +595,7 @@
* @hide
*/
public int getBatteryUsageHint(BluetoothDevice device) {
- if (DBG) log("getBatteryUsageHint()");
+ if (VDBG) log("getBatteryUsageHint()");
if (mService != null && isEnabled() &&
isValidDevice(device)) {
try {
@@ -661,7 +662,7 @@
* @hide
*/
public int getAudioState(BluetoothDevice device) {
- if (DBG) log("getAudioState");
+ if (VDBG) log("getAudioState");
if (mService != null && !isDisabled()) {
try {
return mService.getAudioState(device);
@@ -683,7 +684,7 @@
* @hide
*/
public boolean isAudioOn() {
- if (DBG) log("isAudioOn()");
+ if (VDBG) log("isAudioOn()");
if (mService != null && isEnabled()) {
try {
return mService.isAudioOn();
diff --git a/core/java/android/bluetooth/BluetoothHealth.java b/core/java/android/bluetooth/BluetoothHealth.java
index 4a0bc7e..cb23662 100644
--- a/core/java/android/bluetooth/BluetoothHealth.java
+++ b/core/java/android/bluetooth/BluetoothHealth.java
@@ -58,6 +58,7 @@
public final class BluetoothHealth implements BluetoothProfile {
private static final String TAG = "BluetoothHealth";
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/**
* Health Profile Source Role - the health device.
@@ -102,7 +103,7 @@
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
if (!up) {
- if (DBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {
try {
mService = null;
@@ -115,7 +116,7 @@
synchronized (mConnection) {
try {
if (mService == null) {
- if (DBG) Log.d(TAG,"Binding service...");
+ if (VDBG) Log.d(TAG,"Binding service...");
if (!mContext.bindService(new Intent(IBluetoothHealth.class.getName()), mConnection, 0)) {
Log.e(TAG, "Could not bind to Bluetooth Health Service");
}
@@ -148,7 +149,7 @@
BluetoothHealthCallback callback) {
if (!isEnabled() || name == null) return false;
- if (DBG) log("registerSinkApplication(" + name + ":" + dataType + ")");
+ if (VDBG) log("registerSinkApplication(" + name + ":" + dataType + ")");
return registerAppConfiguration(name, dataType, SINK_ROLE,
CHANNEL_TYPE_ANY, callback);
}
@@ -174,7 +175,7 @@
boolean result = false;
if (!isEnabled() || !checkAppParam(name, role, channelType, callback)) return result;
- if (DBG) log("registerApplication(" + name + ":" + dataType + ")");
+ if (VDBG) log("registerApplication(" + name + ":" + dataType + ")");
BluetoothHealthCallbackWrapper wrapper = new BluetoothHealthCallbackWrapper(callback);
BluetoothHealthAppConfiguration config =
new BluetoothHealthAppConfiguration(name, dataType, role, channelType);
@@ -488,7 +489,7 @@
}
/*package*/ void close() {
- if (DBG) log("close()");
+ if (VDBG) log("close()");
IBluetoothManager mgr = mAdapter.getBluetoothManager();
if (mgr != null) {
try {
diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java
index bff966d..db7e424 100755
--- a/core/java/android/bluetooth/BluetoothInputDevice.java
+++ b/core/java/android/bluetooth/BluetoothInputDevice.java
@@ -45,6 +45,7 @@
public final class BluetoothInputDevice implements BluetoothProfile {
private static final String TAG = "BluetoothInputDevice";
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/**
* Intent used to broadcast the change in connection state of the Input
@@ -191,7 +192,7 @@
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
if (!up) {
- if (DBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {
try {
mService = null;
@@ -204,7 +205,7 @@
synchronized (mConnection) {
try {
if (mService == null) {
- if (DBG) Log.d(TAG,"Binding service...");
+ if (VDBG) Log.d(TAG,"Binding service...");
if (!mContext.bindService(new Intent(IBluetoothInputDevice.class.getName()), mConnection, 0)) {
Log.e(TAG, "Could not bind to Bluetooth HID Service");
}
@@ -243,7 +244,7 @@
}
/*package*/ void close() {
- if (DBG) log("close()");
+ if (VDBG) log("close()");
IBluetoothManager mgr = mAdapter.getBluetoothManager();
if (mgr != null) {
try {
@@ -344,7 +345,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getConnectedDevices() {
- if (DBG) log("getConnectedDevices()");
+ if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
try {
return mService.getConnectedDevices();
@@ -361,7 +362,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
- if (DBG) log("getDevicesMatchingStates()");
+ if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
try {
return mService.getDevicesMatchingConnectionStates(states);
@@ -378,7 +379,7 @@
* {@inheritDoc}
*/
public int getConnectionState(BluetoothDevice device) {
- if (DBG) log("getState(" + device + ")");
+ if (VDBG) log("getState(" + device + ")");
if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getConnectionState(device);
@@ -438,7 +439,7 @@
* @hide
*/
public int getPriority(BluetoothDevice device) {
- if (DBG) log("getPriority(" + device + ")");
+ if (VDBG) log("getPriority(" + device + ")");
if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getPriority(device);
@@ -519,7 +520,7 @@
* @hide
*/
public boolean getProtocolMode(BluetoothDevice device) {
- if (DBG) log("getProtocolMode(" + device + ")");
+ if (VDBG) log("getProtocolMode(" + device + ")");
if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getProtocolMode(device);
@@ -570,7 +571,7 @@
* @hide
*/
public boolean getReport(BluetoothDevice device, byte reportType, byte reportId, int bufferSize) {
- if (DBG) log("getReport(" + device + "), reportType=" + reportType + " reportId=" + reportId + "bufferSize=" + bufferSize);
+ if (VDBG) log("getReport(" + device + "), reportType=" + reportType + " reportId=" + reportId + "bufferSize=" + bufferSize);
if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getReport(device, reportType, reportId, bufferSize);
diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java
index cae7a73..e25ec86 100644
--- a/core/java/android/bluetooth/BluetoothPan.java
+++ b/core/java/android/bluetooth/BluetoothPan.java
@@ -44,6 +44,7 @@
public final class BluetoothPan implements BluetoothProfile {
private static final String TAG = "BluetoothPan";
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/**
* Intent used to broadcast the change in connection state of the Pan
@@ -145,7 +146,7 @@
}
/*package*/ void close() {
- if (DBG) log("close()");
+ if (VDBG) log("close()");
if (mConnection != null) {
mContext.unbindService(mConnection);
mConnection = null;
@@ -175,7 +176,7 @@
}
Log.d(TAG, "BluetoothPan(), bindService called");
} else {
- if (DBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {
try {
mPanService = null;
@@ -266,7 +267,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getConnectedDevices() {
- if (DBG) log("getConnectedDevices()");
+ if (VDBG) log("getConnectedDevices()");
if (mPanService != null && isEnabled()) {
try {
return mPanService.getConnectedDevices();
@@ -283,7 +284,7 @@
* {@inheritDoc}
*/
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
- if (DBG) log("getDevicesMatchingStates()");
+ if (VDBG) log("getDevicesMatchingStates()");
if (mPanService != null && isEnabled()) {
try {
return mPanService.getDevicesMatchingConnectionStates(states);
@@ -300,7 +301,7 @@
* {@inheritDoc}
*/
public int getConnectionState(BluetoothDevice device) {
- if (DBG) log("getState(" + device + ")");
+ if (VDBG) log("getState(" + device + ")");
if (mPanService != null && isEnabled()
&& isValidDevice(device)) {
try {
@@ -324,7 +325,7 @@
}
public boolean isTetheringOn() {
- if (DBG) log("isTetheringOn()");
+ if (VDBG) log("isTetheringOn()");
try {
return mPanService.isTetheringOn();
} catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java
index 7de2ef6..b5280e5 100755
--- a/core/java/android/bluetooth/BluetoothPbap.java
+++ b/core/java/android/bluetooth/BluetoothPbap.java
@@ -51,7 +51,8 @@
public class BluetoothPbap {
private static final String TAG = "BluetoothPbap";
- private static final boolean DBG = false;
+ private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/** int extra for PBAP_STATE_CHANGED_ACTION */
public static final String PBAP_STATE =
@@ -114,7 +115,7 @@
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
if (!up) {
- if (DBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG,"Unbinding service...");
synchronized (mConnection) {
try {
mService = null;
@@ -127,7 +128,7 @@
synchronized (mConnection) {
try {
if (mService == null) {
- if (DBG) Log.d(TAG,"Binding service...");
+ if (VDBG) Log.d(TAG,"Binding service...");
if (!mContext.bindService(
new Intent(IBluetoothPbap.class.getName()),
mConnection, 0)) {
@@ -206,7 +207,7 @@
* object is currently not connected to the Pbap service.
*/
public int getState() {
- if (DBG) log("getState()");
+ if (VDBG) log("getState()");
if (mService != null) {
try {
return mService.getState();
@@ -225,7 +226,7 @@
* the Pbap service.
*/
public BluetoothDevice getClient() {
- if (DBG) log("getClient()");
+ if (VDBG) log("getClient()");
if (mService != null) {
try {
return mService.getClient();
@@ -243,7 +244,7 @@
* object is not currently connected to the Pbap service.
*/
public boolean isConnected(BluetoothDevice device) {
- if (DBG) log("isConnected(" + device + ")");
+ if (VDBG) log("isConnected(" + device + ")");
if (mService != null) {
try {
return mService.isConnected(device);
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index 1bc640f..aba8710 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -72,6 +72,8 @@
*/
public final class BluetoothSocket implements Closeable {
private static final String TAG = "BluetoothSocket";
+ private static final boolean DBG = true;
+ private static final boolean VDBG = false;
/** @hide */
public static final int MAX_RFCOMM_CHANNEL = 30;
@@ -172,7 +174,7 @@
BluetoothSocket as = new BluetoothSocket(this);
as.mSocketState = SocketState.CONNECTED;
FileDescriptor[] fds = mSocket.getAncillaryFileDescriptors();
- Log.d(TAG, "socket fd passed by stack fds: " + fds);
+ if (VDBG) Log.d(TAG, "socket fd passed by stack fds: " + fds);
if(fds == null || fds.length != 1) {
Log.e(TAG, "socket fd passed from stack failed, fds: " + fds);
throw new IOException("bt socket acept failed");
@@ -291,7 +293,7 @@
mUuid, mPort, getSecurityFlags());
synchronized(this)
{
- Log.d(TAG, "connect(), SocketState: " + mSocketState + ", mPfd: " + mPfd);
+ if (DBG) Log.d(TAG, "connect(), SocketState: " + mSocketState + ", mPfd: " + mPfd);
if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed");
if (mPfd == null) throw new IOException("bt socket connect failed");
FileDescriptor fd = mPfd.getFileDescriptor();
@@ -339,23 +341,24 @@
// read out port number
try {
synchronized(this) {
- Log.d(TAG, "bindListen(), SocketState: " + mSocketState + ", mPfd: " + mPfd);
+ if (VDBG) Log.d(TAG, "bindListen(), SocketState: " + mSocketState + ", mPfd: " +
+ mPfd);
if(mSocketState != SocketState.INIT) return EBADFD;
if(mPfd == null) return -1;
FileDescriptor fd = mPfd.getFileDescriptor();
- Log.d(TAG, "bindListen(), new LocalSocket ");
+ if (VDBG) Log.d(TAG, "bindListen(), new LocalSocket ");
mSocket = new LocalSocket(fd);
- Log.d(TAG, "bindListen(), new LocalSocket.getInputStream() ");
+ if (VDBG) Log.d(TAG, "bindListen(), new LocalSocket.getInputStream() ");
mSocketIS = mSocket.getInputStream();
mSocketOS = mSocket.getOutputStream();
}
- Log.d(TAG, "bindListen(), readInt mSocketIS: " + mSocketIS);
+ if (VDBG) Log.d(TAG, "bindListen(), readInt mSocketIS: " + mSocketIS);
int channel = readInt(mSocketIS);
synchronized(this) {
if(mSocketState == SocketState.INIT)
mSocketState = SocketState.LISTENING;
}
- Log.d(TAG, "channel: " + channel);
+ if (VDBG) Log.d(TAG, "channel: " + channel);
if (mPort == -1) {
mPort = channel;
} // else ASSERT(mPort == channel)
@@ -385,26 +388,26 @@
}
/*package*/ int available() throws IOException {
- Log.d(TAG, "available: " + mSocketIS);
+ if (VDBG) Log.d(TAG, "available: " + mSocketIS);
return mSocketIS.available();
}
/*package*/ int read(byte[] b, int offset, int length) throws IOException {
- Log.d(TAG, "read in: " + mSocketIS + " len: " + length);
+ if (VDBG) Log.d(TAG, "read in: " + mSocketIS + " len: " + length);
int ret = mSocketIS.read(b, offset, length);
if(ret < 0)
throw new IOException("bt socket closed, read return: " + ret);
- Log.d(TAG, "read out: " + mSocketIS + " ret: " + ret);
+ if (VDBG) Log.d(TAG, "read out: " + mSocketIS + " ret: " + ret);
return ret;
}
/*package*/ int write(byte[] b, int offset, int length) throws IOException {
- Log.d(TAG, "write: " + mSocketOS + " length: " + length);
+ if (VDBG) Log.d(TAG, "write: " + mSocketOS + " length: " + length);
mSocketOS.write(b, offset, length);
// There is no good way to confirm since the entire process is asynchronous anyway
- Log.d(TAG, "write out: " + mSocketOS + " length: " + length);
+ if (VDBG) Log.d(TAG, "write out: " + mSocketOS + " length: " + length);
return length;
}
@@ -420,10 +423,10 @@
if(mSocketState == SocketState.CLOSED)
return;
mSocketState = SocketState.CLOSED;
- Log.d(TAG, "close() this: " + this + ", channel: " + mPort + ", mSocketIS: " + mSocketIS +
+ if (VDBG) Log.d(TAG, "close() this: " + this + ", channel: " + mPort + ", mSocketIS: " + mSocketIS +
", mSocketOS: " + mSocketOS + "mSocket: " + mSocket);
if(mSocket != null) {
- Log.d(TAG, "Closing mSocket: " + mSocket);
+ if (VDBG) Log.d(TAG, "Closing mSocket: " + mSocket);
mSocket.shutdownInput();
mSocket.shutdownOutput();
mSocket.close();
@@ -449,7 +452,7 @@
private String waitSocketSignal(InputStream is) throws IOException {
byte [] sig = new byte[SOCK_SIGNAL_SIZE];
int ret = readAll(is, sig);
- Log.d(TAG, "waitSocketSignal read 16 bytes signal ret: " + ret);
+ if (VDBG) Log.d(TAG, "waitSocketSignal read 16 bytes signal ret: " + ret);
ByteBuffer bb = ByteBuffer.wrap(sig);
bb.order(ByteOrder.nativeOrder());
int size = bb.getShort();
@@ -458,7 +461,7 @@
int channel = bb.getInt();
int status = bb.getInt();
String RemoteAddr = convertAddr(addr);
- Log.d(TAG, "waitSocketSignal: sig size: " + size + ", remote addr: "
+ if (VDBG) Log.d(TAG, "waitSocketSignal: sig size: " + size + ", remote addr: "
+ RemoteAddr + ", channel: " + channel + ", status: " + status);
if(status != 0)
throw new IOException("Connection failure, status: " + status);
@@ -481,7 +484,7 @@
private int readInt(InputStream is) throws IOException {
byte[] ibytes = new byte[4];
int ret = readAll(is, ibytes);
- Log.d(TAG, "inputStream.read ret: " + ret);
+ if (VDBG) Log.d(TAG, "inputStream.read ret: " + ret);
ByteBuffer bb = ByteBuffer.wrap(ibytes);
bb.order(ByteOrder.nativeOrder());
return bb.getInt();
diff --git a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
index 30406e9..063e5a8 100644
--- a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
+++ b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
@@ -51,6 +51,8 @@
public class BluetoothTetheringDataTracker implements NetworkStateTracker {
private static final String NETWORKTYPE = "BLUETOOTH_TETHER";
private static final String TAG = "BluetoothTethering";
+ private static final boolean DBG = true;
+ private static final boolean VDBG = false;
private AtomicBoolean mTeardownRequested = new AtomicBoolean(false);
private AtomicBoolean mPrivateDnsRouteSet = new AtomicBoolean(false);
@@ -99,10 +101,10 @@
* Begin monitoring connectivity
*/
public void startMonitoring(Context context, Handler target) {
- Log.d(TAG, "startMonitoring: target: " + target);
+ if (DBG) Log.d(TAG, "startMonitoring: target: " + target);
mContext = context;
mCsHandler = target;
- Log.d(TAG, "startMonitoring: mCsHandler: " + mCsHandler);
+ if (VDBG) Log.d(TAG, "startMonitoring: mCsHandler: " + mCsHandler);
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (adapter != null) {
adapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.PAN);
@@ -310,31 +312,31 @@
}
public synchronized void startReverseTether(String iface) {
mIface = iface;
- Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
+ if (DBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
mDhcpThread = new Thread(new Runnable() {
public void run() {
//TODO(): Add callbacks for failure and success case.
//Currently this thread runs independently.
- Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
+ if (DBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
String DhcpResultName = "dhcp." + mIface + ".result";;
String result = "";
- Log.d(TAG, "waiting for change of sys prop dhcp result: " + DhcpResultName);
+ if (VDBG) Log.d(TAG, "waiting for change of sys prop dhcp result: " + DhcpResultName);
for(int i = 0; i < 30*5; i++) {
try { Thread.sleep(200); } catch (InterruptedException ie) { return;}
result = SystemProperties.get(DhcpResultName);
- Log.d(TAG, "read " + DhcpResultName + ": " + result);
+ if (VDBG) Log.d(TAG, "read " + DhcpResultName + ": " + result);
if(result.equals("failed")) {
Log.e(TAG, "startReverseTether, failed to start dhcp service");
return;
}
if(result.equals("ok")) {
- Log.d(TAG, "startReverseTether, dhcp resut: " + result);
+ if (VDBG) Log.d(TAG, "startReverseTether, dhcp resut: " + result);
if(readLinkProperty(mIface)) {
mNetworkInfo.setIsAvailable(true);
mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null);
- Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
+ if (VDBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
if(mCsHandler != null) {
Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
msg.sendToTarget();
@@ -346,7 +348,7 @@
return;
}
}
- Log.d(TAG, "startReverseTether, dhcp failed, resut: " + result);
+ Log.e(TAG, "startReverseTether, dhcp failed, resut: " + result);
}
});
mDhcpThread.start();
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 053cc6f..93c9526 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -889,6 +889,9 @@
}
private void onUserStarting(int userId) {
+ // Make sure that accounts we're about to use are valid
+ AccountManagerService.getSingleton().validateAccounts(userId);
+
mSyncAdapters.invalidateCache(userId);
updateRunningAccounts();
@@ -1078,9 +1081,9 @@
}
pw.print("memory low: "); pw.println(mStorageIsLow);
- final AccountAndUser[] accounts = mRunningAccounts;
+ final AccountAndUser[] accounts = AccountManagerService.getSingleton().getAllAccounts();
- pw.print("running accounts: ");
+ pw.print("accounts: ");
if (accounts != INITIAL_ACCOUNTS_ARRAY) {
pw.println(accounts.length);
} else {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 3c4a8fe..00ea873 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3197,10 +3197,16 @@
public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
/**
- * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
+ * Whether lock pattern will vibrate as user enters (0 = false, 1 =
+ * true)
+ *
+ * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
+ * lockscreen uses
+ * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
*/
- public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
- "lock_pattern_tactile_feedback_enabled";
+ @Deprecated
+ public static final String
+ LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
/**
* This preference allows the device to be locked given time after screen goes off,
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index b6f0862..2f31ebd 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -648,6 +648,8 @@
int largestChildHeight = Integer.MIN_VALUE;
+ final int layoutDirection = getLayoutDirection();
+
// See how tall everyone is. Also remember max width.
for (int i = 0; i < count; ++i) {
final View child = getVirtualChildAt(i);
@@ -667,6 +669,7 @@
}
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) child.getLayoutParams();
+ lp.onResolveLayoutDirection(layoutDirection);
totalWeight += lp.weight;
@@ -989,6 +992,8 @@
int largestChildWidth = Integer.MIN_VALUE;
+ final int layoutDirection = getLayoutDirection();
+
// See how wide everyone is. Also remember max height.
for (int i = 0; i < count; ++i) {
final View child = getVirtualChildAt(i);
@@ -1009,6 +1014,7 @@
final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
child.getLayoutParams();
+ lp.onResolveLayoutDirection(layoutDirection);
totalWeight += lp.weight;
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index d14b1ee..3f40f20 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -949,14 +949,8 @@
* @return Whether tactile feedback for the pattern is enabled.
*/
public boolean isTactileFeedbackEnabled() {
- return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, false);
- }
-
- /**
- * Set whether tactile feedback for the pattern is enabled.
- */
- public void setTactileFeedbackEnabled(boolean enabled) {
- setBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, enabled);
+ return Settings.System.getIntForUser(mContentResolver,
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
}
/**
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 1c71e64..72de22c 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3936,7 +3936,7 @@
</string>
<!-- Text spoken when the user is performing a gesture that will enable accessibility. [CHAR LIMIT=none] -->
- <string name="continue_to_enable_accessibility">Keep holding down your two fingers to enable accessibility.</string>
+ <string name="continue_to_enable_accessibility">Keep holding down two fingers to enable accessibility.</string>
<!-- Text spoken when the user enabled accessibility. [CHAR LIMIT=none] -->
<string name="accessibility_enabled">Accessibility enabled.</string>
<!-- Text spoken when the user stops preforming a gesture that would enable accessibility. [CHAR LIMIT=none] -->
diff --git a/docs/html/guide/google/gcm/adv.jd b/docs/html/guide/google/gcm/adv.jd
index aa66e25..356ee1d 100644
--- a/docs/html/guide/google/gcm/adv.jd
+++ b/docs/html/guide/google/gcm/adv.jd
@@ -163,7 +163,7 @@
<p>There are two ways to unregister a device from GCM: manually and automatically.</p>
<p>An Android application can manually unregister itself by issuing a <code>com.google.android.c2dm.intent.UNREGISTER</code> intent, which is useful when the application offers a logoff feature (so it can unregister on logoff and register again on logon). See the <a href="gcm.html#unregistering">Architectural Overview</a> for more discussion of this topic. This is the sequence of events when an application unregisters itself:</p>
<ol>
- <li> The application issues a <code>com.google.android.c2dm.intent.UNREGISTER</code> intent, passing the registration ID (the application should have saved its registration ID when it received the proper <code>com.google.android.c2dm.intent.REGISTRATION</code> intent).</li>
+ <li> The application issues a <code>com.google.android.c2dm.intent.UNREGISTER</code> intent, passing the package name as an extra.</li>
<li>When the GCM server is done with the unregistration, it sends a <code>com.google.android.c2dm.intent.REGISTRATION</code> intent with the <code>unregistered</code> extra set.</li>
<li>The application then must contact the 3rd-party server so it can remove the registration ID.</li>
<li>The application should also clear its registration ID.
@@ -174,7 +174,7 @@
<li>The end user uninstalls the application.</li>
<li>The 3rd-party server sends a message to GCM server.</li>
<li>The GCM server sends the message to the device.</li>
- <li>The GCM client receives the message and queries Package Manager about whether there are broadcast receivers configured to receive it, which returns <code>false</code>.
+ <li>The GCM client receives the message and queries Package Manager about whether there are broadcast receivers configured to receive it, which returns <code>false</code>.
</li>
<li>The GCM client informs the GCM server that the application was uninstalled.</li>
<li>The GCM server marks the registration ID for deletion.</li>
@@ -183,6 +183,9 @@
<li>The 3rd-party deletes the registration ID.
</li>
</ol>
+
+<p class ="note"><strong>Note:</strong> The GCM client is the Google Cloud Messaging framework present on the device.</p>
+
<p>Note that it might take a while for the registration ID be completely removed from GCM. Thus it is possible that messages sent during step 7 above gets a valid message ID as response, even though the message will not be delivered to the device. Eventually, the registration ID will be removed and the server will get a <code>NotRegistered</code> error, without any further action being required from the 3rd-party server (this scenario happens frequently while an application is being developed and tested).</p>
<h2 id="collapsible">Send-to-Sync vs. Messages with Payload</h2>
diff --git a/docs/html/guide/google/gcm/gcm.jd b/docs/html/guide/google/gcm/gcm.jd
index c4dfecf..a47ceb9 100644
--- a/docs/html/guide/google/gcm/gcm.jd
+++ b/docs/html/guide/google/gcm/gcm.jd
@@ -773,13 +773,8 @@
<td>There was an error authenticating the sender account. <a href="#auth_error">Troubleshoot</a></td>
</tr>
<tr>
- <td>500</td>
- <td>There was an internal error in the GCM server while trying to process the request. <a href="#internal_error">Troubleshoot</a></td>
- </tr>
- <tr>
- <td>503</td>
- <td>Indicates that the server is temporarily unavailable (i.e., because of timeouts, etc ). Sender must retry later, honoring any <code>Retry-After</code> header
- included in the response. Application servers must implement exponential back-off. The GCM server took too long to process the request. <a href="#internal_error">Troubleshoot</a></td>
+ <td>5xx</td>
+ <td>Errors in the 500-599 range (such as 500 or 503) indicate that there was an internal error in the GCM server while trying to process the request, or that the server is temporarily unavailable (for example, because of timeouts). Sender must retry later, honoring any <code>Retry-After</code> header included in the response. Application servers must implement exponential back-off. <a href="#internal_error">Troubleshoot</a></td>
</tr>
</table>
@@ -935,17 +930,15 @@
Senders that cause problems risk being blacklisted.
<br />
-Happens when the HTTP status code is 503, or when the <code>error</code> field of a JSON object in the results array is <code>Unavailable</code>.
+Happens when the HTTP status code is between 501 and 599, or when the <code>error</code> field of a JSON object in the results array is <code>Unavailable</code>.
</dd>
<dt id="internal_error"><strong>Internal Server Error</strong></dt>
<dd>
The server encountered an error while trying to process the request. You
-could retry the same request (obeying the requirements listed in the <strong>Timeout</strong>
+could retry the same request (obeying the requirements listed in the <a href="#timeout">Timeout</a>
section), but if the error persists, please report the problem in the <a href="https://groups.google.com/forum/?fromgroups#!forum/android-gcm">android-gcm group</a>.
-<br />
-Senders that cause problems risk being blacklisted.
<br />
Happens when the HTTP status code is 500, or when the <code>error</code> field of a JSON
object in the results array is <code>InternalServerError</code>.
diff --git a/docs/html/guide/google/gcm/gs.jd b/docs/html/guide/google/gcm/gs.jd
index 93eb794..8d132d8 100644
--- a/docs/html/guide/google/gcm/gs.jd
+++ b/docs/html/guide/google/gcm/gs.jd
@@ -145,7 +145,9 @@
<li>If the value is dynamic, the service should override the <code>getSenderIds()</code> method.</li>
</ul>
+
<h4>Step 3: Write the my_app_package.GCMIntentService class</h4>
+
<p>Next write the <code>my_app_package.GCMIntentService</code> class, overriding the following callback methods (which are called by <code>GCMBroadcastReceiver</code>):<br>
</p>
<ul>
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 9307f37..7e047fd 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4302,6 +4302,9 @@
}
public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always) {
+ if (!mVibrator.hasVibrator()) {
+ return false;
+ }
final boolean hapticsDisabled = Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) == 0;
if (!always && (hapticsDisabled || mKeyguardMediator.isShowingAndNotHidden())) {
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 840edaf..bf7be89 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -258,6 +258,9 @@
}
public void dismiss(boolean authenticated) {
+ // If the biometric unlock was suppressed due to a user switch, it can now be safely
+ // unsuppressed because the user has left the unlock screen.
+ KeyguardUpdateMonitor.getInstance(mContext).clearBiometricUnlockUserSwitched();
showNextSecurityScreenOrFinish(authenticated);
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java
index 30cd67b..e573072 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java
@@ -65,7 +65,8 @@
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
final boolean backupIsTimedOut = monitor.getFailedUnlockAttempts() >=
LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
- return monitor.getMaxBiometricUnlockAttemptsReached() || backupIsTimedOut;
+ return monitor.getMaxBiometricUnlockAttemptsReached() || backupIsTimedOut
+ || monitor.didBiometricUnlockUserSwitch();
}
SecurityMode getSecurityMode() {
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
index 15a6f9f..63a074a 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
@@ -102,6 +102,8 @@
private int mFailedAttempts = 0;
private int mFailedBiometricUnlockAttempts = 0;
+ private boolean mBiometricUnlockUserSwitched;
+
private boolean mClockVisible;
private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>>
@@ -404,6 +406,7 @@
cb.onUserSwitched(userId);
}
}
+ mBiometricUnlockUserSwitched = true;
try {
reply.sendResult(null);
} catch (RemoteException e) {
@@ -721,6 +724,14 @@
return mFailedBiometricUnlockAttempts >= FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
}
+ public boolean didBiometricUnlockUserSwitch() {
+ return mBiometricUnlockUserSwitched;
+ }
+
+ public void clearBiometricUnlockUserSwitched() {
+ mBiometricUnlockUserSwitched = false;
+ }
+
public boolean isSimLocked() {
return isSimLocked(mSimState);
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
index 3ffd43f..d25444f 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
@@ -201,6 +201,9 @@
if (v != null) {
mKeyguardHost.removeView(v);
}
+ // TODO: Remove once b/7094175 is fixed
+ Slog.d(TAG, "inflateKeyguardView: b/7094175 mContext.config="
+ + mContext.getResources().getConfiguration());
final LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.keyguard_host_view, mKeyguardHost, true);
mKeyguardView = (KeyguardHostView) view.findViewById(R.id.keyguard_host_view);
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 85b488c..93ae029 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -991,6 +991,14 @@
| Notification.FLAG_NO_CLEAR;
}
+ final int currentUser;
+ final long token = Binder.clearCallingIdentity();
+ try {
+ currentUser = ActivityManager.getCurrentUser();
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+
if (notification.icon != 0) {
final StatusBarNotification n = new StatusBarNotification(
pkg, id, tag, r.uid, r.initialPid, score, notification, user);
@@ -1015,7 +1023,10 @@
Binder.restoreCallingIdentity(identity);
}
}
- sendAccessibilityEvent(notification, pkg);
+ // Send accessibility events only for the current user.
+ if (currentUser == userId) {
+ sendAccessibilityEvent(notification, pkg);
+ }
} else {
Slog.e(TAG, "Ignoring notification with icon==0: " + notification);
if (old != null && old.statusBarKey != null) {
@@ -1029,14 +1040,6 @@
}
}
- final int currentUser;
- final long token = Binder.clearCallingIdentity();
- try {
- currentUser = ActivityManager.getCurrentUser();
- } finally {
- Binder.restoreCallingIdentity(token);
- }
-
// If we're not supposed to beep, vibrate, etc. then don't.
if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0)
&& (!(old != null
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 3d77b3a..7c482f5 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -643,6 +643,10 @@
return mSecurityPolicy.mActiveWindowId;
}
+ void onTouchInteractionStart() {
+ mSecurityPolicy.onTouchInteractionStart();
+ }
+
void onTouchInteractionEnd() {
mSecurityPolicy.onTouchInteractionEnd();
}
@@ -2138,6 +2142,7 @@
| AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED;
private int mActiveWindowId;
+ private boolean mTouchInteractionInProgress;
private boolean canDispatchAccessibilityEvent(AccessibilityEvent event) {
final int eventType = event.getEventType();
@@ -2185,12 +2190,21 @@
}
} break;
case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER: {
- mActiveWindowId = windowId;
+ // Do not allow delayed hover events to confuse us
+ // which the active window is.
+ if (mTouchInteractionInProgress) {
+ mActiveWindowId = windowId;
+ }
} break;
}
}
+ public void onTouchInteractionStart() {
+ mTouchInteractionInProgress = true;
+ }
+
public void onTouchInteractionEnd() {
+ mTouchInteractionInProgress = false;
// We want to set the active window to be current immediately
// after the user has stopped touching the screen since if the
// user types with the IME he should get a feedback for the
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 2688776..dcf87350 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -398,6 +398,7 @@
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
+ mAms.onTouchInteractionStart();
// Pre-feed the motion events to the gesture detector since we
// have a distance slop before getting into gesture detection
// mode and not using the points within this slop significantly
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 037bfde..54f6deb 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -264,6 +264,9 @@
*/
static final int DEFAULT_FADE_IN_OUT_DURATION = 400;
+ /** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */
+ static final int WINDOW_FREEZE_TIMEOUT_DURATION = 3000;
+
/**
* If true, the window manager will do its own custom freezing and general
* management of the screen during rotation.
@@ -2749,7 +2752,10 @@
}
}
- if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
+ if (DEBUG_LAYOUT
+ // TODO: Remove once b/7094175 is fixed
+ || ((String)win.mAttrs.getTitle()).contains("Keyguard")
+ ) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
+ " " + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);
win.mEnforceSizeCompat = (win.mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0;
@@ -5648,12 +5654,12 @@
@Override
public void showStrictModeViolation(boolean on) {
if (mHeadless) return;
- mH.sendMessage(mH.obtainMessage(H.SHOW_STRICT_MODE_VIOLATION, on ? 1 : 0, 0));
+ int pid = Binder.getCallingPid();
+ mH.sendMessage(mH.obtainMessage(H.SHOW_STRICT_MODE_VIOLATION, on ? 1 : 0, pid));
}
- private void showStrictModeViolation(int arg) {
+ private void showStrictModeViolation(int arg, int pid) {
final boolean on = arg != 0;
- int pid = Binder.getCallingPid();
synchronized(mWindowMap) {
// Ignoring requests to enable the red border from clients
// which aren't on screen. (e.g. Broadcast Receivers in
@@ -6018,7 +6024,8 @@
mWindowsFreezingScreen = true;
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
- mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT), 2000);
+ mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT),
+ WINDOW_FREEZE_TIMEOUT_DURATION);
mWaitingForConfig = true;
getDefaultDisplayContentLocked().layoutNeeded = true;
startFreezingDisplayLocked(inTransaction, 0, 0);
@@ -7643,7 +7650,7 @@
}
case SHOW_STRICT_MODE_VIOLATION: {
- showStrictModeViolation(msg.arg1);
+ showStrictModeViolation(msg.arg1, msg.arg2);
break;
}
@@ -8380,7 +8387,7 @@
// when we first froze the display.
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
mH.sendMessageDelayed(mH.obtainMessage(
- H.WINDOW_FREEZE_TIMEOUT), 2000);
+ H.WINDOW_FREEZE_TIMEOUT), WINDOW_FREEZE_TIMEOUT_DURATION);
}
}
}
@@ -9268,7 +9275,9 @@
"Reporting new frame to " + win + ": " + win.mCompatFrame);
int diff = 0;
boolean configChanged = win.isConfigChanged();
- if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION)
+ if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION
+ // TODO: Remove once b/7094175 is fixed
+ || ((String)win.mAttrs.getTitle()).contains("Keyguard"))
&& configChanged) {
Slog.i(TAG, "Sending new config to window " + win + ": "
+ winAnimator.mSurfaceW + "x" + winAnimator.mSurfaceH